Extract interfaces for Index and IndexCollection
Add another type argument for the key type, e.g. Change.Id. Keep subinterfaces ChangeIndex and ChangeIndexCollection to avoid having to pass around lots of type arguments; Schema<ChangeData> was bad enough, adding one more would be tortuous. Change-Id: Id54b985692ca41ffcaabe9793d8b9035cb1d4e82
This commit is contained in:
@@ -22,6 +22,7 @@ import com.google.common.util.concurrent.MoreExecutors;
|
||||
import com.google.gerrit.lifecycle.LifecycleModule;
|
||||
import com.google.gerrit.server.config.GerritServerConfig;
|
||||
import com.google.gerrit.server.git.WorkQueue;
|
||||
import com.google.gerrit.server.index.change.ChangeIndexCollection;
|
||||
import com.google.gerrit.server.index.change.ChangeIndexer;
|
||||
import com.google.gerrit.server.index.change.IndexRewriter;
|
||||
import com.google.inject.Injector;
|
||||
@@ -69,8 +70,7 @@ public class IndexModule extends LifecycleModule {
|
||||
@Override
|
||||
protected void configure() {
|
||||
bind(IndexRewriter.class);
|
||||
bind(IndexCollection.class);
|
||||
listener().to(IndexCollection.class);
|
||||
listener().to(ChangeIndexCollection.class);
|
||||
factory(ChangeIndexer.Factory.class);
|
||||
}
|
||||
|
||||
@@ -79,7 +79,7 @@ public class IndexModule extends LifecycleModule {
|
||||
ChangeIndexer getChangeIndexer(
|
||||
@IndexExecutor(INTERACTIVE) ListeningExecutorService executor,
|
||||
ChangeIndexer.Factory factory,
|
||||
IndexCollection indexes) {
|
||||
ChangeIndexCollection indexes) {
|
||||
// Bind default indexer to interactive executor; callers who need a
|
||||
// different executor can use the factory directly.
|
||||
return factory.create(executor, indexes);
|
||||
|
||||
Reference in New Issue
Block a user