Search in sources :

Example 1 with TopologyGuiceModule

use of com.torodb.mongodb.repl.topology.TopologyGuiceModule in project torodb by torodb.

the class MongoDbReplModule method configure.

@Override
protected void configure() {
    expose(TopologyService.class);
    expose(ReplCoordinator.class);
    expose(OplogManager.class);
    bind(ReplCoordinator.class).in(Singleton.class);
    bind(OplogManager.class).in(Singleton.class);
    bind(ReplCoordinatorStateMachine.class).in(Singleton.class);
    install(new MongoClientWrapperModule());
    expose(CachedMongoClientFactory.class);
    bind(OplogReaderProvider.class).to(MongoOplogReaderProvider.class).asEagerSingleton();
    install(new FactoryModuleBuilder().implement(OplogApplierService.class, DefaultOplogApplierService.class).build(OplogApplierService.OplogApplierServiceFactory.class));
    install(new FactoryModuleBuilder().implement(RecoveryService.class, RecoveryService.class).build(RecoveryService.RecoveryServiceFactory.class));
    install(new FactoryModuleBuilder().implement(ContinuousOplogFetcher.class, ContinuousOplogFetcher.class).build(ContinuousOplogFetcher.ContinuousOplogFetcherFactory.class));
    bind(DbCloner.class).annotatedWith(MongoDbRepl.class).toProvider(AkkaDbClonerProvider.class).in(Singleton.class);
    expose(Key.get(DbCloner.class, MongoDbRepl.class));
    bind(OplogApplier.class).to(DefaultOplogApplier.class).in(Singleton.class);
    bind(DefaultOplogApplier.BatchLimits.class).toInstance(new BatchLimits(1000, Duration.ofSeconds(2)));
    bind(CommitHeuristic.class).to(DefaultCommitHeuristic.class).in(Singleton.class);
    bind(Integer.class).annotatedWith(DocsPerTransaction.class).toInstance(1000);
    bind(ConcurrentOplogBatchExecutor.class).in(Singleton.class);
    bind(AnalyzedOplogBatchExecutor.class).to(ConcurrentOplogBatchExecutor.class);
    expose(AnalyzedOplogBatchExecutor.class);
    bind(ConcurrentOplogBatchExecutor.ConcurrentOplogBatchExecutorMetrics.class).in(Singleton.class);
    bind(AnalyzedOplogBatchExecutor.AnalyzedOplogBatchExecutorMetrics.class).to(ConcurrentOplogBatchExecutorMetrics.class);
    bind(ConcurrentOplogBatchExecutor.SubBatchHeuristic.class).toInstance((ConcurrentOplogBatchExecutorMetrics metrics) -> 100);
    install(new FactoryModuleBuilder().implement(BatchAnalyzer.class, BatchAnalyzer.class).build(BatchAnalyzer.BatchAnalyzerFactory.class));
    bind(AnalyzedOpReducer.class).toInstance(new AnalyzedOpReducer(false));
    install(new TopologyGuiceModule());
    bind(MongodbReplConfig.class).toInstance(config);
    bind(ReplMetrics.class).in(Singleton.class);
    bind(OplogApplierMetrics.class).in(Singleton.class);
    bind(OplogOperationApplier.class).in(Singleton.class);
    bind(NamespaceJobExecutor.class).in(Singleton.class);
    install(new ReplCommandsGuiceModule());
    install(new MongoLayerModule(new ReplCommandImplementionsModule()));
    expose(MongodServer.class);
}
Also used : BatchLimits(com.torodb.mongodb.repl.oplogreplier.DefaultOplogApplier.BatchLimits) AnalyzedOplogBatchExecutor(com.torodb.mongodb.repl.oplogreplier.batch.AnalyzedOplogBatchExecutor) DefaultOplogApplier(com.torodb.mongodb.repl.oplogreplier.DefaultOplogApplier) MongoLayerModule(com.torodb.mongodb.guice.MongoLayerModule) FactoryModuleBuilder(com.google.inject.assistedinject.FactoryModuleBuilder) ConcurrentOplogBatchExecutor(com.torodb.mongodb.repl.oplogreplier.batch.ConcurrentOplogBatchExecutor) ReplCommandsGuiceModule(com.torodb.mongodb.repl.commands.ReplCommandsGuiceModule) MongoOplogReaderProvider(com.torodb.mongodb.repl.impl.MongoOplogReaderProvider) TopologyGuiceModule(com.torodb.mongodb.repl.topology.TopologyGuiceModule) DbCloner(com.torodb.mongodb.utils.DbCloner) OplogOperationApplier(com.torodb.mongodb.repl.oplogreplier.OplogOperationApplier) NamespaceJobExecutor(com.torodb.mongodb.repl.oplogreplier.batch.NamespaceJobExecutor) AnalyzedOpReducer(com.torodb.mongodb.repl.oplogreplier.analyzed.AnalyzedOpReducer) OplogManager(com.torodb.mongodb.repl.OplogManager) ReplCoordinator(com.torodb.mongodb.repl.ReplCoordinator) ConcurrentOplogBatchExecutorMetrics(com.torodb.mongodb.repl.oplogreplier.batch.ConcurrentOplogBatchExecutor.ConcurrentOplogBatchExecutorMetrics) ReplCommandImplementionsModule(com.torodb.mongodb.repl.commands.ReplCommandImplementionsModule) ReplMetrics(com.torodb.mongodb.repl.ReplMetrics) ReplCoordinatorStateMachine(com.torodb.mongodb.repl.ReplCoordinatorStateMachine) OplogApplierMetrics(com.torodb.mongodb.repl.oplogreplier.OplogApplierMetrics)

