Search in sources :

Example 1 with KeyValueServiceRuntimeConfig

use of com.palantir.atlasdb.spi.KeyValueServiceRuntimeConfig in project atlasdb by palantir.

the class TestTransactionManagerModule method provideDerivedSnapshotConfig.

@Provides
@Singleton
@Internal
public DerivedSnapshotConfig provideDerivedSnapshotConfig(AtlasDbConfig atlasDbConfig, AtlasDbRuntimeConfig atlasDbRuntimeConfig) {
    KeyValueServiceConfig keyValueServiceConfig = atlasDbConfig.keyValueService();
    Optional<KeyValueServiceRuntimeConfig> keyValueServiceRuntimeConfig = atlasDbRuntimeConfig.keyValueService();
    AtlasDbFactory atlasDbFactory = AtlasDbServiceDiscovery.createAtlasFactoryOfCorrectType(keyValueServiceConfig);
    return atlasDbFactory.createDerivedSnapshotConfig(keyValueServiceConfig, keyValueServiceRuntimeConfig);
}
Also used : KeyValueServiceConfig(com.palantir.atlasdb.spi.KeyValueServiceConfig) AtlasDbFactory(com.palantir.atlasdb.spi.AtlasDbFactory) KeyValueServiceRuntimeConfig(com.palantir.atlasdb.spi.KeyValueServiceRuntimeConfig) Singleton(javax.inject.Singleton) Provides(dagger.Provides)

Example 2 with KeyValueServiceRuntimeConfig

use of com.palantir.atlasdb.spi.KeyValueServiceRuntimeConfig in project atlasdb by palantir.

the class AtlasDbServicesConnector method connect.

public AtlasDbServices connect() {
    if (services != null) {
        throw new SafeIllegalStateException("connect() has already been called");
    }
    DockerizedDatabaseUri dburi = DockerizedDatabaseUri.fromUriString(uri);
    KeyValueServiceConfig config = dburi.getKeyValueServiceInstrumentation().getKeyValueServiceConfig(dburi.getAddress());
    Optional<KeyValueServiceRuntimeConfig> runtimeConfig = dburi.getKeyValueServiceInstrumentation().getKeyValueServiceRuntimeConfig(dburi.getAddress());
    ImmutableAtlasDbConfig atlasDbConfig = ImmutableAtlasDbConfig.builder().keyValueService(config).build();
    ImmutableAtlasDbRuntimeConfig atlasDbRuntimeConfig = ImmutableAtlasDbRuntimeConfig.defaultRuntimeConfig().withKeyValueService(runtimeConfig);
    ServicesConfigModule servicesConfigModule = ServicesConfigModule.create(atlasDbConfig, atlasDbRuntimeConfig);
    services = DaggerAtlasDbServices.builder().servicesConfigModule(servicesConfigModule).build();
    return services;
}
Also used : KeyValueServiceConfig(com.palantir.atlasdb.spi.KeyValueServiceConfig) ImmutableAtlasDbRuntimeConfig(com.palantir.atlasdb.config.ImmutableAtlasDbRuntimeConfig) ImmutableAtlasDbConfig(com.palantir.atlasdb.config.ImmutableAtlasDbConfig) ServicesConfigModule(com.palantir.atlasdb.services.ServicesConfigModule) SafeIllegalStateException(com.palantir.logsafe.exceptions.SafeIllegalStateException) KeyValueServiceRuntimeConfig(com.palantir.atlasdb.spi.KeyValueServiceRuntimeConfig)

Example 3 with KeyValueServiceRuntimeConfig

use of com.palantir.atlasdb.spi.KeyValueServiceRuntimeConfig in project atlasdb by palantir.

the class TimeLockAgentTest method getKeyValueServiceRuntimeConfigPassesThroughConfigIfAppropriate.

@Test
public void getKeyValueServiceRuntimeConfigPassesThroughConfigIfAppropriate() {
    // Usage of mock here is to avoid introducing a dependency on atlasdb-dbkvs
    KeyValueServiceRuntimeConfig runtimeConfig = mock(KeyValueServiceRuntimeConfig.class);
    when(runtimeConfig.type()).thenReturn("relational");
    assertThat(TimeLockAgent.getKeyValueServiceRuntimeConfig(ImmutableTimeLockRuntimeConfiguration.builder().timestampBoundPersistence(ImmutableDatabaseTsBoundPersisterRuntimeConfiguration.builder().keyValueServiceRuntimeConfig(runtimeConfig).build()).clusterSnapshot(CLUSTER_CONFIG).build())).contains(runtimeConfig);
}
Also used : KeyValueServiceRuntimeConfig(com.palantir.atlasdb.spi.KeyValueServiceRuntimeConfig) Test(org.junit.Test)

Example 4 with KeyValueServiceRuntimeConfig

use of com.palantir.atlasdb.spi.KeyValueServiceRuntimeConfig in project atlasdb by palantir.

the class TransactionManagerModule method provideDerivedSnapshotConfig.

@Provides
@Singleton
@Internal
public DerivedSnapshotConfig provideDerivedSnapshotConfig(AtlasDbConfig atlasDbConfig, AtlasDbRuntimeConfig atlasDbRuntimeConfig) {
    KeyValueServiceConfig keyValueServiceConfig = atlasDbConfig.keyValueService();
    Optional<KeyValueServiceRuntimeConfig> keyValueServiceRuntimeConfig = atlasDbRuntimeConfig.keyValueService();
    AtlasDbFactory atlasDbFactory = AtlasDbServiceDiscovery.createAtlasFactoryOfCorrectType(keyValueServiceConfig);
    return atlasDbFactory.createDerivedSnapshotConfig(keyValueServiceConfig, keyValueServiceRuntimeConfig);
}
Also used : KeyValueServiceConfig(com.palantir.atlasdb.spi.KeyValueServiceConfig) AtlasDbFactory(com.palantir.atlasdb.spi.AtlasDbFactory) KeyValueServiceRuntimeConfig(com.palantir.atlasdb.spi.KeyValueServiceRuntimeConfig) Singleton(javax.inject.Singleton) Provides(dagger.Provides)

Aggregations

KeyValueServiceRuntimeConfig (com.palantir.atlasdb.spi.KeyValueServiceRuntimeConfig)4 KeyValueServiceConfig (com.palantir.atlasdb.spi.KeyValueServiceConfig)3 AtlasDbFactory (com.palantir.atlasdb.spi.AtlasDbFactory)2 Provides (dagger.Provides)2 Singleton (javax.inject.Singleton)2 ImmutableAtlasDbConfig (com.palantir.atlasdb.config.ImmutableAtlasDbConfig)1 ImmutableAtlasDbRuntimeConfig (com.palantir.atlasdb.config.ImmutableAtlasDbRuntimeConfig)1 ServicesConfigModule (com.palantir.atlasdb.services.ServicesConfigModule)1 SafeIllegalStateException (com.palantir.logsafe.exceptions.SafeIllegalStateException)1 Test (org.junit.Test)1