use of com.torodb.mongodb.guice.MongoLayerModule 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);
}
use of com.torodb.mongodb.guice.MongoLayerModule in project torodb by torodb.
the class ToroDbRuntimeModule method configure.
@Override
protected void configure() {
binder().requireExplicitBindings();
bind(BackendService.class).toInstance(backend.getBackendService());
expose(BackendService.class);
install(new D2RModule());
install(new SqlTorodModule());
install(new MongoLayerModule());
expose(MongodServer.class);
expose(TorodbCommandsLibrary.class);
expose(ObjectIdFactory.class);
}
use of com.torodb.mongodb.guice.MongoLayerModule in project torodb by torodb.
the class OplogTestContextResourceRule method before.
@Override
protected void before() throws Throwable {
testInjector = Guice.createInjector(new ReplTestModule(), new TorodServerTestModule(), new CoreModule(), new BackendModule(), new DerbyBackendModule(), new MetainfModule(), new D2RModule(), new MemoryTorodModule(), new MetricsModule(new MetricsConfig() {
@Override
public Boolean getMetricsEnabled() {
return true;
}
}), new ConcurrentModule(), new MongoLayerModule(), new MongodServerTestModule(), specificModuleSupplier.get());
torodServer = testInjector.getInstance(TorodBundle.class).getTorodServer();
torodServer.startAsync();
mongodServer = testInjector.getInstance(MongodServer.class);
mongodServer.startAsync();
mongodServer.awaitRunning();
assert mongodServer.getTorodServer().equals(torodServer);
torodServer.awaitRunning();
oplogManager = testInjector.getInstance(OplogManager.class);
oplogManager.startAsync();
oplogManager.awaitRunning();
aobe = testInjector.getInstance(AnalyzedOplogBatchExecutor.class);
aobe.startAsync();
aobe.awaitRunning();
oplogApplier = testInjector.getInstance(OplogApplier.class);
testContext = new DefaultOplogTestContext(mongodServer, oplogApplier);
}
Aggregations