Search in sources :

Example 1 with IndexModule

use of com.google.gerrit.server.index.IndexModule in project gerrit by GerritCodeReview.

the class Reindex method createSysInjector.

private Injector createSysInjector() {
    Map<String, Integer> versions = new HashMap<>();
    if (changesVersion != null) {
        versions.put(ChangeSchemaDefinitions.INSTANCE.getName(), changesVersion);
    }
    boolean replica = ReplicaUtil.isReplica(globalConfig);
    List<Module> modules = new ArrayList<>();
    Module indexModule;
    IndexType indexType = IndexModule.getIndexType(dbInjector);
    if (indexType.isLucene()) {
        indexModule = LuceneIndexModule.singleVersionWithExplicitVersions(versions, threads, replica, AutoFlush.DISABLED);
    } else if (indexType.isFake()) {
        // compile the component in.
        try {
            Class<?> clazz = Class.forName("com.google.gerrit.index.testing.FakeIndexModule");
            Method m = clazz.getMethod("singleVersionWithExplicitVersions", Map.class, int.class, boolean.class);
            indexModule = (Module) m.invoke(null, versions, threads, replica);
        } catch (NoSuchMethodException | ClassNotFoundException | IllegalAccessException | InvocationTargetException e) {
            throw new IllegalStateException("can't create index", e);
        }
    } else {
        throw new IllegalStateException("unsupported index.type = " + indexType);
    }
    modules.add(indexModule);
    modules.add(new AbstractModule() {

        @Override
        protected void configure() {
            super.configure();
            OptionalBinder.newOptionalBinder(binder(), IsFirstInsertForEntry.class).setBinding().toInstance(IsFirstInsertForEntry.YES);
        }
    });
    modules.add(new BatchProgramModule(dbInjector));
    modules.add(new FactoryModule() {

        @Override
        protected void configure() {
            factory(ChangeResource.Factory.class);
        }
    });
    return dbInjector.createChildInjector(ModuleOverloader.override(modules, LibModuleLoader.loadReindexModules(cfgInjector, versions, threads, replica)));
}
Also used : HashMap(java.util.HashMap) IsFirstInsertForEntry(com.google.gerrit.server.index.options.IsFirstInsertForEntry) FactoryModule(com.google.gerrit.extensions.config.FactoryModule) ArrayList(java.util.ArrayList) Method(java.lang.reflect.Method) AbstractModule(com.google.inject.AbstractModule) BatchProgramModule(com.google.gerrit.pgm.util.BatchProgramModule) Module(com.google.inject.Module) LuceneIndexModule(com.google.gerrit.lucene.LuceneIndexModule) FactoryModule(com.google.gerrit.extensions.config.FactoryModule) IndexModule(com.google.gerrit.server.index.IndexModule) BatchProgramModule(com.google.gerrit.pgm.util.BatchProgramModule) AbstractModule(com.google.inject.AbstractModule) IndexType(com.google.gerrit.index.IndexType) Map(java.util.Map) HashMap(java.util.HashMap) DynamicMap(com.google.gerrit.extensions.registration.DynamicMap)

Example 2 with IndexModule

use of com.google.gerrit.server.index.IndexModule in project gerrit by GerritCodeReview.

the class ElasticIndexModule method configure.

@Override
protected void configure() {
    install(new FactoryModuleBuilder().implement(AccountIndex.class, ElasticAccountIndex.class).build(AccountIndex.Factory.class));
    install(new FactoryModuleBuilder().implement(ChangeIndex.class, ElasticChangeIndex.class).build(ChangeIndex.Factory.class));
    install(new FactoryModuleBuilder().implement(GroupIndex.class, ElasticGroupIndex.class).build(GroupIndex.Factory.class));
    install(new IndexModule(threads));
    if (singleVersions == null) {
        listener().to(ElasticVersionManager.class);
    } else {
        install(new SingleVersionModule(singleVersions));
    }
}
Also used : FactoryModuleBuilder(com.google.inject.assistedinject.FactoryModuleBuilder) SingleVersionModule(com.google.gerrit.server.index.SingleVersionModule) IndexModule(com.google.gerrit.server.index.IndexModule)

Example 3 with IndexModule

use of com.google.gerrit.server.index.IndexModule in project gerrit by GerritCodeReview.

the class LuceneIndexModule method configure.

@Override
protected void configure() {
    install(new FactoryModuleBuilder().implement(AccountIndex.class, LuceneAccountIndex.class).build(AccountIndex.Factory.class));
    install(new FactoryModuleBuilder().implement(ChangeIndex.class, LuceneChangeIndex.class).build(ChangeIndex.Factory.class));
    install(new FactoryModuleBuilder().implement(GroupIndex.class, LuceneGroupIndex.class).build(GroupIndex.Factory.class));
    install(new IndexModule(threads));
    if (singleVersions == null) {
        install(new MultiVersionModule());
    } else {
        install(new SingleVersionModule(singleVersions));
    }
}
Also used : FactoryModuleBuilder(com.google.inject.assistedinject.FactoryModuleBuilder) SingleVersionModule(com.google.gerrit.server.index.SingleVersionModule) IndexModule(com.google.gerrit.server.index.IndexModule)

