Factor out batch indexing logic into a ChangeBatchIndexer

Change-Id: Ief166fadc61f76a5f4ffdb879322e9883040bdd6
This commit is contained in:
Dave Borowitz
2013-06-27 14:41:21 -06:00
parent d103b2b61c
commit 2361cefe17
11 changed files with 436 additions and 297 deletions

View File

@@ -245,11 +245,10 @@ public class LuceneChangeIndex implements ChangeIndex {
}
@Override
public void markReady() throws IOException {
public void markReady(boolean ready) throws IOException {
try {
FileBasedConfig cfg = LuceneVersionManager.loadGerritIndexConfig(sitePaths);
cfg.setBoolean("index", Integer.toString(schema.getVersion()), "ready",
true);
LuceneVersionManager.setReady(cfg, schema.getVersion(), ready);
cfg.save();
} catch (ConfigInvalidException e) {
throw new IOException(e);

View File

@@ -78,12 +78,12 @@ class LuceneVersionManager implements LifecycleListener {
return cfg;
}
private static boolean getReady(Config cfg, int version) {
return cfg.getBoolean("index", Integer.toString(version), "ready", false);
static void setReady(Config cfg, int version, boolean ready) {
cfg.setBoolean("index", Integer.toString(version), "ready", ready);
}
private static void setReady(Config cfg, int version, boolean ready) {
cfg.setBoolean("index", Integer.toString(version), "ready", ready);
private static boolean getReady(Config cfg, int version) {
return cfg.getBoolean("index", Integer.toString(version), "ready", false);
}
private final SitePaths sitePaths;