Class ChangeIndexer
- java.lang.Object
-
- com.google.gerrit.server.index.change.ChangeIndexer
-
public class ChangeIndexer extends Object
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 Modifier and Type Class Description static interface
ChangeIndexer.Factory
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description void
delete(Change.Id id)
Synchronously delete a change.com.google.common.util.concurrent.ListenableFuture<ChangeData>
deleteAsync(Project.NameKey project, Change.Id id)
Start deleting a change.void
index(Change change)
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.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.com.google.common.util.concurrent.ListenableFuture<Boolean>
reindexIfStale(Project.NameKey project, Change.Id id)
Asynchronously check if a change is stale, and reindex if it is.
-
-
-
Method Detail
-
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
public void index(ChangeData cd)
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 public void index(Change change)
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
public void index(ChangeNotes notes)
Synchronously index a local or imported change with associated notes.- Parameters:
notes
- change notes associated with the change to index.
-
index
public void index(Project.NameKey project, Change.Id changeId)
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
public void delete(Change.Id id)
Synchronously delete a change.- Parameters:
id
- change ID to delete.
-
reindexIfStale
public com.google.common.util.concurrent.ListenableFuture<Boolean> reindexIfStale(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.
-
-