Class ChangeIndexer
java.lang.Object
com.google.gerrit.server.index.change.ChangeIndexer
Helper for (re)indexing a change document.
Indexing is run in the background, as it may require substantial work to compute some of the fields and/or update the index.
-
Nested Class Summary
Nested Classes -
Method Summary
Modifier and TypeMethodDescriptioncom.google.common.util.concurrent.ListenableFuture<Boolean>
asyncReindexIfStale
(Project.NameKey project, Change.Id id) Asynchronously check if a change is stale, and reindex if it is.void
Synchronously delete a change.com.google.common.util.concurrent.ListenableFuture<ChangeData>
deleteAsync
(Project.NameKey project, Change.Id id) Start deleting a change.void
Deprecated.void
index
(Project.NameKey project, Change.Id changeId) Synchronously index a local or imported change.void
index
(ChangeNotes notes) Synchronously index a local or imported change with associated notes.void
index
(ChangeData cd) Synchronously index a local or imported change, then check if the index is stale due to a race condition.com.google.common.util.concurrent.ListenableFuture<ChangeData>
indexAsync
(Project.NameKey project, Change.Id changeId) Start indexing a change.boolean
reindexIfStale
(Project.NameKey project, Change.Id id) Synchronously check if a change is stale, and reindex if it is.boolean
Synchronously check if a change is stale, and reindex if it is.
-
Method Details
-
indexAsync
public com.google.common.util.concurrent.ListenableFuture<ChangeData> indexAsync(Project.NameKey project, Change.Id changeId) Start indexing a change.- Parameters:
changeId
- change to index.- Returns:
- future for the indexing task.
-
index
Synchronously index a local or imported change, then check if the index is stale due to a race condition.- Parameters:
cd
- change to index.
-
index
Deprecated.callers should useindex(com.google.gerrit.entities.Project.NameKey, com.google.gerrit.entities.Change.Id)
which reloads the full change details, including the associated serverId.Synchronously index local a change.- Parameters:
change
- change to index.
-
index
Synchronously index a local or imported change with associated notes.- Parameters:
notes
- change notes associated with the change to index.
-
index
Synchronously index a local or imported change.Load the change full details from NoteDb and update the corresponding entry in the index.
- Parameters:
project
- the project to which the change belongs.changeId
- ID of the change to index.
-
deleteAsync
public com.google.common.util.concurrent.ListenableFuture<ChangeData> deleteAsync(Project.NameKey project, Change.Id id) Start deleting a change.- Parameters:
id
- change to delete.- Returns:
- future for the deleting task, the result of the future is always
null
-
delete
Synchronously delete a change.- Parameters:
id
- change ID to delete.
-
asyncReindexIfStale
public com.google.common.util.concurrent.ListenableFuture<Boolean> asyncReindexIfStale(Project.NameKey project, Change.Id id) Asynchronously check if a change is stale, and reindex if it is.Always run on the batch executor, even if this indexer instance is configured to use a different executor.
- Parameters:
project
- the project to which the change belongs.id
- ID of the change to index.- Returns:
- future for reindexing the change; returns true if the change was stale.
-
reindexIfStale
Synchronously check if a change is stale, and reindex if it is.- Parameters:
cd
- the change data to be checked for staleness.- Returns:
- true if the change was stale, false if it was up-to-date
-
reindexIfStale
Synchronously check if a change is stale, and reindex if it is.- Parameters:
project
- the project to which the change belongs.id
- ID of the change to index.- Returns:
- true if the change was stale, false if it was up-to-date
-
index(com.google.gerrit.entities.Project.NameKey, com.google.gerrit.entities.Change.Id)
which reloads the full change details, including the associated serverId.