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);
}
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;
}
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);
}
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);
}
Aggregations