Merge "Index admin user account that is created during init"

This commit is contained in:
David Pursehouse
2017-01-12 23:16:43 +00:00
committed by Gerrit Code Review
8 changed files with 109 additions and 45 deletions

View File

@@ -42,6 +42,7 @@ import com.google.gson.JsonElement;
import com.google.gson.JsonObject;
import com.google.gwtorm.server.OrmException;
import com.google.gwtorm.server.ResultSet;
import com.google.inject.Provider;
import com.google.inject.assistedinject.Assisted;
import com.google.inject.assistedinject.AssistedInject;
@@ -64,8 +65,8 @@ import io.searchbox.core.Search;
import io.searchbox.core.search.sort.Sort;
import io.searchbox.core.search.sort.Sort.Sorting;
class ElasticAccountIndex extends AbstractElasticIndex<Account.Id, AccountState>
implements AccountIndex {
public class ElasticAccountIndex extends
AbstractElasticIndex<Account.Id, AccountState> implements AccountIndex {
static class AccountMapping {
MappingProperties accounts;
@@ -82,7 +83,7 @@ class ElasticAccountIndex extends AbstractElasticIndex<Account.Id, AccountState>
private final Gson gson;
private final AccountMapping mapping;
private final AccountCache accountCache;
private final Provider<AccountCache> accountCache;
private final ElasticQueryBuilder queryBuilder;
@AssistedInject
@@ -90,7 +91,7 @@ class ElasticAccountIndex extends AbstractElasticIndex<Account.Id, AccountState>
@GerritServerConfig Config cfg,
FillArgs fillArgs,
SitePaths sitePaths,
AccountCache accountCache,
Provider<AccountCache> accountCache,
@Assisted Schema<AccountState> schema) {
super(cfg, fillArgs, sitePaths, schema, ACCOUNTS_PREFIX);
this.accountCache = accountCache;
@@ -224,7 +225,7 @@ class ElasticAccountIndex extends AbstractElasticIndex<Account.Id, AccountState>
// document (of which there shouldn't be any). The most expensive part to
// compute anyway is the effective group IDs, and we don't have a good way
// to reindex when those change.
return accountCache.get(id);
return accountCache.get().get(id);
}
}
}