Example 4 with IndexModule

use of com.google.gerrit.server.index.IndexModule in project gerrit by GerritCodeReview.

the class Daemon method createIndexModule.

private Module createIndexModule() {
    if (indexModule != null) {
        return indexModule;
    }
    if (indexType.isLucene()) {
        return LuceneIndexModule.latestVersion(replica, AutoFlush.ENABLED);
    }
    if (indexType.isFake()) {
        // compile the component in.
        try {
            Class<?> clazz = Class.forName("com.google.gerrit.index.testing.FakeIndexModule");
            Method m = clazz.getMethod("latestVersion", boolean.class);
            return (Module) m.invoke(null, replica);
        } catch (NoSuchMethodException | ClassNotFoundException | IllegalAccessException | InvocationTargetException e) {
            throw new IllegalStateException("can't create index", e);
        }
    }
    throw new IllegalStateException("unsupported index.type = " + indexType);
}
Also used : Method(java.lang.reflect.Method) SubscriptionGraphModule(com.google.gerrit.server.submit.SubscriptionGraph.SubscriptionGraphModule) H2CacheModule(com.google.gerrit.server.cache.h2.H2CacheModule) PluginApiModule(com.google.gerrit.server.api.PluginApiModule) CanonicalWebUrlModule(com.google.gerrit.server.config.CanonicalWebUrlModule) OAuthModule(com.google.gerrit.httpd.auth.oauth.OAuthModule) ProjectQoSFilterModule(com.google.gerrit.pgm.http.jetty.ProjectQoSFilter.ProjectQoSFilterModule) InternalAccountDirectoryModule(com.google.gerrit.server.account.InternalAccountDirectory.InternalAccountDirectoryModule) WorkQueueModule(com.google.gerrit.server.git.WorkQueue.WorkQueueModule) SshModule(com.google.gerrit.sshd.SshModule) DefaultPermissionBackendModule(com.google.gerrit.server.permissions.DefaultPermissionBackendModule) ChangeCleanupRunnerModule(com.google.gerrit.server.change.ChangeCleanupRunner.ChangeCleanupRunnerModule) SshAddressesModule(com.google.gerrit.server.ssh.SshAddressesModule) DefaultMemoryCacheModule(com.google.gerrit.server.cache.mem.DefaultMemoryCacheModule) HttpPluginModule(com.google.gerrit.httpd.plugins.HttpPluginModule) DefaultCommandModule(com.google.gerrit.sshd.commands.DefaultCommandModule) WebModule(com.google.gerrit.httpd.WebModule) GetUserFilterModule(com.google.gerrit.httpd.GetUserFilter.GetUserFilterModule) SmtpEmailSenderModule(com.google.gerrit.server.mail.send.SmtpEmailSender.SmtpEmailSenderModule) StreamEventsApiListenerModule(com.google.gerrit.server.events.StreamEventsApiListener.StreamEventsApiListenerModule) PluginModule(com.google.gerrit.server.plugins.PluginModule) IndexModule(com.google.gerrit.server.index.IndexModule) StaticModule(com.google.gerrit.httpd.raw.StaticModule) AccountDeactivatorModule(com.google.gerrit.server.account.AccountDeactivator.AccountDeactivatorModule) AbstractIndexModule(com.google.gerrit.server.index.AbstractIndexModule) JettyModule(com.google.gerrit.pgm.http.jetty.JettyModule) HttpdModule(com.google.gerrit.httpd.HttpdModule) LocalMergeSuperSetComputationModule(com.google.gerrit.server.submit.LocalMergeSuperSetComputation.LocalMergeSuperSetComputationModule) JdbcAccountPatchReviewStoreModule(com.google.gerrit.server.schema.JdbcAccountPatchReviewStore.JdbcAccountPatchReviewStoreModule) SearchingChangeCacheImplModule(com.google.gerrit.server.git.SearchingChangeCacheImpl.SearchingChangeCacheImplModule) PeriodicGroupIndexerModule(com.google.gerrit.server.group.PeriodicGroupIndexer.PeriodicGroupIndexerModule) GpgModule(com.google.gerrit.gpg.GpgModule) OpenIdModule(com.google.gerrit.httpd.auth.openid.OpenIdModule) AuthModule(com.google.gerrit.auth.AuthModule) SshHostKeyModule(com.google.gerrit.sshd.SshHostKeyModule) DefaultProjectNameLockManagerModule(com.google.gerrit.server.project.DefaultProjectNameLockManager.DefaultProjectNameLockManagerModule) OAuthRestModule(com.google.gerrit.httpd.auth.restapi.OAuthRestModule) SignedTokenEmailTokenVerifierModule(com.google.gerrit.server.mail.SignedTokenEmailTokenVerifier.SignedTokenEmailTokenVerifierModule) AbstractModule(com.google.inject.AbstractModule) AuthConfigModule(com.google.gerrit.server.config.AuthConfigModule) SequenceCommandsModule(com.google.gerrit.sshd.commands.SequenceCommandsModule) Module(com.google.inject.Module) DefaultUrlFormatterModule(com.google.gerrit.server.config.DefaultUrlFormatter.DefaultUrlFormatterModule) GerritGlobalModule(com.google.gerrit.server.config.GerritGlobalModule) LfsPluginAuthCommandModule(com.google.gerrit.sshd.plugin.LfsPluginAuthCommand.LfsPluginAuthCommandModule) LuceneIndexModule(com.google.gerrit.lucene.LuceneIndexModule) GerritInstanceIdModule(com.google.gerrit.server.config.GerritInstanceIdModule) MimeUtil2Module(com.google.gerrit.server.mime.MimeUtil2Module) SysExecutorModule(com.google.gerrit.server.config.SysExecutorModule) GarbageCollectionModule(com.google.gerrit.server.git.GarbageCollectionModule) GerritAuthModule(com.google.gerrit.httpd.GerritAuthModule) WebSshGlueModule(com.google.gerrit.httpd.WebSshGlueModule) MailReceiverModule(com.google.gerrit.server.mail.receive.MailReceiver.MailReceiverModule) ExternalIdCommandsModule(com.google.gerrit.sshd.commands.ExternalIdCommandsModule) RequireSslFilterModule(com.google.gerrit.httpd.RequireSslFilter.RequireSslFilterModule) OnlineUpgraderModule(com.google.gerrit.server.index.OnlineUpgrader.OnlineUpgraderModule) AuditModule(com.google.gerrit.server.audit.AuditModule) GitOverHttpModule(com.google.gerrit.httpd.GitOverHttpModule) RestApiModule(com.google.gerrit.server.restapi.RestApiModule) LogFileCompressorModule(com.google.gerrit.pgm.util.LogFileCompressor.LogFileCompressorModule) SuperprojectUpdateSubmissionListenerModule(com.google.gerrit.server.update.SuperprojectUpdateSubmissionListener.SuperprojectUpdateSubmissionListenerModule) IndexCommandsModule(com.google.gerrit.sshd.commands.IndexCommandsModule) DiffExecutorModule(com.google.gerrit.server.patch.DiffExecutorModule) NoSshModule(com.google.gerrit.server.ssh.NoSshModule) EventBrokerModule(com.google.gerrit.server.events.EventBroker.EventBrokerModule) StartupChecksModule(com.google.gerrit.server.StartupChecks.StartupChecksModule) GerritApiModule(com.google.gerrit.server.api.GerritApiModule) GerritInstanceNameModule(com.google.gerrit.server.config.GerritInstanceNameModule) InvocationTargetException(java.lang.reflect.InvocationTargetException)

