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);
}
Aggregations