Package com.google.gerrit.server.index
Class VersionManager
java.lang.Object
com.google.gerrit.server.index.VersionManager
- All Implemented Interfaces:
- LifecycleListener,- EventListener
Trigger for online reindexing in case the index version in use is not the latest and when
 index.onlineUpgrade is true or upgrade_and_reindex. Reindexing is skipped if index.onlineUpgrade
 is no_reindex.
- 
Nested Class SummaryNested ClassesModifier and TypeClassDescriptionstatic enumstatic class
- 
Field SummaryFieldsModifier and TypeFieldDescriptionprotected final Map<String, IndexDefinition<?, ?, ?>> protected final booleanprotected final Map<String, OnlineReindexer<?, ?, ?>> protected final booleanprotected final Stringprotected final SitePaths
- 
Constructor SummaryConstructorsModifierConstructorDescriptionprotectedVersionManager(SitePaths sitePaths, PluginSetContext<OnlineUpgradeListener> listeners, Collection<IndexDefinition<?, ?, ?>> defs, boolean onlineUpgrade, boolean reuseExistingDocuments) 
- 
Method SummaryModifier and TypeMethodDescriptionbooleanactivateLatestIndex(String name) Activate the latest index if the current index is not already the latest.protected GerritIndexStatusstatic VersionManager.OnlineUpgradegetOnlineUpgrade(org.eclipse.jgit.lib.Config cfg) protected <K,V, I extends Index<K, V>> 
 voidinitIndex(IndexDefinition<K, V, I> def, GerritIndexStatus cfg) booleanisKnownIndex(String name) Tells if an index with this name is currently known or not.protected abstract <K,V, I extends Index<K, V>> 
 TreeMap<Integer, VersionManager.Version<V>> scanVersions(IndexDefinition<K, V, I> def, GerritIndexStatus cfg) static booleanshouldPerformOnlineUpgrade(org.eclipse.jgit.lib.Config cfg) voidstart()Invoked when the server is starting.booleanstartReindexer(String name, boolean force) Start the online reindexer if the current index is not already the latest.voidstop()Invoked when the server is stopping.
- 
Field Details- 
onlineUpgradeprotected final boolean onlineUpgrade
- 
reuseExistingDocumentsprotected final boolean reuseExistingDocuments
- 
runReindexMsg
- 
sitePaths
- 
defs
- 
reindexers
 
- 
- 
Constructor Details- 
VersionManagerprotected VersionManager(SitePaths sitePaths, PluginSetContext<OnlineUpgradeListener> listeners, Collection<IndexDefinition<?, ?, ?>> defs, boolean onlineUpgrade, boolean reuseExistingDocuments) 
 
- 
- 
Method Details- 
getOnlineUpgrade
- 
shouldPerformOnlineUpgradepublic static boolean shouldPerformOnlineUpgrade(org.eclipse.jgit.lib.Config cfg) 
- 
startpublic void start()Description copied from interface:LifecycleListenerInvoked when the server is starting.- Specified by:
- startin interface- LifecycleListener
 
- 
stoppublic void stop()Description copied from interface:LifecycleListenerInvoked when the server is stopping.- Specified by:
- stopin interface- LifecycleListener
 
- 
startReindexerStart the online reindexer if the current index is not already the latest.- Parameters:
- name- index name
- force- start re-index
- Returns:
- true if started, otherwise false.
- Throws:
- ReindexerAlreadyRunningException
 
- 
activateLatestIndexActivate the latest index if the current index is not already the latest.- Parameters:
- name- index name
- Returns:
- true if index was activated, otherwise false.
- Throws:
- ReindexerAlreadyRunningException
 
- 
isKnownIndexTells if an index with this name is currently known or not.- Parameters:
- name- index name
- Returns:
- true if index is known and can be used, otherwise false.
 
- 
initIndexprotected <K,V, void initIndexI extends Index<K, V>> (IndexDefinition<K, V, I> def, GerritIndexStatus cfg) 
- 
createIndexStatus
- 
scanVersionsprotected abstract <K,V, TreeMap<Integer,I extends Index<K, V>> VersionManager.Version<V>> scanVersions(IndexDefinition<K, V, I> def, GerritIndexStatus cfg) 
 
-