Search in sources :

Example 1 with ConsistencyHandler

use of com.torodb.mongodb.repl.ConsistencyHandler in project torodb by torodb.

the class StampedeService method startUp.

@Override
protected void startUp() throws Exception {
    LOGGER.info("Starting up ToroDB Stampede");
    shutdowner = bootstrapInjector.getInstance(Shutdowner.class);
    shutdowner.awaitRunning();
    BackendBundle backendBundle = createBackendBundle();
    startBundle(backendBundle);
    BackendService backendService = backendBundle.getBackendService();
    ConsistencyHandler consistencyHandler = createConsistencyHandler(backendService);
    if (!consistencyHandler.isConsistent()) {
        LOGGER.info("Database is not consistent. Cleaning it up");
        dropDatabase(backendService);
    }
    Injector finalInjector = createFinalInjector(backendBundle, consistencyHandler);
    AbstractReplication replication = getReplication();
    reportReplication(replication);
    TorodBundle torodBundle = createTorodBundle(finalInjector);
    startBundle(torodBundle);
    MongodbReplConfig replConfig = getReplConfig(replication);
    startBundle(createMongodbReplBundle(finalInjector, torodBundle, replConfig));
    LOGGER.info("ToroDB Stampede is now running");
}
Also used : BackendService(com.torodb.core.backend.BackendService) Shutdowner(com.torodb.core.Shutdowner) Injector(com.google.inject.Injector) BackendBundle(com.torodb.core.backend.BackendBundle) MongodbReplConfig(com.torodb.mongodb.repl.guice.MongodbReplConfig) ConsistencyHandler(com.torodb.mongodb.repl.ConsistencyHandler) AbstractReplication(com.torodb.packaging.config.model.protocol.mongo.AbstractReplication) TorodBundle(com.torodb.torod.TorodBundle)

Example 2 with ConsistencyHandler

use of com.torodb.mongodb.repl.ConsistencyHandler in project torodb by torodb.

the class StampedeRuntimeModule method configure.

@Override
protected void configure() {
    binder().requireExplicitBindings();
    bind(ConsistencyHandler.class).toInstance(consistencyHandler);
    expose(ConsistencyHandler.class);
    bind(BackendService.class).toInstance(backend.getBackendService());
    expose(BackendService.class);
    install(new D2RModule());
    install(new SqlTorodModule());
}
Also used : BackendService(com.torodb.core.backend.BackendService) SqlTorodModule(com.torodb.torod.guice.SqlTorodModule) D2RModule(com.torodb.d2r.guice.D2RModule) ConsistencyHandler(com.torodb.mongodb.repl.ConsistencyHandler)

Aggregations

BackendService (com.torodb.core.backend.BackendService)2 ConsistencyHandler (com.torodb.mongodb.repl.ConsistencyHandler)2 Injector (com.google.inject.Injector)1 Shutdowner (com.torodb.core.Shutdowner)1 BackendBundle (com.torodb.core.backend.BackendBundle)1 D2RModule (com.torodb.d2r.guice.D2RModule)1 MongodbReplConfig (com.torodb.mongodb.repl.guice.MongodbReplConfig)1 AbstractReplication (com.torodb.packaging.config.model.protocol.mongo.AbstractReplication)1 TorodBundle (com.torodb.torod.TorodBundle)1 SqlTorodModule (com.torodb.torod.guice.SqlTorodModule)1