ChangeQueryBuilder: Remove GerritServerConfig field injection

Replace with IndexConfig usage. Add index type support to IndexConfig
for that purpose. Add the necessary isElasticsearch method prototype to
IndexType, this one based on the String value of the checked index type.
Fix the IndexType toString method to consistently return the type String
value -instead of the object identity.

Apply the once postponed yet related review comment from Iaa452e5b (by
dborowitz) that way.

Move IndexType out of IndexModule to the non-server index package, so
that IndexConfig can use it. Non-server index package classes (such as
IndexConfig) cannot depend on server.index package classes. This is
because the latter package already depends on the former. This would
(then) otherwise introduce a circular dependency in the build graph.

Add the resulting Config-based constructor to IndexType. Remove the no
longer used getIndexType method from IndexModule in turn.

Bug: Issue 10889
Change-Id: I372708cb923c038f6310defe1abc3390e726edfd
This commit is contained in:
Marco Miller
2019-09-26 15:13:57 -04:00
parent d57551ce85
commit ce07093cc2
11 changed files with 92 additions and 53 deletions

View File

@@ -26,6 +26,7 @@ import com.google.gerrit.extensions.client.AuthType;
import com.google.gerrit.extensions.config.FactoryModule;
import com.google.gerrit.extensions.systemstatus.ServerInformation;
import com.google.gerrit.gpg.GpgModule;
import com.google.gerrit.index.IndexType;
import com.google.gerrit.index.SchemaDefinitions;
import com.google.gerrit.index.project.ProjectSchemaDefinitions;
import com.google.gerrit.metrics.DisabledMetricMaker;
@@ -65,7 +66,6 @@ import com.google.gerrit.server.git.GitRepositoryManager;
import com.google.gerrit.server.git.PerThreadRequestScope;
import com.google.gerrit.server.git.SearchingChangeCacheImpl;
import com.google.gerrit.server.git.WorkQueue;
import com.google.gerrit.server.index.IndexModule.IndexType;
import com.google.gerrit.server.index.account.AccountSchemaDefinitions;
import com.google.gerrit.server.index.account.AllAccountsIndexer;
import com.google.gerrit.server.index.change.AllChangesIndexer;