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 Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static com.google.common.util.concurrent.CheckedFuture<?,IOException>
allAsList(List<? extends com.google.common.util.concurrent.ListenableFuture<?>> futures)
void
delete(Change.Id id)
Synchronously delete a change.com.google.common.util.concurrent.CheckedFuture<?,IOException>
deleteAsync(Change.Id id)
Start deleting a change.void
index(ReviewDb db, Change change)
Synchronously index a change.void
index(ReviewDb db, Project.NameKey project, Change.Id changeId)
Synchronously index a change.void
index(ChangeData cd)
Synchronously index a change, then check if the index is stale due to a race condition.com.google.common.util.concurrent.CheckedFuture<?,IOException>
indexAsync(Project.NameKey project, Change.Id id)
Start indexing a change.com.google.common.util.concurrent.CheckedFuture<?,IOException>
indexAsync(Project.NameKey project, Collection<Change.Id> ids)
Start indexing multiple changes in parallel.com.google.common.util.concurrent.CheckedFuture<Boolean,IOException>
reindexIfStale(Project.NameKey project, Change.Id id)
Asynchronously check if a change is stale, and reindex if it is.
-
-
-
Method Detail
-
allAsList
public static com.google.common.util.concurrent.CheckedFuture<?,IOException> allAsList(List<? extends com.google.common.util.concurrent.ListenableFuture<?>> futures)
-
indexAsync
public com.google.common.util.concurrent.CheckedFuture<?,IOException> indexAsync(Project.NameKey project, Change.Id id)
Start indexing a change.- Parameters:
id
- change to index.- Returns:
- future for the indexing task.
-
indexAsync
public com.google.common.util.concurrent.CheckedFuture<?,IOException> indexAsync(Project.NameKey project, Collection<Change.Id> ids)
Start indexing multiple changes in parallel.- Parameters:
ids
- changes to index.- Returns:
- future for completing indexing of all changes.
-
index
public void index(ChangeData cd) throws IOException
Synchronously index a change, then check if the index is stale due to a race condition.- Parameters:
cd
- change to index.- Throws:
IOException
-
index
public void index(ReviewDb db, Change change) throws IOException, com.google.gwtorm.server.OrmException
Synchronously index a change.- Parameters:
db
- review database.change
- change to index.- Throws:
IOException
com.google.gwtorm.server.OrmException
-
index
public void index(ReviewDb db, Project.NameKey project, Change.Id changeId) throws IOException, com.google.gwtorm.server.OrmException
Synchronously index a change.- Parameters:
db
- review database.project
- the project to which the change belongs.changeId
- ID of the change to index.- Throws:
IOException
com.google.gwtorm.server.OrmException
-
deleteAsync
public com.google.common.util.concurrent.CheckedFuture<?,IOException> deleteAsync(Change.Id id)
Start deleting a change.- Parameters:
id
- change to delete.- Returns:
- future for the deleting task.
-
delete
public void delete(Change.Id id) throws IOException
Synchronously delete a change.- Parameters:
id
- change ID to delete.- Throws:
IOException
-
reindexIfStale
public com.google.common.util.concurrent.CheckedFuture<Boolean,IOException> 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.
-
-