Interface CommitIndexer
CommitIndexer
implementations must be thread-safe, because the same instance will be used for
multiple indexing operations in parallel. Any state that needs to be stored during an indexing run should be
stored in the provided IndexingContext
.
Note: The same IndexingContext
is shared between all CommitIndexer
s that are enabled for
a given repository. Implementations should be careful of what they store in it and what names they use for
properties they add to manage memory consumption and avoid collisions with other indexers.
-
Method Summary
Modifier and TypeMethodDescriptiongetId()
boolean
isEnabledForRepository
(com.atlassian.bitbucket.repository.Repository repository) void
onAfterIndexing
(IndexingContext context) Called after the last commit has been processed to allow the indexer to perform any cleanup it needs.void
onBeforeIndexing
(IndexingContext context) Called before the first commit is processed to allow the indexer to perform any setup it needs.void
onCommitAdded
(com.atlassian.bitbucket.commit.Commit commit, IndexingContext context) Called for each new commit that is added to the repository.void
onCommitRemoved
(com.atlassian.bitbucket.commit.Commit commit, IndexingContext context) Called for each existing commit that is removed from the repository.
-
Method Details
-
getId
- Returns:
- the ID for the indexer, used by the system to keep track of which commits this indexer has seen
-
isEnabledForRepository
boolean isEnabledForRepository(@Nonnull com.atlassian.bitbucket.repository.Repository repository) - Parameters:
repository
- the repository- Returns:
true
if the indexer should index commits for the specifiedrepository
; otherwise,false
-
onAfterIndexing
Called after the last commit has been processed to allow the indexer to perform any cleanup it needs.- Parameters:
context
- the indexing context
-
onBeforeIndexing
Called before the first commit is processed to allow the indexer to perform any setup it needs.- Parameters:
context
- the indexing context
-
onCommitAdded
void onCommitAdded(@Nonnull com.atlassian.bitbucket.commit.Commit commit, @Nonnull IndexingContext context) Called for each new commit that is added to the repository.Important: This method will only be called once for a commit during an indexing run, but may be called multiple times for the same commit across different indexing runs. When new
CommitIndexer
s are enabled, all of the commits that have been added since the last time anyCommitIndexer
ran will be passed to all indexers.- Parameters:
commit
- the added commitcontext
- the indexing context
-
onCommitRemoved
void onCommitRemoved(@Nonnull com.atlassian.bitbucket.commit.Commit commit, @Nonnull IndexingContext context) Called for each existing commit that is removed from the repository.Important: This method will only be called once for a commit during an indexing run, but may be called multiple times for the same commit across different indexing runs. When new
CommitIndexer
s are enabled, all of the commits that have been removed since the last time anyCommitIndexer
ran will be passed to all indexers.- Parameters:
commit
- the removed commitcontext
- the indexing context
-