Aggregations

FactoryModuleBuilder (com.google.inject.assistedinject.FactoryModuleBuilder)1 MongoLayerModule (com.torodb.mongodb.guice.MongoLayerModule)1 OplogManager (com.torodb.mongodb.repl.OplogManager)1 ReplCoordinator (com.torodb.mongodb.repl.ReplCoordinator)1 ReplCoordinatorStateMachine (com.torodb.mongodb.repl.ReplCoordinatorStateMachine)1 ReplMetrics (com.torodb.mongodb.repl.ReplMetrics)1 ReplCommandImplementionsModule (com.torodb.mongodb.repl.commands.ReplCommandImplementionsModule)1 ReplCommandsGuiceModule (com.torodb.mongodb.repl.commands.ReplCommandsGuiceModule)1 MongoOplogReaderProvider (com.torodb.mongodb.repl.impl.MongoOplogReaderProvider)1 DefaultOplogApplier (com.torodb.mongodb.repl.oplogreplier.DefaultOplogApplier)1 BatchLimits (com.torodb.mongodb.repl.oplogreplier.DefaultOplogApplier.BatchLimits)1 OplogApplierMetrics (com.torodb.mongodb.repl.oplogreplier.OplogApplierMetrics)1 OplogOperationApplier (com.torodb.mongodb.repl.oplogreplier.OplogOperationApplier)1 AnalyzedOpReducer (com.torodb.mongodb.repl.oplogreplier.analyzed.AnalyzedOpReducer)1 AnalyzedOplogBatchExecutor (com.torodb.mongodb.repl.oplogreplier.batch.AnalyzedOplogBatchExecutor)1 ConcurrentOplogBatchExecutor (com.torodb.mongodb.repl.oplogreplier.batch.ConcurrentOplogBatchExecutor)1 ConcurrentOplogBatchExecutorMetrics (com.torodb.mongodb.repl.oplogreplier.batch.ConcurrentOplogBatchExecutor.ConcurrentOplogBatchExecutorMetrics)1 NamespaceJobExecutor (com.torodb.mongodb.repl.oplogreplier.batch.NamespaceJobExecutor)1 TopologyGuiceModule (com.torodb.mongodb.repl.topology.TopologyGuiceModule)1 DbCloner (com.torodb.mongodb.utils.DbCloner)1