Search in sources :

Example 6 with GrpcConfig

use of com.scalar.db.storage.rpc.GrpcConfig in project scalardb by scalar-labs.

the class DistributedTransactionServiceWithConsensusCommitWithExtraWriteIntegrationTest method setUpBeforeClass.

@BeforeClass
public static void setUpBeforeClass() throws ExecutionException, IOException {
    ServerConfig serverConfig = ServerEnv.getServerConfig(Isolation.SERIALIZABLE, SerializableStrategy.EXTRA_WRITE);
    if (serverConfig != null) {
        server = new ScalarDbServer(serverConfig);
        server.start();
    }
    GrpcConfig grpcConfig = ServerEnv.getGrpcConfig();
    StorageFactory factory = new StorageFactory(grpcConfig);
    admin = factory.getAdmin();
    consensusCommitAdmin = new ConsensusCommitAdmin(admin, new ConsensusCommitConfig(grpcConfig.getProperties()));
    createTables(admin, consensusCommitAdmin);
    manager = new GrpcTransactionManager(grpcConfig);
}
Also used : ConsensusCommitConfig(com.scalar.db.transaction.consensuscommit.ConsensusCommitConfig) StorageFactory(com.scalar.db.service.StorageFactory) GrpcTransactionManager(com.scalar.db.transaction.rpc.GrpcTransactionManager) GrpcConfig(com.scalar.db.storage.rpc.GrpcConfig) ConsensusCommitAdmin(com.scalar.db.transaction.consensuscommit.ConsensusCommitAdmin) BeforeClass(org.junit.BeforeClass)

Example 7 with GrpcConfig

use of com.scalar.db.storage.rpc.GrpcConfig in project scalardb by scalar-labs.

the class ServerEnv method getGrpcConfig.

public static GrpcConfig getGrpcConfig() {
    String contactPoints = System.getProperty(PROP_GRPC_CONTACT_POINTS, DEFAULT_GRPC_CONTACT_POINTS);
    String contactPort = System.getProperty(PROP_GRPC_CONTACT_PORT, DEFAULT_GRPC_CONTACT_PORT);
    Properties properties = new Properties();
    properties.setProperty(DatabaseConfig.CONTACT_POINTS, contactPoints);
    properties.setProperty(DatabaseConfig.CONTACT_PORT, contactPort);
    properties.setProperty(DatabaseConfig.STORAGE, "grpc");
    return new GrpcConfig(properties);
}
Also used : GrpcConfig(com.scalar.db.storage.rpc.GrpcConfig) Properties(java.util.Properties)

Example 8 with GrpcConfig

use of com.scalar.db.storage.rpc.GrpcConfig in project scalardb by scalar-labs.

the class TwoPhaseCommitTransactionServiceWithTwoPhaseConsensusCommitIntegrationTest method setUpBeforeClass.

@BeforeClass
public static void setUpBeforeClass() throws ExecutionException, IOException {
    ServerConfig serverConfig = ServerEnv.getServerConfig();
    if (serverConfig != null) {
        server = new ScalarDbServer(serverConfig);
        server.start();
    }
    GrpcConfig grpcConfig = ServerEnv.getGrpcConfig();
    StorageFactory factory = new StorageFactory(grpcConfig);
    admin = factory.getAdmin();
    consensusCommitAdmin = new ConsensusCommitAdmin(admin, new ConsensusCommitConfig(grpcConfig.getProperties()));
    createTables(admin, consensusCommitAdmin);
    manager = new GrpcTwoPhaseCommitTransactionManager(grpcConfig);
}
Also used : ConsensusCommitConfig(com.scalar.db.transaction.consensuscommit.ConsensusCommitConfig) StorageFactory(com.scalar.db.service.StorageFactory) GrpcConfig(com.scalar.db.storage.rpc.GrpcConfig) GrpcTwoPhaseCommitTransactionManager(com.scalar.db.transaction.rpc.GrpcTwoPhaseCommitTransactionManager) ConsensusCommitAdmin(com.scalar.db.transaction.consensuscommit.ConsensusCommitAdmin) BeforeClass(org.junit.BeforeClass)

Aggregations

GrpcConfig (com.scalar.db.storage.rpc.GrpcConfig)8 StorageFactory (com.scalar.db.service.StorageFactory)7 BeforeClass (org.junit.BeforeClass)7 ConsensusCommitAdmin (com.scalar.db.transaction.consensuscommit.ConsensusCommitAdmin)6 ConsensusCommitConfig (com.scalar.db.transaction.consensuscommit.ConsensusCommitConfig)6 GrpcTransactionManager (com.scalar.db.transaction.rpc.GrpcTransactionManager)4 GrpcTwoPhaseCommitTransactionManager (com.scalar.db.transaction.rpc.GrpcTwoPhaseCommitTransactionManager)3 Properties (java.util.Properties)1