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) DefaultDocumentStore(Client client, DocumentSerializer serializer, HasLocalHandlers handlerRegistry, String modelNamePrefix) -
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 andGuarantee.DEFAULT.protected DocumentStorecreateForNamespace(String namespace) deleteCollection(Object collection) Deletes an entire collection of documents usingGuarantee.DEFAULT.deleteDocument(Object id, Object collection, io.fluxzero.common.Guarantee guarantee) Deletes a document from the collection, using givenGuarantee.determineCollection(@NonNull Object collection) Resolves a given collection specifier to a collection name, usingClientUtils.determineSearchCollection(Object).<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 guarantee, metadata, and if-not-exists condition.index(Collection<?> objects, Object collection, String idPath, String beginPath, String endPath, io.fluxzero.common.Guarantee guarantee, boolean ifNotExists) Indexes a collection of objects using the supplied ID/time accessors and delivery guarantee.<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 the supplied ID/time accessors and delivery guarantee.moveDocument(Object id, Object collection, Object targetCollection, io.fluxzero.common.Guarantee guarantee) Moves a document to the target collection, using the givenGuarantee.<T> Search<T> search(io.fluxzero.common.api.search.SearchQuery.Builder searchBuilder) Prepares a search query based on the specifiedSearchQuery.Builder.<T> Search<T> Prepares a typed search for the collection represented by the given document class.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) Converts a bulk update into its protocol action, resolving the collection and identifier and serializing index payloads unless already serialized.withDefaultGuarantee(io.fluxzero.common.Guarantee guarantee) Configures the concrete application delivery default before first use; namespace copies inherit it.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, 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, 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) -
DefaultDocumentStore
public DefaultDocumentStore(Client client, DocumentSerializer serializer, HasLocalHandlers handlerRegistry, String modelNamePrefix)
-
-
Method Details
-
withDefaultGuarantee
Configures the concrete application delivery default before first use; namespace copies inherit it. -
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 guarantee, metadata, and if-not-exists condition.- 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 the supplied ID/time accessors and delivery guarantee.- 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 the supplied ID/time accessors and delivery guarantee.- 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) Converts a bulk update into its protocol action, resolving the collection and identifier and serializing index payloads unless already serialized. -
search
Description copied from interface:DocumentStorePrepares a search query based on the specifiedSearchQuery.Builder.- Specified by:
searchin interfaceDocumentStore
-
search
Description copied from interface:DocumentStorePrepares a typed search for the collection represented by the given document class.For independent Models, unrestricted search requires a public direct document. Adding a relationship selector can instead use a direct reference-only or internal Graph-component document. Neither route replays Models or inherits a handler's historical boundary. See
Searchfor capabilities and consistency limits.- 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:DocumentStoreMoves a document to the target collection, using the givenGuarantee.- Specified by:
moveDocumentin interfaceDocumentStore
-
deleteCollection
Description copied from interface:DocumentStoreDeletes an entire collection of documents usingGuarantee.DEFAULT.- 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 andGuarantee.DEFAULT.- Specified by:
createAuditTrailin interfaceDocumentStore
-
createForNamespace
- Specified by:
createForNamespacein classAbstractNamespaced<DocumentStore>
-
determineCollection
Description copied from interface:DocumentStoreResolves a given collection specifier to a collection name, usingClientUtils.determineSearchCollection(Object).- Specified by:
determineCollectionin interfaceDocumentStore
-