Class DefaultModelRepository

java.lang.Object
io.fluxzero.sdk.common.AbstractNamespaced<ModelRepository>
io.fluxzero.sdk.persisting.repository.DefaultModelRepository
All Implemented Interfaces:
Namespaced<ModelRepository>, ModelAncestorResolver, ModelGraphResolver, ModelRepository, ModelTypeResolver

Default repository for independently stored models.

Current document-based models use their synchronously maintained direct document. Event-sourced and historical loads use the model-stream protocol and reconstruct every selected stream at one pinned stateIndex.

  • Constructor Details

  • Method Details

    • configureGraphStrict

      public void configureGraphStrict(boolean strict)
      Configures the application default before this repository is used. Namespace views inherit it.
    • documentFallbackEnabled

      public boolean documentFallbackEnabled()
      Description copied from interface: ModelGraphResolver
      Application default for current DOCUMENT-only fallback in historical Graph views.
      Specified by:
      documentFallbackEnabled in interface ModelGraphResolver
    • historicalDocumentFallback

      public Object historicalDocumentFallback(String modelId, Class<?> modelType, ModelReadBoundary boundary, RuntimeException failure)
      Description copied from interface: ModelGraphResolver
      Recovers only an unavailable historical document value. Implementations must preserve historical absence, resolve the exact canonical identity, and rethrow unrelated failures. The default preserves strict behavior.
      Specified by:
      historicalDocumentFallback in interface ModelGraphResolver
    • createForNamespace

      protected ModelRepository createForNamespace(String namespace)
      Specified by:
      createForNamespace in class AbstractNamespaced<ModelRepository>
    • sharesReadContext

      public boolean sharesReadContext(ModelRepository other)
      Whether two repository views address the same application-owned Model state and exact namespace.
    • configureOwningApplication

      public void configureOwningApplication(Fluxzero application)
      Binds background cache replay to this repository's owning application, including namespace views. Builders configure this before exposing the repository. Standalone repositories do not infer ownership from callers.
    • modelSourceCollection

      public Optional<String> modelSourceCollection(Class<?> type)
      Resolves the canonical Model source using this repository's application properties.
    • graphSearchDefinition

      public Optional<ModelGraphProjectionConfiguration> graphSearchDefinition(Class<?> type)
      Resolves search composition with this repository's model catalog and application properties.
    • configureReplayRestoration

      public void configureReplayRestoration(UnaryOperator<DeserializingMessage> restoration)
      Configures application-owned event payload restoration before this repository is made available to callers.
    • modelDefinitionCompiler

      public MutationPlan.Compiler modelDefinitionCompiler()
      Returns the model-definition compiler shared by live commits and stored-event replay.
    • followPublishedEventMigration

      public ModelRepository followPublishedEventMigration(@NonNull @NonNull String migrationName, @NonNull @NonNull Duration maxWait)
      Description copied from interface: ModelRepository
      Coordinates legacy-event reads with a migration consumer using a bounded wait before normal handler retry takes over.
      Specified by:
      followPublishedEventMigration in interface ModelRepository
      Parameters:
      migrationName - stable durable migration-consumer name
      maxWait - maximum time one read waits for the migration consumer to reach its event
      Returns:
      this repository
    • planDeletion

      public ModelDeletionPlan planDeletion(@NonNull @NonNull Object modelId, @NonNull @NonNull ModelDeletionCascade cascade)
      Description copied from interface: ModelRepository
      Creates a bounded, non-mutating plan for an explicit model hard deletion.

      A descendant cascade must be planned and confirmed before execution. The returned published-event count makes clear that globally published events are outside the model-stream erasure boundary. Descendants include retained deleted-parent lineage after nested logical cascades, but not earlier ordinary detachments or moves. Inspect the plan before confirming it: upgrading cannot reconstruct missing lineage markers written by older store implementations.

      Specified by:
      planDeletion in interface ModelRepository
    • deleteModel

      public CompletableFuture<ModelDeletionResult> deleteModel(@NonNull @NonNull Object modelId, @NonNull @NonNull ModelDeletionCascade cascade)
      Description copied from interface: ModelRepository
      Hard-deletes exactly one model.

      Passing ModelDeletionCascade.DESCENDANTS without a confirmed plan is rejected. Use ModelRepository.deleteModel(ModelDeletionPlan) for descendant cascades.

      Specified by:
      deleteModel in interface ModelRepository
    • deleteModel

      public CompletableFuture<ModelDeletionResult> deleteModel(@NonNull @NonNull String deletionId, @NonNull @NonNull Object modelId, @NonNull @NonNull ModelDeletionCascade cascade)
      Description copied from interface: ModelRepository
      Executes or resumes an exact-model hard deletion using an explicit durable idempotency key. Descendant deletion still requires a confirmed plan.
      Specified by:
      deleteModel in interface ModelRepository
    • deleteModel

      public CompletableFuture<ModelDeletionResult> deleteModel(@NonNull @NonNull ModelDeletionPlan plan)
      Description copied from interface: ModelRepository
      Executes a previously confirmed hard-deletion plan with a new durable idempotency key.
      Specified by:
      deleteModel in interface ModelRepository
    • deleteModel

      public CompletableFuture<ModelDeletionResult> deleteModel(@NonNull @NonNull String deletionId, @NonNull @NonNull ModelDeletionPlan plan)
      Description copied from interface: ModelRepository
      Executes or resumes a confirmed plan using an explicit durable idempotency key.
      Specified by:
      deleteModel in interface ModelRepository
    • adoptModelMigrations

      public CompletableFuture<Integer> adoptModelMigrations()
      Description copied from interface: ModelRepository
      Verifies and adopts every staged direct Model migration known to this application. Materialized Graph projections declared by the application are rebuilt after every staged document has been adopted. The accepted normalized source remains isolated from later staging until the first ordinary Model write, so another legacy boundary can be re-adopted without exposing unverified state. Repeating the operation is also a safe way to resume projection rebuilds after a failure.
      Specified by:
      adoptModelMigrations in interface ModelRepository
      Returns:
      the number of staged Model documents adopted by this invocation
      See Also:
    • registerGraphProjection

      public CompletableFuture<ModelGraphProjectionStatus> registerGraphProjection(@NonNull @NonNull Class<?> modelType, boolean rebuild)
      Description copied from interface: ModelRepository
      Registers the graph projection declared by the supplied model type.
      Specified by:
      registerGraphProjection in interface ModelRepository
      Parameters:
      modelType - model carrying an enabled graph projection
      rebuild - whether all current roots should be scanned even if the definition is unchanged
    • configureModelTypes

      public void configureModelTypes(Supplier<List<Class<?>>> modelTypes)
      Configures the application-bound model catalog used to version materialized Graph schemas.
    • configureAutomaticModelRouting

      public void configureAutomaticModelRouting(boolean enabled)
      Configures the single-Model event-routing fallback before this repository starts handling commits.
    • configureGraphProjectionCompletion

      public void configureGraphProjectionCompletion(GraphProjectionCompletion completion)
      Configures the application default for explicit reindex completion before the repository is used.
    • diagnostics

      public ModelDiagnostics diagnostics()
      Description copied from interface: ModelRepository
      Returns an explicit bounded dev/CI catalog inspector for this repository's namespace. Custom repositories may expose their own inspector; the default declines rather than inspecting a different store or namespace.
      Specified by:
      diagnostics in interface ModelRepository
    • modelName

      public String modelName(Class<?> modelType)
      Description copied from interface: ModelTypeResolver
      Returns and registers the stable logical name for one concrete Model type.
      Specified by:
      modelName in interface ModelTypeResolver
    • modelType

      public Class<?> modelType(String modelName, String modelId)
      Description copied from interface: ModelTypeResolver
      Resolves a stored logical name to a registered concrete Model type.
      Specified by:
      modelType in interface ModelTypeResolver
    • knownModelType

      public Optional<Class<?>> knownModelType(String modelName, String modelId)
      Description copied from interface: ModelTypeResolver
      Looks up a logical name without interpreting missing local registration as corrupt stored data. Implementations that do not support unknown types retain their strict resolution; application or registry failures still fail.
      Specified by:
      knownModelType in interface ModelTypeResolver
    • graphProjectionDefinition

      public ModelGraphProjectionConfiguration graphProjectionDefinition(@NonNull @NonNull Class<?> modelType)
      Returns the application-resolved durable definition owned by this repository.
    • awaitGraphProjections

      public CompletableFuture<Void> awaitGraphProjections(@NonNull @NonNull Map<Class<?>, Set<String>> projections, long firstStateIndex, long stateIndex)
      Completes when every affected durable graph projection has processed the supplied commit range.
    • graphProjectionStatus

      public ModelGraphProjectionStatus graphProjectionStatus(@NonNull @NonNull Class<?> modelType)
      Description copied from interface: ModelRepository
      Returns current graph-projection freshness for the supplied model type.
      Specified by:
      graphProjectionStatus in interface ModelRepository
    • load

      public <T> Entity<T> load(@NonNull @NonNull Object modelId, @NonNull @NonNull Class<T> modelType)
      Description copied from interface: ModelRepository
      Loads a model using the string representation of the supplied ID, resolving a current model alias when no primary model has that identity. An undecorated fallback ignores primary Models of unrelated types (for example the parent of an absent companion). Genuine aliases and compatible primary identities remain valid; explicit wrong-type reads fail.
      Specified by:
      load in interface ModelRepository
    • loadCurrent

      public <T> Entity<T> loadCurrent(@NonNull @NonNull Object modelId, @NonNull @NonNull Class<T> modelType)
      Description copied from interface: ModelRepository
      Loads the latest model state without inheriting an event or notification handler's historical read boundary.

      Use this when deliberately inspecting current intent, for example after a synchronous nested Model write or when reconciling schedules triggered by an older event. Ordinary event-bound reads should use ModelRepository.load(Object, Class) so they remain coherent with the message being handled.

      Specified by:
      loadCurrent in interface ModelRepository
    • load

      public <T> Entity<T> load(@NonNull @NonNull String modelId, @NonNull @NonNull Class<T> modelType)
      Description copied from interface: ModelRepository
      Loads a model by primary ID or current alias and expected type. A primary model ID always takes precedence over an alias with the same value.
      Specified by:
      load in interface ModelRepository
      Parameters:
      modelId - persisted model key or current alias; never decorated with model type metadata
      modelType - expected model type, or Object when it should be resolved from storage
    • loadCurrent

      public <T> Entity<T> loadCurrent(@NonNull @NonNull String modelId, @NonNull @NonNull Class<T> modelType)
      Description copied from interface: ModelRepository
      Loads the latest model state by literal primary key or alias, without adding affixes. Custom repositories without contextual historical reads retain their normal behavior by delegating to ModelRepository.load(String, Class).
      Specified by:
      loadCurrent in interface ModelRepository
    • loadAll

      public <T> List<Entity<T>> loadAll(@NonNull @NonNull List<?> modelIds, @NonNull @NonNull Class<T> modelType)
      Description copied from interface: ModelRepository
      Loads several models at one coherent state boundary, preserving input order.

      Repositories without coherent multi-model reconstruction reject this capability instead of emulating it with independent reads at different boundaries.

      Specified by:
      loadAll in interface ModelRepository
    • loadAll

      public <T> List<Entity<T>> loadAll(@NonNull @NonNull List<?> modelIds, @NonNull @NonNull Class<T> modelType, boolean applyAffixes)
      Description copied from interface: ModelRepository
      Loads models at one coherent boundary with optional ID conversion and affixes, retaining alias resolution. False uses each supplied string representation unchanged. Custom repositories must support literal batch reads explicitly; the default never substitutes independent reads at different boundaries.
      Specified by:
      loadAll in interface ModelRepository
    • loadGraph

      public <T> Graph<T> loadGraph(@NonNull @NonNull String rootId, @NonNull @NonNull Class<T> rootType, @NonNull Graph.Options options)
      Description copied from interface: ModelRepository
      Reconstructs a model graph using exact persisted identity, root type, and optional caller-imposed limits. Pending changes from earlier messages in the same ordered tracking segment are included.
      Specified by:
      loadGraph in interface ModelRepository
    • allowsAliasFallback

      public boolean allowsAliasFallback(String requestedId, Class<?> modelType, ModelReadBoundary boundary)
      Description copied from interface: ModelGraphResolver
      Checks whether a pending undecorated alias may supply a missing prefixed root at this boundary. An unrelated durable primary identity must retain precedence over the pending alias. Custom resolvers keep their existing overlay behavior by default; metadata-aware implementations can reject such collisions. Called only when a pending alias candidate exists, not on ordinary reads.
      Specified by:
      allowsAliasFallback in interface ModelGraphResolver
    • graphStagedValues

      public ModelBatchScope.Snapshot graphStagedValues(ModelReadBoundary boundary)
      Description copied from interface: ModelGraphResolver
      Captures this repository's message-batch overlay once for a new navigation view. Another application's pending writes must never enter this snapshot, even when its batch is active on the calling thread.
      Specified by:
      graphStagedValues in interface ModelGraphResolver
    • loadGraphProjection

      public Graph<?> loadGraphProjection(String rootId, Class<?> rootType, ModelReadBoundary boundary, boolean historical)
      Description copied from interface: ModelGraphResolver
      Strictly materializes a full graph at the selected boundary without consulting later batch state.
      Specified by:
      loadGraphProjection in interface ModelGraphResolver
    • loadGraphProjection

      public Graph<?> loadGraphProjection(String rootId, Class<?> rootType, ModelReadBoundary boundary, boolean historical, Entity<?> resolvedRoot)
      Description copied from interface: ModelGraphResolver
      Materializes relationships while retaining a root value whose identity or absence was already resolved. A resolver opting into metadata-only identity resolution must implement this operation for absent roots; silently resolving the supplied identity again could bind it to a different model.
      Specified by:
      loadGraphProjection in interface ModelGraphResolver
    • loadCurrentGraphValue

      public ModelGraphResolver.Value loadCurrentGraphValue(Object modelId, Class<?> modelType)
      Description copied from interface: ModelGraphResolver
      Loads deliberately current state with its namespace boundary, ignoring any active handler boundary.
      Specified by:
      loadCurrentGraphValue in interface ModelGraphResolver
    • loadGraphValue

      public ModelGraphResolver.Value loadGraphValue(Object modelId, boolean exact, Class<?> modelType, ModelReadBoundary boundary)
      Description copied from interface: ModelGraphResolver
      Loads a source value and retains the coherent boundary that ordinary single-value APIs do not expose.
      Specified by:
      loadGraphValue in interface ModelGraphResolver
    • resolveGraphIdentity

      public ModelGraphResolver.Identity resolveGraphIdentity(Object modelId, Class<?> modelType, ModelReadBoundary boundary)
      Description copied from interface: ModelGraphResolver
      Resolves an identity without requiring its value. The returned supplier must retain the resolved identity, absence and boundary even if the alias changes later. Returning null (the default) retains a custom repository's existing value-based identity lookup, without opting into metadata-only identity resolution.
      Specified by:
      resolveGraphIdentity in interface ModelGraphResolver
    • resolveGraphIdentity

      public ModelGraphResolver.Identity resolveGraphIdentity(Object modelId, boolean exact, Class<?> modelType, ModelReadBoundary boundary)
      Description copied from interface: ModelGraphResolver
      Resolves an exact persisted key without applying functional-ID affixes a second time.
      Specified by:
      resolveGraphIdentity in interface ModelGraphResolver
    • resolveBoundGraphIdentities

      public Map<String, ModelGraphResolver.Identity> resolveBoundGraphIdentities(Map<String,Class<?>> modelTypes)
      Description copied from interface: ModelGraphResolver
      Resolves already bound handler references together without applying ID affixes again. Unlike exact canonical reads, these references may still be aliases. An empty map preserves existing eager parameter injection.
      Specified by:
      resolveBoundGraphIdentities in interface ModelGraphResolver
    • resolveCurrentGraphIdentity

      public ModelGraphResolver.Identity resolveCurrentGraphIdentity(Object modelId, Class<?> modelType)
      Description copied from interface: ModelGraphResolver
      Optional metadata-first current root; the default retains the existing current-value route.
      Specified by:
      resolveCurrentGraphIdentity in interface ModelGraphResolver
    • resolveCurrentGraphIdentity

      public ModelGraphResolver.Identity resolveCurrentGraphIdentity(Object modelId, boolean exact, Class<?> modelType)
      Description copied from interface: ModelGraphResolver
      Resolves a deliberately current root, optionally using an exact repository key without functional-ID affixes or alias fallback. Must ignore the active handler boundary and pin a fresh storage boundary. Event-sourced roots need no value reconstruction; a DOCUMENT-only root may capture its current value with the head before exposing the identity, since later replacement cannot be reconstructed. The returned identity and supplier must never advance independently. Returning null declares this optional capability unsupported.
      Specified by:
      resolveCurrentGraphIdentity in interface ModelGraphResolver
    • resolveCurrentGraphIdentity

      public ModelGraphResolver.Identity resolveCurrentGraphIdentity(Object modelId, boolean exact, Class<?> modelType, ModelBatchScope.Snapshot snapshot)
      Description copied from interface: ModelGraphResolver
      Resolves a current root against the caller's captured batch overlay. Implementations that capture a durable document may omit that body read when the overlay wins. The default preserves custom resolver behavior.
      Specified by:
      resolveCurrentGraphIdentity in interface ModelGraphResolver
    • resolveCurrentGraphIdentity

      public ModelGraphResolver.Identity resolveCurrentGraphIdentity(Object modelId, ModelIdResolution resolution, Class<?> modelType, ModelBatchScope.Snapshot snapshot)
      Description copied from interface: ModelGraphResolver
      Resolves a deliberately current root with independent normalization and alias policy.
      Specified by:
      resolveCurrentGraphIdentity in interface ModelGraphResolver
    • resolveUntypedGraphIdentity

      public ModelGraphResolver.Identity resolveUntypedGraphIdentity(Object modelId)
      Description copied from interface: ModelGraphResolver
      Optional untyped root discovery; an implementation supplies its resolved class through ModelGraphResolver.HeadValue.
      Specified by:
      resolveUntypedGraphIdentity in interface ModelGraphResolver
    • resolveGraphIdentity

      public ModelGraphResolver.Identity resolveGraphIdentity(Object modelId, boolean exact, Class<?> modelType, ModelReadBoundary selected, boolean historical)
      Description copied from interface: ModelGraphResolver
      Resolves metadata at a pinned boundary with an explicit current versus historical value contract.
      Specified by:
      resolveGraphIdentity in interface ModelGraphResolver
    • resolveGraphIdentity

      public ModelGraphResolver.Identity resolveGraphIdentity(Object id, ModelIdResolution resolution, Class<?> type, ModelReadBoundary boundary)
      Description copied from interface: ModelGraphResolver
      Resolves a root with independent normalization and alias policy.
      Specified by:
      resolveGraphIdentity in interface ModelGraphResolver
    • resolveGraphIdentity

      public ModelGraphResolver.Identity resolveGraphIdentity(Object id, ModelIdResolution resolution, Class<?> type, ModelReadBoundary boundary, boolean historical)
      Description copied from interface: ModelGraphResolver
      Resolves a root at a pinned boundary with independent normalization and alias policy.
      Specified by:
      resolveGraphIdentity in interface ModelGraphResolver
    • loadGraphValue

      public ModelGraphResolver.Value loadGraphValue(Object modelId, boolean exact, Class<?> modelType, ModelReadBoundary boundary, boolean historical)
      Description copied from interface: ModelGraphResolver
      Loads at a pinned boundary without confusing transaction-current document authority with historical replay.
      Specified by:
      loadGraphValue in interface ModelGraphResolver
    • loadGraphValue

      public ModelGraphResolver.Value loadGraphValue(Object id, ModelIdResolution resolution, Class<?> type, ModelReadBoundary boundary)
      Description copied from interface: ModelGraphResolver
      Loads a source value with independent normalization and alias policy.
      Specified by:
      loadGraphValue in interface ModelGraphResolver
    • loadGraphValue

      public ModelGraphResolver.Value loadGraphValue(Object id, ModelIdResolution resolution, Class<?> type, ModelReadBoundary boundary, boolean historical)
      Description copied from interface: ModelGraphResolver
      Loads a source value at a pinned boundary with independent normalization and alias policy.
      Specified by:
      loadGraphValue in interface ModelGraphResolver
    • loadCurrentGraphValue

      public ModelGraphResolver.Value loadCurrentGraphValue(Object id, Class<?> type, boolean applyAffixes)
      Description copied from interface: ModelGraphResolver
      Loads deliberately current state with optional ID conversion and affixes.
      Specified by:
      loadCurrentGraphValue in interface ModelGraphResolver
    • loadGraphValues

      public Map<String, Entity<?>> loadGraphValues(Map<String,Class<?>> modelTypes, ModelReadBoundary boundary, Map<String, Entity<?>> staged, boolean historical)
      Description copied from interface: ModelGraphResolver
      Reconstructs explicitly requested values together; unrelated metadata nodes must remain unloaded.
      Specified by:
      loadGraphValues in interface ModelGraphResolver
    • loadGraphRelations

      public ModelGraphResolver.Relations loadGraphRelations(List<String> modelIds, ModelRelationshipRead.Direction direction, ModelReadBoundary boundary, Map<String, Entity<?>> staged, boolean historical)
      Description copied from interface: ModelGraphResolver
      Reads direct relationships and heads without loading values. The supplied staged snapshot takes precedence over durable relationships and must also be used by returned value suppliers. No implicit later batch reads.
      Specified by:
      loadGraphRelations in interface ModelGraphResolver
    • loadGraph

      public <T> Graph<T> loadGraph(@NonNull @NonNull String rootId, @NonNull @NonNull Class<T> rootType, @NonNull @NonNull ModelReadBoundary boundary, @NonNull Graph.Options options)
      Description copied from interface: ModelRepository
      Reconstructs one model graph at the supplied current, state, commit, event, or before boundary.
      Specified by:
      loadGraph in interface ModelRepository
    • loadAncestorGraph

      public <A> Optional<Graph<A>> loadAncestorGraph(String modelId, Class<?> modelType, Class<A> ancestorType, ModelReadBoundary boundary)
      Description copied from interface: ModelAncestorResolver
      Resolves and loads only the closest ancestor assignable to ancestorType at the graph's read boundary. Intermediate parent values must remain unloaded.
      Specified by:
      loadAncestorGraph in interface ModelAncestorResolver
    • loadAncestorGraphs

      public <A> List<Graph<A>> loadAncestorGraphs(String modelId, Class<?> modelType, Class<A> ancestorType, ModelReadBoundary boundary)
      Description copied from interface: ModelAncestorResolver
      Resolves every reachable ancestor assignable to ancestorType at one boundary.

      The singular method remains the ergonomic default for normal graph traversal. Change subscriptions use this form because one changed model may be shared by multiple roots.

      Specified by:
      loadAncestorGraphs in interface ModelAncestorResolver
    • loadAncestorGraph

      public <A> Optional<Graph<A>> loadAncestorGraph(String modelId, Class<?> modelType, Class<A> ancestorType, ModelReadBoundary boundary, Consumer<ModelAncestorResolver.AncestorReads> observer)
      Description copied from interface: ModelAncestorResolver
      Resolves an ancestor while reporting the identities inspected by the relationship traversal, including a negative result. Implementations can override this to preserve identity-only traversal for transactional Graph reads. The default reports no proof; the Graph then gathers dependencies through its ordinary parents.
      Specified by:
      loadAncestorGraph in interface ModelAncestorResolver
    • loadGraphAtIncludingMessageBatch

      public <T> Graph<T> loadGraphAtIncludingMessageBatch(@NonNull @NonNull String rootId, @NonNull @NonNull Class<T> rootType, long stateIndex, @NonNull Graph.Options options)
      Reconstructs a graph at an exact durable boundary and overlays pending values from earlier messages in the current message batch. This is used by atomic model planning that must retain read-your-writes semantics without advancing beyond its already pinned durable boundary.
    • preparationFailure

      public Exception preparationFailure(String commitId, long readStateIndex, Exception failure)
      Translates loss of a pinned document during mutation preparation. Unrelated application, replay and serialization failures retain their original contract; fresh current reads use their own bounded retry path.
    • loadContext

      public CommitAttempt loadContext(MutationPlan.Resolution resolution)
      Loads all direct commit targets at one state boundary.

      A null boundary pins the current event-store state once. Historical document-model dependencies are reconstructed from stored model events; current document-model targets retain their direct-document load path.

      Specified by:
      loadContext in interface ModelRepository
    • loadContext

      public CommitAttempt loadContext(MutationPlan.Resolution resolution, Long maxStateIndex, Map<String,Object> stagedValues, boolean includeMessageBatch)
      Loads a commit context with an explicit choice whether pending values from the surrounding tracking batch should be overlaid. Automatic model handling disables this generic overlay because its preplanned batch view already supplies exactly the required predecessors; explicit operations and ordinary handlers enable it.
    • loadContext

      public CommitAttempt loadContext(MutationPlan.Resolution resolution, Long maxStateIndex, Map<String,Object> stagedValues, boolean includeMessageBatch, boolean migration)
      Loads a commit attempt for the resolved Models at the supplied maximum state index, with staged values and the requested message-batch and migration visibility.
    • loadRebaseContext

      public CommitAttempt loadRebaseContext(MutationPlan.Resolution resolution, Long maxStateIndex, Map<String,Object> stagedValues, boolean includeMessageBatch, boolean migration)
      Reloads a conflict retry or ACCEPT rebase, waiting for pending document materialization and allowing an incomplete authoritative document to advance the exact boundary before mutation evaluation. Ordinary historical reads never enable this retry mode.
    • loadCurrentContext

      public CommitAttempt loadCurrentContext(MutationPlan.Resolution resolution, Map<String,Object> stagedValues, boolean includeMessageBatch)
      Loads one transaction's initial context at a freshly observed storage boundary. A cached root's validation cursor is not evidence of current Graph membership. Values still reuse exact matching cached revisions; incomplete document history follows the existing bounded boundary-advance protocol before evaluation begins. Direct DOCUMENT-only contexts retain document authority, verifying all heads at one namespace boundary and retrying the complete preparation before user code runs instead of replaying published history.
    • loadDeferredDocumentContext

      public CommitAttempt loadDeferredDocumentContext(MutationPlan.Resolution resolution)
      Internal fast preparation for a direct DOCUMENT target; pending mutations retain eager preparation.
    • supplyCurrentModel

      public boolean supplyCurrentModel(String modelId, Class<?> modelType, DefaultModelRepository.CurrentModelSink sink)
      Supplies one independently proven current cache value without allocating an intermediate result object.
    • overlayPendingContext

      public CommitAttempt overlayPendingContext(CommitAttempt context)
      Adds this repository's visible pending values and commit dependencies to a prefetched durable context.
    • updateAfterCommit

      public void updateAfterCommit(List<DefaultModelRepository.Commit.Outcome> outcomes)
      Makes accepted local model transitions immediately visible through this repository.
    • beginLocalCommit

      public Runnable beginLocalCommit(Collection<String> modelIds)
      Marks model targets as belonging to an in-flight commit from this SDK so a concurrently observed tracker update does not race the authoritative accepted result into an unnecessary cache refresh.
      Returns:
      an idempotent completion callback
    • invalidateModels

      public void invalidateModels(Iterable<String> modelIds)
      Removes commit-scoped entries before a strict-policy retry reload.
    • committedGraph

      public <T> Graph<T> committedGraph(DefaultModelRepository.Commit.Outcome prepared, CommitModelsResult result, String modelId, Entity<T> previous)
      Internal atomic-operation result built from its acknowledged revisions, never a post-commit load.
    • reindex

      public void reindex(@NonNull @NonNull String modelId, @NonNull @NonNull Class<?> modelType)
      Description copied from interface: ModelRepository
      Reindexes the current durable state of exactly one Model. Custom repositories must implement the guarded capability explicitly. See Graph.reindex() for cutoff and completion semantics.
      Specified by:
      reindex in interface ModelRepository
    • loadCurrentState

      public <T> ModelState<T> loadCurrentState(@NonNull @NonNull String modelId, @NonNull @NonNull Class<T> modelType)
      Description copied from interface: ModelRepository
      Reads a current document-backed Model value without replaying historical events. The returned state is read-only, independently current (not handler-historical), and not an implicit commit dependency. A missing/deleted Model has no value; a live Model with an unavailable, stale or unversioned document fails explicitly. No automatic replay, event skipping or ordinary Model-cache update takes place. The Runtime must attest a body/head proof captured with trusted Model materialization/adoption; older unproven documents require a new eligible trusted write and are never retroactively certified by a read. Custom repositories must implement the verified document capability; the default never emulates it by replay. This overload uses the exact persisted identity, not an alias.
      Specified by:
      loadCurrentState in interface ModelRepository