Interface IndexIndexingPlan
public interface IndexIndexingPlan
A set of works to be executed on a single index.
Works are accumulated when methods such as add(DocumentReferenceProvider, DocumentContributor)
or addOrUpdate(DocumentReferenceProvider, DocumentContributor)
are called,
and executed only when execute(OperationSubmitter)
is called.
Relative ordering of works within a plan will be preserved.
Implementations may not be thread-safe.
-
Method Summary
Modifier and TypeMethodDescriptionvoid
add
(DocumentReferenceProvider documentReferenceProvider, DocumentContributor documentContributor) Add a document to the index, assuming that the document is absent from the index.void
addOrUpdate
(DocumentReferenceProvider documentReferenceProvider, DocumentContributor documentContributor) Update a document in the index, or add it if it's absent from the index.void
delete
(DocumentReferenceProvider documentReferenceProvider) Delete a document from the index.void
discard()
Discard all works that are present in this plan.default CompletableFuture<?>
execute
(OperationSubmitter operationSubmitter) Start executing all the works in this plan, and clear the plan so that it can be re-used.executeAndReport
(OperationSubmitter operationSubmitter) Start executing all the works in this plan, and clear the plan so that it can be re-used.
-
Method Details
-
add
void add(DocumentReferenceProvider documentReferenceProvider, DocumentContributor documentContributor) Add a document to the index, assuming that the document is absent from the index.- Parameters:
documentReferenceProvider
- A source of information about the identity of the document to add.documentContributor
- A contributor to the document, adding fields to the indexed document.
-
addOrUpdate
void addOrUpdate(DocumentReferenceProvider documentReferenceProvider, DocumentContributor documentContributor) Update a document in the index, or add it if it's absent from the index.- Parameters:
documentReferenceProvider
- A source of information about the identity of the document to update.documentContributor
- A contributor to the document, adding fields to the indexed document.
-
delete
Delete a document from the index.- Parameters:
documentReferenceProvider
- A source of information about the identity of the document to delete.
-
execute
Start executing all the works in this plan, and clear the plan so that it can be re-used.- Returns:
- A
CompletableFuture
that will be completed when all the works are complete. The future will be completed with an exception if a work failed.
-
executeAndReport
CompletableFuture<MultiEntityOperationExecutionReport> executeAndReport(OperationSubmitter operationSubmitter) Start executing all the works in this plan, and clear the plan so that it can be re-used.- Parameters:
operationSubmitter
- How to handle request to submit operation when the queue is full- Returns:
- A
CompletableFuture
that will hold an execution report when all the works are complete. The future will be completed normally even if a work failed, but the report will contain an exception.
-
discard
void discard()Discard all works that are present in this plan.
-