Search in sources :

Example 11 with RawConfig

use of com.yahoo.vespa.config.RawConfig in project vespa by vespa-engine.

the class UpstreamConfigSubscriber method updateWithNewConfig.

private void updateWithNewConfig(GenericConfigHandle handle) {
    final RawConfig newConfig = handle.getRawConfig();
    if (log.isLoggable(LogLevel.DEBUG)) {
        log.log(LogLevel.DEBUG, "config to be returned for '" + newConfig.getKey() + "', generation=" + newConfig.getGeneration() + ", payload=" + newConfig.getPayload());
    }
    memoryCache.put(newConfig);
    clientUpdater.updateSubscribers(newConfig);
}
Also used : RawConfig(com.yahoo.vespa.config.RawConfig)

Example 12 with RawConfig

use of com.yahoo.vespa.config.RawConfig in project vespa by vespa-engine.

the class MockClientUpdater method waitForConfigGeneration.

long waitForConfigGeneration(ConfigKey<?> configKey, long expectedGeneration) {
    Instant end = Instant.now().plus(Duration.ofSeconds(60));
    RawConfig lastConfig;
    do {
        lastConfig = getLastConfig();
        System.out.println("config=" + lastConfig + (lastConfig == null ? "" : ",generation=" + lastConfig.getGeneration()));
        if (lastConfig != null && lastConfig.getKey().equals(configKey) && lastConfig.getGeneration() == expectedGeneration) {
            break;
        } else {
            try {
                Thread.sleep(10);
            } catch (InterruptedException e) {
                throw new RuntimeException(e);
            }
        }
    } while (Instant.now().isBefore(end));
    if (lastConfig == null || !lastConfig.getKey().equals(configKey) || lastConfig.getGeneration() != expectedGeneration)
        throw new RuntimeException("Did not get config " + configKey + " with generation " + expectedGeneration);
    return lastConfig.getGeneration();
}
Also used : Instant(java.time.Instant) RawConfig(com.yahoo.vespa.config.RawConfig)

Example 13 with RawConfig

use of com.yahoo.vespa.config.RawConfig in project vespa by vespa-engine.

the class MockConfigSourceClient method getConfig.

@Override
public RawConfig getConfig(RawConfig input, JRTServerConfigRequest request) {
    final RawConfig config = getConfig(input.getKey());
    memoryCache.put(config);
    return config;
}
Also used : RawConfig(com.yahoo.vespa.config.RawConfig)

Aggregations

RawConfig (com.yahoo.vespa.config.RawConfig)13 Test (org.junit.Test)7 Request (com.yahoo.jrt.Request)2 ConfigCacheKey (com.yahoo.vespa.config.ConfigCacheKey)2 FunctionTestConfig (com.yahoo.foo.FunctionTestConfig)1 Slime (com.yahoo.slime.Slime)1 ConfigPayload (com.yahoo.vespa.config.ConfigPayload)1 JRTServerConfigRequest (com.yahoo.vespa.config.protocol.JRTServerConfigRequest)1 File (java.io.File)1 Instant (java.time.Instant)1 ArrayList (java.util.ArrayList)1 Date (java.util.Date)1 Before (org.junit.Before)1