Class DefaultDocumentStore
java.lang.Object
io.fluxzero.sdk.common.AbstractNamespaced<DocumentStore>
io.fluxzero.sdk.persisting.search.DefaultDocumentStore
- All Implemented Interfaces:
Namespaced<DocumentStore>, DocumentStore, HasLocalHandlers
public class DefaultDocumentStore
extends AbstractNamespaced<DocumentStore>
implements DocumentStore, HasLocalHandlers
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprotected classprotected class -
Constructor Summary
ConstructorsConstructorDescriptionDefaultDocumentStore(Client client, DocumentSerializer serializer, HasLocalHandlers handlerRegistry) -
Method Summary
Modifier and TypeMethodDescriptionbulkUpdate(Collection<? extends io.fluxzero.common.api.search.BulkUpdate> updates, io.fluxzero.common.Guarantee guarantee) Applies a batch of document updates, using givenGuarantee.voidconfigureModelGraphSupport(ModelRepository modelRepository, Supplier<List<Class<?>>> modelTypesSupplier) Configures typed materialized-graph reconstruction after the model subsystem has initialized.createAuditTrail(Object collection, Duration retentionTime) Configures Fluxzero to use a search collection as a searchable audit trail with the given retention time.protected DocumentStorecreateForNamespace(String namespace) deleteCollection(Object collection) Deletes an entire collection of documents.deleteDocument(Object id, Object collection, io.fluxzero.common.Guarantee guarantee) Deletes a document from the collection, using givenGuarantee.<T> Optional<T> fetchDocument(Object id, Object collection) Fetches a document by ID and deserializes it into the stored type.<T> Optional<T> fetchDocument(Object id, Object collection, Class<T> type) Fetches a document by ID and deserializes it into the provided type.<T> Collection<T> fetchDocuments(Collection<?> ids, Object collection) Fetches a collection of documents by their IDs and deserializes them into the stored type.<T> Collection<T> fetchDocuments(Collection<?> ids, Object collection, Class<T> type) Fetches a collection of documents by their IDs and deserializes them into the provided type.List<io.fluxzero.common.api.search.SearchCollection> Retrieves existing regular search collections and audit trails.booleanhasDocument(Object id, Object collection) Checks if a document exists in the specified collection.index(@NonNull Object object, @NonNull Object id, @NonNull Object collection, Instant begin, Instant end, io.fluxzero.common.api.Metadata metadata, io.fluxzero.common.Guarantee guarantee, boolean ifNotExists) Indexes a document with the specified guarantees, metadata, and if-not-exists condition, usingGuarantee.STORED.index(Collection<?> objects, Object collection, String idPath, String beginPath, String endPath, io.fluxzero.common.Guarantee guarantee, boolean ifNotExists) Indexes a collection of objects using functional accessors for ID and time intervals, usingGuarantee.STORED.<T> CompletableFuture<Void> index(Collection<? extends T> objects, Object collection, Function<? super T, ?> idFunction, Function<? super T, Instant> beginFunction, Function<? super T, Instant> endFunction, io.fluxzero.common.Guarantee guarantee, boolean ifNotExists) Indexes a collection of objects using functional accessors for ID and time intervals, usingGuarantee.STORED.moveDocument(Object id, Object collection, Object targetCollection, io.fluxzero.common.Guarantee guarantee) Deletes a document from the collection, using givenGuarantee.<T> Search<T> search(io.fluxzero.common.api.search.SearchQuery.Builder searchBuilder) Prepares a search query based on the specifiedSearchQuery.Builder.searchGraph(Class<T> rootModelType, boolean forceAdHoc) Searches complete graph views for an independent model root.io.fluxzero.common.api.search.DocumentUpdateserializeAction(io.fluxzero.common.api.search.BulkUpdate update) Methods inherited from class AbstractNamespaced
close, forNamespaceMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface DocumentStore
bulkUpdate, bulkUpdate, deleteDocument, determineCollection, fetchDocument, getSerializer, hasDocument, index, index, index, index, index, index, index, index, index, index, index, index, indexIfNotExists, indexIfNotExists, indexIfNotExists, indexIfNotExists, indexIfNotExists, indexIfNotExists, indexIfNotExists, indexIfNotExists, indexIfNotExists, indexIfNotExists, moveDocument, prepareIndex, search, search, searchGraphMethods inherited from interface HasLocalHandlers
hasLocalHandlers, registerHandler, registerHandler, setSelfHandlerFilterMethods inherited from interface Namespaced
forApplicationNamespace, forDefaultNamespace, forNamespace
-
Constructor Details
-
DefaultDocumentStore
public DefaultDocumentStore(Client client, DocumentSerializer serializer, HasLocalHandlers handlerRegistry)
-
-
Method Details
-
configureModelGraphSupport
public void configureModelGraphSupport(ModelRepository modelRepository, Supplier<List<Class<?>>> modelTypesSupplier) Configures typed materialized-graph reconstruction after the model subsystem has initialized. -
getSearchCollections
Description copied from interface:DocumentStoreRetrieves existing regular search collections and audit trails.- Specified by:
getSearchCollectionsin interfaceDocumentStore- Returns:
- the available collections with their storage types, in deterministic order
-
index
public CompletableFuture<Void> index(@NonNull @NonNull Object object, @NonNull @NonNull Object id, @NonNull @NonNull Object collection, Instant begin, Instant end, io.fluxzero.common.api.Metadata metadata, io.fluxzero.common.Guarantee guarantee, boolean ifNotExists) Description copied from interface:DocumentStoreIndexes a document with the specified guarantees, metadata, and if-not-exists condition, usingGuarantee.STORED.- Specified by:
indexin interfaceDocumentStore
-
index
public CompletableFuture<Void> index(Collection<?> objects, Object collection, String idPath, String beginPath, String endPath, io.fluxzero.common.Guarantee guarantee, boolean ifNotExists) Description copied from interface:DocumentStoreIndexes a collection of objects using functional accessors for ID and time intervals, usingGuarantee.STORED.- Specified by:
indexin interfaceDocumentStore
-
index
public <T> CompletableFuture<Void> index(Collection<? extends T> objects, Object collection, Function<? super T, ?> idFunction, Function<? super T, Instant> beginFunction, Function<? super T, Instant> endFunction, io.fluxzero.common.Guarantee guarantee, boolean ifNotExists) Description copied from interface:DocumentStoreIndexes a collection of objects using functional accessors for ID and time intervals, usingGuarantee.STORED.- Specified by:
indexin interfaceDocumentStore
-
bulkUpdate
public CompletableFuture<Void> bulkUpdate(Collection<? extends io.fluxzero.common.api.search.BulkUpdate> updates, io.fluxzero.common.Guarantee guarantee) Description copied from interface:DocumentStoreApplies a batch of document updates, using givenGuarantee.- Specified by:
bulkUpdatein interfaceDocumentStore
-
serializeAction
public io.fluxzero.common.api.search.DocumentUpdate serializeAction(io.fluxzero.common.api.search.BulkUpdate update) -
search
Description copied from interface:DocumentStorePrepares a search query based on the specifiedSearchQuery.Builder.- Specified by:
searchin interfaceDocumentStore
-
searchGraph
Description copied from interface:DocumentStoreSearches complete graph views for an independent model root.- Specified by:
searchGraphin interfaceDocumentStore- Parameters:
rootModelType- root model classforceAdHoc- whether to bypass a configured materialized view and compose the current graph live
-
hasDocument
Description copied from interface:DocumentStoreChecks if a document exists in the specified collection.- Specified by:
hasDocumentin interfaceDocumentStore
-
fetchDocument
Description copied from interface:DocumentStoreFetches a document by ID and deserializes it into the stored type.- Specified by:
fetchDocumentin interfaceDocumentStore
-
fetchDocument
Description copied from interface:DocumentStoreFetches a document by ID and deserializes it into the provided type.- Specified by:
fetchDocumentin interfaceDocumentStore
-
fetchDocuments
Description copied from interface:DocumentStoreFetches a collection of documents by their IDs and deserializes them into the stored type.- Specified by:
fetchDocumentsin interfaceDocumentStore
-
fetchDocuments
Description copied from interface:DocumentStoreFetches a collection of documents by their IDs and deserializes them into the provided type.- Specified by:
fetchDocumentsin interfaceDocumentStore
-
deleteDocument
public CompletableFuture<Void> deleteDocument(Object id, Object collection, io.fluxzero.common.Guarantee guarantee) Description copied from interface:DocumentStoreDeletes a document from the collection, using givenGuarantee.- Specified by:
deleteDocumentin interfaceDocumentStore
-
moveDocument
public CompletableFuture<Void> moveDocument(Object id, Object collection, Object targetCollection, io.fluxzero.common.Guarantee guarantee) Description copied from interface:DocumentStoreDeletes a document from the collection, using givenGuarantee.- Specified by:
moveDocumentin interfaceDocumentStore
-
deleteCollection
Description copied from interface:DocumentStoreDeletes an entire collection of documents.- Specified by:
deleteCollectionin interfaceDocumentStore
-
createAuditTrail
Description copied from interface:DocumentStoreConfigures Fluxzero to use a search collection as a searchable audit trail with the given retention time.- Specified by:
createAuditTrailin interfaceDocumentStore
-
createForNamespace
- Specified by:
createForNamespacein classAbstractNamespaced<DocumentStore>
-