Search in sources :

Example 1 with KeyValueServiceConfig

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

the class AtlasDbCommandUtilsTest method setUp.

@Before
public void setUp() {
    KeyValueServiceConfig kvsConfig = mock(KeyValueServiceConfig.class);
    when(kvsConfig.namespace()).thenReturn(Optional.of("test"));
    minimalLeaderConfig = ImmutableAtlasDbConfig.builder().leader(ImmutableLeaderConfig.builder().quorumSize(1).addLeaders(LOCAL_SERVER_NAME).localServer(LOCAL_SERVER_NAME).build()).keyValueService(kvsConfig).build();
    minimalEmbeddedConfig = ImmutableAtlasDbConfig.builder().keyValueService(kvsConfig).build();
    timeLockConfig = ImmutableAtlasDbConfig.builder().timelock(TIME_LOCK_CLIENT_CONFIG).keyValueService(kvsConfig).build();
    runtimeConfig = ImmutableAtlasDbRuntimeConfig.builder().timelockRuntime(ImmutableTimeLockRuntimeConfig.builder().serversList(LOCAL_SERVER_LIST_CONFIG).build()).build();
}
Also used : ImmutableCassandraKeyValueServiceConfig(com.palantir.atlasdb.cassandra.ImmutableCassandraKeyValueServiceConfig) KeyValueServiceConfig(com.palantir.atlasdb.spi.KeyValueServiceConfig) Before(org.junit.Before)

Example 2 with KeyValueServiceConfig

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

the class AtlasDbServicesConnector method connect.

public AtlasDbServices connect() {
    if (services != null) {
        throw new IllegalStateException("connect() has already been called");
    }
    DockerizedDatabaseUri dburi = DockerizedDatabaseUri.fromUriString(uri);
    KeyValueServiceConfig config = dburi.getKeyValueServiceInstrumentation().getKeyValueServiceConfig(dburi.getAddress());
    ImmutableAtlasDbConfig atlasDbConfig = ImmutableAtlasDbConfig.builder().keyValueService(config).build();
    ImmutableAtlasDbRuntimeConfig runtimeConfig = ImmutableAtlasDbRuntimeConfig.defaultRuntimeConfig();
    ServicesConfigModule servicesConfigModule = ServicesConfigModule.create(atlasDbConfig, runtimeConfig);
    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)

Example 3 with KeyValueServiceConfig

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

the class PostgresConfigLoadingTest method getConnectionConfig.

private ConnectionConfig getConnectionConfig() throws IOException {
    AtlasDbConfig config = getPostgresTestConfig();
    KeyValueServiceConfig keyValueServiceConfig = config.keyValueService();
    DbKeyValueServiceConfig dbkvsConfig = (DbKeyValueServiceConfig) keyValueServiceConfig;
    return dbkvsConfig.connection();
}
Also used : DbKeyValueServiceConfig(com.palantir.atlasdb.keyvalue.dbkvs.DbKeyValueServiceConfig) KeyValueServiceConfig(com.palantir.atlasdb.spi.KeyValueServiceConfig) DbKeyValueServiceConfig(com.palantir.atlasdb.keyvalue.dbkvs.DbKeyValueServiceConfig) AtlasDbConfig(com.palantir.atlasdb.config.AtlasDbConfig)

Example 4 with KeyValueServiceConfig

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

the class CleanCassLocksStateCommand method getCassandraKvsConfig.

private CassandraKeyValueServiceConfig getCassandraKvsConfig() {
    KeyValueServiceConfig kvsConfig = getAtlasDbConfig().keyValueService();
    if (!kvsConfig.type().equals(CassandraKeyValueServiceConfig.TYPE)) {
        throw new IllegalStateException(String.format("KeyValueService must be of type %s, but yours is %s", CassandraKeyValueServiceConfig.TYPE, kvsConfig.type()));
    }
    CassandraKeyValueServiceConfig cassandraConfig = (CassandraKeyValueServiceConfig) kvsConfig;
    Optional<String> namespace = getAtlasDbConfig().namespace();
    String desiredKeyspace = OptionalResolver.resolve(namespace, cassandraConfig.keyspace());
    return CassandraKeyValueServiceConfigs.copyWithKeyspace(cassandraConfig, desiredKeyspace);
}
Also used : CassandraKeyValueServiceConfig(com.palantir.atlasdb.cassandra.CassandraKeyValueServiceConfig) KeyValueServiceConfig(com.palantir.atlasdb.spi.KeyValueServiceConfig) CassandraKeyValueServiceConfig(com.palantir.atlasdb.cassandra.CassandraKeyValueServiceConfig)

Aggregations

KeyValueServiceConfig (com.palantir.atlasdb.spi.KeyValueServiceConfig)4 CassandraKeyValueServiceConfig (com.palantir.atlasdb.cassandra.CassandraKeyValueServiceConfig)1 ImmutableCassandraKeyValueServiceConfig (com.palantir.atlasdb.cassandra.ImmutableCassandraKeyValueServiceConfig)1 AtlasDbConfig (com.palantir.atlasdb.config.AtlasDbConfig)1 ImmutableAtlasDbConfig (com.palantir.atlasdb.config.ImmutableAtlasDbConfig)1 ImmutableAtlasDbRuntimeConfig (com.palantir.atlasdb.config.ImmutableAtlasDbRuntimeConfig)1 DbKeyValueServiceConfig (com.palantir.atlasdb.keyvalue.dbkvs.DbKeyValueServiceConfig)1 ServicesConfigModule (com.palantir.atlasdb.services.ServicesConfigModule)1 Before (org.junit.Before)1