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
  • Constructor Details

  • Method Details

    • withDefaultGuarantee

      public DefaultDocumentStore withDefaultGuarantee(io.fluxzero.common.Guarantee guarantee)
      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

      public List<io.fluxzero.common.api.search.SearchCollection> getSearchCollections()
      Description copied from interface: DocumentStore
      Retrieves existing regular search collections and audit trails.
      Specified by:
      getSearchCollections in interface DocumentStore
      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: DocumentStore
      Indexes a document with the specified guarantee, metadata, and if-not-exists condition.
      Specified by:
      index in interface DocumentStore
    • 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: DocumentStore
      Indexes a collection of objects using the supplied ID/time accessors and delivery guarantee.
      Specified by:
      index in interface DocumentStore
    • 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: DocumentStore
      Indexes a collection of objects using the supplied ID/time accessors and delivery guarantee.
      Specified by:
      index in interface DocumentStore
    • bulkUpdate

      public CompletableFuture<Void> bulkUpdate(Collection<? extends io.fluxzero.common.api.search.BulkUpdate> updates, io.fluxzero.common.Guarantee guarantee)
      Description copied from interface: DocumentStore
      Applies a batch of document updates, using given Guarantee.
      Specified by:
      bulkUpdate in interface DocumentStore
    • serializeAction

      public io.fluxzero.common.api.search.DocumentUpdate serializeAction(io.fluxzero.common.api.search.BulkUpdate update)
    • search

      public <T> Search<T> search(io.fluxzero.common.api.search.SearchQuery.Builder searchBuilder)
      Description copied from interface: DocumentStore
      Prepares a search query based on the specified SearchQuery.Builder.
      Specified by:
      search in interface DocumentStore
    • search

      public <T> Search<T> search(@NonNull @NonNull Class<T> collection)
      Description copied from interface: DocumentStore
      Prepares 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 Search for capabilities and consistency limits.

      Specified by:
      search in interface DocumentStore
    • searchGraph

      public <T> Search<Graph<T>> searchGraph(Class<T> rootModelType, boolean forceAdHoc)
      Description copied from interface: DocumentStore
      Searches complete graph views for an independent model root.
      Specified by:
      searchGraph in interface DocumentStore
      Parameters:
      rootModelType - root model class
      forceAdHoc - whether to bypass a configured materialized view and compose the current graph live
    • hasDocument

      public boolean hasDocument(Object id, Object collection)
      Description copied from interface: DocumentStore
      Checks if a document exists in the specified collection.
      Specified by:
      hasDocument in interface DocumentStore
    • fetchDocument

      public <T> Optional<T> fetchDocument(Object id, Object collection)
      Description copied from interface: DocumentStore
      Fetches a document by ID and deserializes it into the stored type.
      Specified by:
      fetchDocument in interface DocumentStore
    • fetchDocument

      public <T> Optional<T> fetchDocument(Object id, Object collection, Class<T> type)
      Description copied from interface: DocumentStore
      Fetches a document by ID and deserializes it into the provided type.
      Specified by:
      fetchDocument in interface DocumentStore
    • fetchDocuments

      public <T> Collection<T> fetchDocuments(Collection<?> ids, Object collection)
      Description copied from interface: DocumentStore
      Fetches a collection of documents by their IDs and deserializes them into the stored type.
      Specified by:
      fetchDocuments in interface DocumentStore
    • fetchDocuments

      public <T> Collection<T> fetchDocuments(Collection<?> ids, Object collection, Class<T> type)
      Description copied from interface: DocumentStore
      Fetches a collection of documents by their IDs and deserializes them into the provided type.
      Specified by:
      fetchDocuments in interface DocumentStore
    • deleteDocument

      public CompletableFuture<Void> deleteDocument(Object id, Object collection, io.fluxzero.common.Guarantee guarantee)
      Description copied from interface: DocumentStore
      Deletes a document from the collection, using given Guarantee.
      Specified by:
      deleteDocument in interface DocumentStore
    • moveDocument

      public CompletableFuture<Void> moveDocument(Object id, Object collection, Object targetCollection, io.fluxzero.common.Guarantee guarantee)
      Description copied from interface: DocumentStore
      Moves a document to the target collection, using the given Guarantee.
      Specified by:
      moveDocument in interface DocumentStore
    • deleteCollection

      public CompletableFuture<Void> deleteCollection(Object collection)
      Description copied from interface: DocumentStore
      Deletes an entire collection of documents using Guarantee.DEFAULT.
      Specified by:
      deleteCollection in interface DocumentStore
    • createAuditTrail

      public CompletableFuture<Void> createAuditTrail(Object collection, Duration retentionTime)
      Description copied from interface: DocumentStore
      Configures Fluxzero to use a search collection as a searchable audit trail with the given retention time and Guarantee.DEFAULT.
      Specified by:
      createAuditTrail in interface DocumentStore
    • createForNamespace

      protected DocumentStore createForNamespace(String namespace)
      Specified by:
      createForNamespace in class AbstractNamespaced<DocumentStore>
    • determineCollection

      public String determineCollection(@NonNull @NonNull Object collection)
      Description copied from interface: DocumentStore
      Resolves a given collection specifier to a collection name, using ClientUtils.determineSearchCollection(Object).
      Specified by:
      determineCollection in interface DocumentStore