Search in sources :

Example 6 with StorageFactory

use of com.scalar.db.service.StorageFactory in project scalardb by scalar-labs.

the class TwoPhaseConsensusCommitIntegrationTest method initStorageAndAdmin.

private static void initStorageAndAdmin(DatabaseConfig config) {
    StorageFactory factory = new StorageFactory(config);
    storage = factory.getStorage();
    admin = factory.getAdmin();
    consensusCommitAdmin = new ConsensusCommitAdmin(admin, new ConsensusCommitConfig(config.getProperties()));
}
Also used : StorageFactory(com.scalar.db.service.StorageFactory)

Example 7 with StorageFactory

use of com.scalar.db.service.StorageFactory in project scalardb by scalar-labs.

the class TwoPhaseCommitTransactionServiceWithTwoPhaseConsensusCommitWithExtraReadIntegrationTest method setUpBeforeClass.

@BeforeClass
public static void setUpBeforeClass() throws ExecutionException, IOException {
    ServerConfig serverConfig = ServerEnv.getServerConfig(Isolation.SERIALIZABLE, SerializableStrategy.EXTRA_READ);
    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)

Example 8 with StorageFactory

use of com.scalar.db.service.StorageFactory in project scalardb by scalar-labs.

the class TwoPhaseCommitTransactionServiceWithTwoPhaseConsensusCommitWithExtraWriteIntegrationTest 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 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)

Example 9 with StorageFactory

use of com.scalar.db.service.StorageFactory in project scalardb by scalar-labs.

the class DistributedTransactionServiceWithJdbcTransactionIntegrationTest method setUpBeforeClass.

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

Example 10 with StorageFactory

use of com.scalar.db.service.StorageFactory in project scalardb by scalar-labs.

the class DistributedTransactionServiceWithConsensusCommitIntegrationTest 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 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)

Aggregations

StorageFactory (com.scalar.db.service.StorageFactory)37 BeforeAll (org.junit.jupiter.api.BeforeAll)13 Before (org.junit.Before)11 ConsensusCommitAdmin (com.scalar.db.transaction.consensuscommit.ConsensusCommitAdmin)8 BeforeClass (org.junit.BeforeClass)8 GrpcConfig (com.scalar.db.storage.rpc.GrpcConfig)7 ConsensusCommitConfig (com.scalar.db.transaction.consensuscommit.ConsensusCommitConfig)7 DatabaseConfig (com.scalar.db.config.DatabaseConfig)6 GrpcTransactionManager (com.scalar.db.transaction.rpc.GrpcTransactionManager)4 GrpcTwoPhaseCommitTransactionManager (com.scalar.db.transaction.rpc.GrpcTwoPhaseCommitTransactionManager)3 Properties (java.util.Properties)3 TableMetadata (com.scalar.db.api.TableMetadata)2 JdbcConfig (com.scalar.db.storage.jdbc.JdbcConfig)1