Aggregations

IndexModule (com.google.gerrit.server.index.IndexModule)4 LuceneIndexModule (com.google.gerrit.lucene.LuceneIndexModule)2 SingleVersionModule (com.google.gerrit.server.index.SingleVersionModule)2 FactoryModuleBuilder (com.google.inject.assistedinject.FactoryModuleBuilder)2 AuthModule (com.google.gerrit.auth.AuthModule)1 FactoryModule (com.google.gerrit.extensions.config.FactoryModule)1 DynamicMap (com.google.gerrit.extensions.registration.DynamicMap)1 GpgModule (com.google.gerrit.gpg.GpgModule)1 GerritAuthModule (com.google.gerrit.httpd.GerritAuthModule)1 GetUserFilterModule (com.google.gerrit.httpd.GetUserFilter.GetUserFilterModule)1 GitOverHttpModule (com.google.gerrit.httpd.GitOverHttpModule)1 HttpdModule (com.google.gerrit.httpd.HttpdModule)1 RequireSslFilterModule (com.google.gerrit.httpd.RequireSslFilter.RequireSslFilterModule)1 WebModule (com.google.gerrit.httpd.WebModule)1 WebSshGlueModule (com.google.gerrit.httpd.WebSshGlueModule)1 OAuthModule (com.google.gerrit.httpd.auth.oauth.OAuthModule)1 OpenIdModule (com.google.gerrit.httpd.auth.openid.OpenIdModule)1 OAuthRestModule (com.google.gerrit.httpd.auth.restapi.OAuthRestModule)1 HttpPluginModule (com.google.gerrit.httpd.plugins.HttpPluginModule)1 StaticModule (com.google.gerrit.httpd.raw.StaticModule)1