Class DefaultModelRepository
- All Implemented Interfaces:
Namespaced<ModelRepository>, ModelAncestorResolver, ModelGraphResolver, ModelRepository, ModelTypeResolver
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.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionfinal classConverts a side-effect-freeCommitAttemptevaluation into one authoritative runtime commit package.static interfaceReceives a cache value and the boundaries that prove it current.Nested classes/interfaces inherited from interface ModelAncestorResolver
ModelAncestorResolver.AncestorReadsNested classes/interfaces inherited from interface ModelGraphResolver
ModelGraphResolver.HeadValue, ModelGraphResolver.Identity, ModelGraphResolver.ModelNode, ModelGraphResolver.Relations, ModelGraphResolver.Value -
Constructor Summary
ConstructorsConstructorDescriptionDefaultModelRepository(Client client, DocumentStore documentStore, Serializer serializer, EntityHelper entityHelper, Serializer snapshotSerializer, Cache cache, List<ParameterResolver<? super DeserializingMessage>> parameterResolvers) DefaultModelRepository(Client client, DocumentStore documentStore, Serializer serializer, EntityHelper entityHelper, Serializer snapshotSerializer, Cache cache, List<ParameterResolver<? super DeserializingMessage>> parameterResolvers, String modelNamePrefix) DefaultModelRepository(Client client, DocumentStore documentStore, Serializer serializer, EntityHelper entityHelper, Serializer snapshotSerializer, Cache cache, List<ParameterResolver<? super DeserializingMessage>> parameterResolvers, String modelNamePrefix, boolean assertCurrentDefault) Creates a repository with the owning application's resolved interceptor validation default.DefaultModelRepository(Client client, DocumentStore documentStore, Serializer serializer, EntityHelper entityHelper, Serializer snapshotSerializer, Cache cache, List<ParameterResolver<? super DeserializingMessage>> parameterResolvers, String modelNamePrefix, boolean assertCurrentDefault, boolean aliasTargets) Creates a repository with the owning application's resolved Model defaults. -
Method Summary
Modifier and TypeMethodDescriptionVerifies and adopts every staged direct Model migration known to this application.booleanallowsAliasFallback(String requestedId, Class<?> modelType, ModelReadBoundary boundary) Checks whether a pending undecorated alias may supply a missing prefixed root at this boundary.awaitGraphProjections(@NonNull Map<Class<?>, Set<String>> projections, long firstStateIndex, long stateIndex) Completes when every affected durable graph projection has processed the supplied commit range.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.<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.voidconfigureAutomaticModelRouting(boolean enabled) Configures the single-Model event-routing fallback before this repository starts handling commits.voidConfigures the application default for explicit reindex completion before the repository is used.voidconfigureGraphStrict(boolean strict) Configures the application default before this repository is used.voidconfigureModelTypes(Supplier<List<Class<?>>> modelTypes) Configures the application-bound model catalog used to version materialized Graph schemas.voidconfigureOwningApplication(Fluxzero application) Binds background cache replay to this repository's owning application, including namespace views.voidconfigureReplayRestoration(UnaryOperator<DeserializingMessage> restoration) Configures application-owned event payload restoration before this repository is made available to callers.protected ModelRepositorycreateForNamespace(String namespace) deleteModel(@NonNull ModelDeletionPlan plan) Executes a previously confirmed hard-deletion plan with a new durable idempotency key.deleteModel(@NonNull Object modelId, @NonNull ModelDeletionCascade cascade) Hard-deletes exactly one model.deleteModel(@NonNull String deletionId, @NonNull ModelDeletionPlan plan) Executes or resumes a confirmed plan using an explicit durable idempotency key.deleteModel(@NonNull String deletionId, @NonNull Object modelId, @NonNull ModelDeletionCascade cascade) Executes or resumes an exact-model hard deletion using an explicit durable idempotency key.Returns an explicit bounded dev/CI catalog inspector for this repository's namespace.booleanApplication default for current DOCUMENT-only fallback in historical Graph views.followPublishedEventMigration(@NonNull String migrationName, @NonNull Duration maxWait) Coordinates legacy-event reads with a migration consumer using a bounded wait before normal handler retry takes over.graphProjectionDefinition(@NonNull Class<?> modelType) Returns the application-resolved durable definition owned by this repository.graphProjectionStatus(@NonNull Class<?> modelType) Returns current graph-projection freshness for the supplied model type.graphSearchDefinition(Class<?> type) Resolves search composition with this repository's model catalog and application properties.graphStagedValues(ModelReadBoundary boundary) Captures this repository's message-batch overlay once for a new navigation view.historicalDocumentFallback(String modelId, Class<?> modelType, ModelReadBoundary boundary, RuntimeException failure) Recovers only an unavailable historical document value.voidinvalidateModels(Iterable<String> modelIds) Removes commit-scoped entries before a strict-policy retry reload.knownModelType(String modelName, String modelId) Looks up a logical name without interpreting missing local registration as corrupt stored data.<T> Entity<T> Loads a model using the string representation of the supplied ID, resolving a current model alias when no primary model has that identity.<T> Entity<T> Loads a model by primary ID or current alias and expected type.Loads several models at one coherent state boundary, preserving input order.Loads models at one coherent boundary with optional ID conversion and affixes, retaining alias resolution.loadAncestorGraph(String modelId, Class<?> modelType, Class<A> ancestorType, ModelReadBoundary boundary) Resolves and loads only the closest ancestor assignable toancestorTypeat the graph's read boundary.loadAncestorGraph(String modelId, Class<?> modelType, Class<A> ancestorType, ModelReadBoundary boundary, Consumer<ModelAncestorResolver.AncestorReads> observer) Resolves an ancestor while reporting the identities inspected by the relationship traversal, including a negative result.loadAncestorGraphs(String modelId, Class<?> modelType, Class<A> ancestorType, ModelReadBoundary boundary) Resolves every reachable ancestor assignable toancestorTypeat one boundary.loadContext(MutationPlan.Resolution resolution) Loads all direct commit targets at one state boundary.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.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.<T> Entity<T> loadCurrent(@NonNull Object modelId, @NonNull Class<T> modelType) Loads the latest model state without inheriting an event or notification handler's historical read boundary.<T> Entity<T> loadCurrent(@NonNull String modelId, @NonNull Class<T> modelType) Loads the latest model state by literal primary key or alias, without adding affixes.loadCurrentContext(MutationPlan.Resolution resolution, Map<String, Object> stagedValues, boolean includeMessageBatch) Loads one transaction's initial context at a freshly observed storage boundary.loadCurrentGraphValue(Object modelId, Class<?> modelType) Loads deliberately current state with its namespace boundary, ignoring any active handler boundary.loadCurrentGraphValue(Object id, Class<?> type, boolean applyAffixes) Loads deliberately current state with optional ID conversion and affixes.<T> ModelState<T> loadCurrentState(@NonNull String modelId, @NonNull Class<T> modelType) Reads a current document-backed Model value without replaying historical events.loadDeferredDocumentContext(MutationPlan.Resolution resolution) Internal fast preparation for a direct DOCUMENT target; pending mutations retain eager preparation.<T> Graph<T> loadGraph(@NonNull String rootId, @NonNull Class<T> rootType, @NonNull ModelReadBoundary boundary, Graph.Options options) Reconstructs one model graph at the supplied current, state, commit, event, or before boundary.<T> Graph<T> loadGraph(@NonNull String rootId, @NonNull Class<T> rootType, Graph.Options options) Reconstructs a model graph using exact persisted identity, root type, and optional caller-imposed limits.<T> Graph<T> loadGraphAtIncludingMessageBatch(@NonNull String rootId, @NonNull Class<T> rootType, long stateIndex, Graph.Options options) Reconstructs a graph at an exact durable boundary and overlays pending values from earlier messages in the current message batch.Graph<?> loadGraphProjection(String rootId, Class<?> rootType, ModelReadBoundary boundary, boolean historical) Strictly materializes a full graph at the selected boundary without consulting later batch state.Graph<?> loadGraphProjection(String rootId, Class<?> rootType, ModelReadBoundary boundary, boolean historical, Entity<?> resolvedRoot) Materializes relationships while retaining a root value whose identity or absence was already resolved.loadGraphRelations(List<String> modelIds, ModelRelationshipRead.Direction direction, ModelReadBoundary boundary, Map<String, Entity<?>> staged, boolean historical) Reads direct relationships and heads without loading values.loadGraphValue(Object modelId, boolean exact, Class<?> modelType, ModelReadBoundary boundary) Loads a source value and retains the coherent boundary that ordinary single-value APIs do not expose.loadGraphValue(Object modelId, boolean exact, Class<?> modelType, ModelReadBoundary boundary, boolean historical) Loads at a pinned boundary without confusing transaction-current document authority with historical replay.loadGraphValue(Object id, ModelIdResolution resolution, Class<?> type, ModelReadBoundary boundary) Loads a source value with independent normalization and alias policy.loadGraphValue(Object id, ModelIdResolution resolution, Class<?> type, ModelReadBoundary boundary, boolean historical) Loads a source value at a pinned boundary with independent normalization and alias policy.loadGraphValues(Map<String, Class<?>> modelTypes, ModelReadBoundary boundary, Map<String, Entity<?>> staged, boolean historical) Reconstructs explicitly requested values together; unrelated metadata nodes must remain unloaded.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.Returns the model-definition compiler shared by live commits and stored-event replay.Returns and registers the stable logical name for one concrete Model type.modelSourceCollection(Class<?> type) Resolves the canonical Model source using this repository's application properties.Class<?> Resolves a stored logical name to a registered concrete Model type.overlayPendingContext(CommitAttempt context) Adds this repository's visible pending values and commit dependencies to a prefetched durable context.planDeletion(@NonNull Object modelId, @NonNull ModelDeletionCascade cascade) Creates a bounded, non-mutating plan for an explicit model hard deletion.preparationFailure(String commitId, long readStateIndex, Exception failure) Translates loss of a pinned document during mutation preparation.registerGraphProjection(@NonNull Class<?> modelType, boolean rebuild) Registers the graph projection declared by the supplied model type.voidReindexes the current durable state of exactly one Model.resolveBoundGraphIdentities(Map<String, Class<?>> modelTypes) Resolves already bound handler references together without applying ID affixes again.resolveCurrentGraphIdentity(Object modelId, boolean exact, Class<?> modelType) Resolves a deliberately current root, optionally using an exact repository key without functional-ID affixes or alias fallback.resolveCurrentGraphIdentity(Object modelId, boolean exact, Class<?> modelType, ModelBatchScope.Snapshot snapshot) Resolves a current root against the caller's captured batch overlay.resolveCurrentGraphIdentity(Object modelId, ModelIdResolution resolution, Class<?> modelType, ModelBatchScope.Snapshot snapshot) Resolves a deliberately current root with independent normalization and alias policy.resolveCurrentGraphIdentity(Object modelId, Class<?> modelType) Optional metadata-first current root; the default retains the existing current-value route.resolveGraphIdentity(Object modelId, boolean exact, Class<?> modelType, ModelReadBoundary boundary) Resolves an exact persisted key without applying functional-ID affixes a second time.resolveGraphIdentity(Object modelId, boolean exact, Class<?> modelType, ModelReadBoundary selected, boolean historical) Resolves metadata at a pinned boundary with an explicit current versus historical value contract.resolveGraphIdentity(Object id, ModelIdResolution resolution, Class<?> type, ModelReadBoundary boundary) Resolves a root with independent normalization and alias policy.resolveGraphIdentity(Object id, ModelIdResolution resolution, Class<?> type, ModelReadBoundary boundary, boolean historical) Resolves a root at a pinned boundary with independent normalization and alias policy.resolveGraphIdentity(Object modelId, Class<?> modelType, ModelReadBoundary boundary) Resolves an identity without requiring its value.resolveUntypedGraphIdentity(Object modelId) Optional untyped root discovery; an implementation supplies its resolved class throughModelGraphResolver.HeadValue.booleansharesReadContext(ModelRepository other) Whether two repository views address the same application-owned Model state and exact namespace.booleansupplyCurrentModel(String modelId, Class<?> modelType, DefaultModelRepository.CurrentModelSink sink) Supplies one independently proven current cache value without allocating an intermediate result object.voidMakes accepted local model transitions immediately visible through this repository.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 ModelRepository
followPublishedEventMigration, forNamespace, load, load, load, load, load, load, loadCurrent, loadCurrentState, loadGraph, loadGraphAt, loadGraphAt, loadGraphAt, loadGraphBefore, registerGraphProjectionMethods inherited from interface Namespaced
forApplicationNamespace, forDefaultNamespace
-
Constructor Details
-
DefaultModelRepository
public DefaultModelRepository(Client client, DocumentStore documentStore, Serializer serializer, EntityHelper entityHelper, Serializer snapshotSerializer, Cache cache, List<ParameterResolver<? super DeserializingMessage>> parameterResolvers) -
DefaultModelRepository
public DefaultModelRepository(Client client, DocumentStore documentStore, Serializer serializer, EntityHelper entityHelper, Serializer snapshotSerializer, Cache cache, List<ParameterResolver<? super DeserializingMessage>> parameterResolvers, String modelNamePrefix) -
DefaultModelRepository
public DefaultModelRepository(Client client, DocumentStore documentStore, Serializer serializer, EntityHelper entityHelper, Serializer snapshotSerializer, Cache cache, List<ParameterResolver<? super DeserializingMessage>> parameterResolvers, String modelNamePrefix, boolean assertCurrentDefault) Creates a repository with the owning application's resolved interceptor validation default. -
DefaultModelRepository
public DefaultModelRepository(Client client, DocumentStore documentStore, Serializer serializer, EntityHelper entityHelper, Serializer snapshotSerializer, Cache cache, List<ParameterResolver<? super DeserializingMessage>> parameterResolvers, String modelNamePrefix, boolean assertCurrentDefault, boolean aliasTargets) Creates a repository with the owning application's resolved Model defaults.
-
-
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:ModelGraphResolverApplication default for current DOCUMENT-only fallback in historical Graph views.- Specified by:
documentFallbackEnabledin interfaceModelGraphResolver
-
historicalDocumentFallback
public Object historicalDocumentFallback(String modelId, Class<?> modelType, ModelReadBoundary boundary, RuntimeException failure) Description copied from interface:ModelGraphResolverRecovers 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:
historicalDocumentFallbackin interfaceModelGraphResolver
-
createForNamespace
- Specified by:
createForNamespacein classAbstractNamespaced<ModelRepository>
-
configureOwningApplication
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
-
graphSearchDefinition
Resolves search composition with this repository's model catalog and application properties. -
configureReplayRestoration
Configures application-owned event payload restoration before this repository is made available to callers. -
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:ModelRepositoryCoordinates legacy-event reads with a migration consumer using a bounded wait before normal handler retry takes over.- Specified by:
followPublishedEventMigrationin interfaceModelRepository- Parameters:
migrationName- stable durable migration-consumer namemaxWait- 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:ModelRepositoryCreates 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:
planDeletionin interfaceModelRepository
-
deleteModel
public CompletableFuture<ModelDeletionResult> deleteModel(@NonNull @NonNull Object modelId, @NonNull @NonNull ModelDeletionCascade cascade) Description copied from interface:ModelRepositoryHard-deletes exactly one model.Passing
ModelDeletionCascade.DESCENDANTSwithout a confirmed plan is rejected. UseModelRepository.deleteModel(ModelDeletionPlan)for descendant cascades.- Specified by:
deleteModelin interfaceModelRepository
-
deleteModel
public CompletableFuture<ModelDeletionResult> deleteModel(@NonNull @NonNull String deletionId, @NonNull @NonNull Object modelId, @NonNull @NonNull ModelDeletionCascade cascade) Description copied from interface:ModelRepositoryExecutes or resumes an exact-model hard deletion using an explicit durable idempotency key. Descendant deletion still requires a confirmed plan.- Specified by:
deleteModelin interfaceModelRepository
-
deleteModel
Description copied from interface:ModelRepositoryExecutes a previously confirmed hard-deletion plan with a new durable idempotency key.- Specified by:
deleteModelin interfaceModelRepository
-
deleteModel
public CompletableFuture<ModelDeletionResult> deleteModel(@NonNull @NonNull String deletionId, @NonNull @NonNull ModelDeletionPlan plan) Description copied from interface:ModelRepositoryExecutes or resumes a confirmed plan using an explicit durable idempotency key.- Specified by:
deleteModelin interfaceModelRepository
-
adoptModelMigrations
Description copied from interface:ModelRepositoryVerifies 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:
adoptModelMigrationsin interfaceModelRepository- 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:ModelRepositoryRegisters the graph projection declared by the supplied model type.- Specified by:
registerGraphProjectionin interfaceModelRepository- Parameters:
modelType- model carrying an enabled graph projectionrebuild- whether all current roots should be scanned even if the definition is unchanged
-
configureModelTypes
-
configureAutomaticModelRouting
public void configureAutomaticModelRouting(boolean enabled) Configures the single-Model event-routing fallback before this repository starts handling commits. -
configureGraphProjectionCompletion
Configures the application default for explicit reindex completion before the repository is used. -
diagnostics
Description copied from interface:ModelRepositoryReturns 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:
diagnosticsin interfaceModelRepository
-
modelName
Description copied from interface:ModelTypeResolverReturns and registers the stable logical name for one concrete Model type.- Specified by:
modelNamein interfaceModelTypeResolver
-
modelType
Description copied from interface:ModelTypeResolverResolves a stored logical name to a registered concrete Model type.- Specified by:
modelTypein interfaceModelTypeResolver
-
knownModelType
Description copied from interface:ModelTypeResolverLooks 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:
knownModelTypein interfaceModelTypeResolver
-
graphProjectionDefinition
public ModelGraphProjectionConfiguration graphProjectionDefinition(@NonNull @NonNull Class<?> modelType) Returns the application-resolved durable definition owned by this repository. -
awaitGraphProjections
-
graphProjectionStatus
Description copied from interface:ModelRepositoryReturns current graph-projection freshness for the supplied model type.- Specified by:
graphProjectionStatusin interfaceModelRepository
-
load
Description copied from interface:ModelRepositoryLoads 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:
loadin interfaceModelRepository
-
loadCurrent
public <T> Entity<T> loadCurrent(@NonNull @NonNull Object modelId, @NonNull @NonNull Class<T> modelType) Description copied from interface:ModelRepositoryLoads 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:
loadCurrentin interfaceModelRepository
-
load
Description copied from interface:ModelRepositoryLoads 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:
loadin interfaceModelRepository- Parameters:
modelId- persisted model key or current alias; never decorated with model type metadatamodelType- expected model type, orObjectwhen 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:ModelRepositoryLoads 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 toModelRepository.load(String, Class).- Specified by:
loadCurrentin interfaceModelRepository
-
loadAll
public <T> List<Entity<T>> loadAll(@NonNull @NonNull List<?> modelIds, @NonNull @NonNull Class<T> modelType) Description copied from interface:ModelRepositoryLoads 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:
loadAllin interfaceModelRepository
-
loadAll
public <T> List<Entity<T>> loadAll(@NonNull @NonNull List<?> modelIds, @NonNull @NonNull Class<T> modelType, boolean applyAffixes) Description copied from interface:ModelRepositoryLoads 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:
loadAllin interfaceModelRepository
-
loadGraph
public <T> Graph<T> loadGraph(@NonNull @NonNull String rootId, @NonNull @NonNull Class<T> rootType, @NonNull Graph.Options options) Description copied from interface:ModelRepositoryReconstructs 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:
loadGraphin interfaceModelRepository
-
allowsAliasFallback
public boolean allowsAliasFallback(String requestedId, Class<?> modelType, ModelReadBoundary boundary) Description copied from interface:ModelGraphResolverChecks 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:
allowsAliasFallbackin interfaceModelGraphResolver
-
graphStagedValues
Description copied from interface:ModelGraphResolverCaptures 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:
graphStagedValuesin interfaceModelGraphResolver
-
loadGraphProjection
public Graph<?> loadGraphProjection(String rootId, Class<?> rootType, ModelReadBoundary boundary, boolean historical) Description copied from interface:ModelGraphResolverStrictly materializes a full graph at the selected boundary without consulting later batch state.- Specified by:
loadGraphProjectionin interfaceModelGraphResolver
-
loadGraphProjection
public Graph<?> loadGraphProjection(String rootId, Class<?> rootType, ModelReadBoundary boundary, boolean historical, Entity<?> resolvedRoot) Description copied from interface:ModelGraphResolverMaterializes 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:
loadGraphProjectionin interfaceModelGraphResolver
-
loadCurrentGraphValue
Description copied from interface:ModelGraphResolverLoads deliberately current state with its namespace boundary, ignoring any active handler boundary.- Specified by:
loadCurrentGraphValuein interfaceModelGraphResolver
-
loadGraphValue
public ModelGraphResolver.Value loadGraphValue(Object modelId, boolean exact, Class<?> modelType, ModelReadBoundary boundary) Description copied from interface:ModelGraphResolverLoads a source value and retains the coherent boundary that ordinary single-value APIs do not expose.- Specified by:
loadGraphValuein interfaceModelGraphResolver
-
resolveGraphIdentity
public ModelGraphResolver.Identity resolveGraphIdentity(Object modelId, Class<?> modelType, ModelReadBoundary boundary) Description copied from interface:ModelGraphResolverResolves an identity without requiring its value. The returned supplier must retain the resolved identity, absence and boundary even if the alias changes later. Returningnull(the default) retains a custom repository's existing value-based identity lookup, without opting into metadata-only identity resolution.- Specified by:
resolveGraphIdentityin interfaceModelGraphResolver
-
resolveGraphIdentity
public ModelGraphResolver.Identity resolveGraphIdentity(Object modelId, boolean exact, Class<?> modelType, ModelReadBoundary boundary) Description copied from interface:ModelGraphResolverResolves an exact persisted key without applying functional-ID affixes a second time.- Specified by:
resolveGraphIdentityin interfaceModelGraphResolver
-
resolveBoundGraphIdentities
public Map<String, ModelGraphResolver.Identity> resolveBoundGraphIdentities(Map<String, Class<?>> modelTypes) Description copied from interface:ModelGraphResolverResolves 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:
resolveBoundGraphIdentitiesin interfaceModelGraphResolver
-
resolveCurrentGraphIdentity
Description copied from interface:ModelGraphResolverOptional metadata-first current root; the default retains the existing current-value route.- Specified by:
resolveCurrentGraphIdentityin interfaceModelGraphResolver
-
resolveCurrentGraphIdentity
public ModelGraphResolver.Identity resolveCurrentGraphIdentity(Object modelId, boolean exact, Class<?> modelType) Description copied from interface:ModelGraphResolverResolves 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. Returningnulldeclares this optional capability unsupported.- Specified by:
resolveCurrentGraphIdentityin interfaceModelGraphResolver
-
resolveCurrentGraphIdentity
public ModelGraphResolver.Identity resolveCurrentGraphIdentity(Object modelId, boolean exact, Class<?> modelType, ModelBatchScope.Snapshot snapshot) Description copied from interface:ModelGraphResolverResolves 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:
resolveCurrentGraphIdentityin interfaceModelGraphResolver
-
resolveCurrentGraphIdentity
public ModelGraphResolver.Identity resolveCurrentGraphIdentity(Object modelId, ModelIdResolution resolution, Class<?> modelType, ModelBatchScope.Snapshot snapshot) Description copied from interface:ModelGraphResolverResolves a deliberately current root with independent normalization and alias policy.- Specified by:
resolveCurrentGraphIdentityin interfaceModelGraphResolver
-
resolveUntypedGraphIdentity
Description copied from interface:ModelGraphResolverOptional untyped root discovery; an implementation supplies its resolved class throughModelGraphResolver.HeadValue.- Specified by:
resolveUntypedGraphIdentityin interfaceModelGraphResolver
-
resolveGraphIdentity
public ModelGraphResolver.Identity resolveGraphIdentity(Object modelId, boolean exact, Class<?> modelType, ModelReadBoundary selected, boolean historical) Description copied from interface:ModelGraphResolverResolves metadata at a pinned boundary with an explicit current versus historical value contract.- Specified by:
resolveGraphIdentityin interfaceModelGraphResolver
-
resolveGraphIdentity
public ModelGraphResolver.Identity resolveGraphIdentity(Object id, ModelIdResolution resolution, Class<?> type, ModelReadBoundary boundary) Description copied from interface:ModelGraphResolverResolves a root with independent normalization and alias policy.- Specified by:
resolveGraphIdentityin interfaceModelGraphResolver
-
resolveGraphIdentity
public ModelGraphResolver.Identity resolveGraphIdentity(Object id, ModelIdResolution resolution, Class<?> type, ModelReadBoundary boundary, boolean historical) Description copied from interface:ModelGraphResolverResolves a root at a pinned boundary with independent normalization and alias policy.- Specified by:
resolveGraphIdentityin interfaceModelGraphResolver
-
loadGraphValue
public ModelGraphResolver.Value loadGraphValue(Object modelId, boolean exact, Class<?> modelType, ModelReadBoundary boundary, boolean historical) Description copied from interface:ModelGraphResolverLoads at a pinned boundary without confusing transaction-current document authority with historical replay.- Specified by:
loadGraphValuein interfaceModelGraphResolver
-
loadGraphValue
public ModelGraphResolver.Value loadGraphValue(Object id, ModelIdResolution resolution, Class<?> type, ModelReadBoundary boundary) Description copied from interface:ModelGraphResolverLoads a source value with independent normalization and alias policy.- Specified by:
loadGraphValuein interfaceModelGraphResolver
-
loadGraphValue
public ModelGraphResolver.Value loadGraphValue(Object id, ModelIdResolution resolution, Class<?> type, ModelReadBoundary boundary, boolean historical) Description copied from interface:ModelGraphResolverLoads a source value at a pinned boundary with independent normalization and alias policy.- Specified by:
loadGraphValuein interfaceModelGraphResolver
-
loadCurrentGraphValue
public ModelGraphResolver.Value loadCurrentGraphValue(Object id, Class<?> type, boolean applyAffixes) Description copied from interface:ModelGraphResolverLoads deliberately current state with optional ID conversion and affixes.- Specified by:
loadCurrentGraphValuein interfaceModelGraphResolver
-
loadGraphValues
public Map<String, Entity<?>> loadGraphValues(Map<String, Class<?>> modelTypes, ModelReadBoundary boundary, Map<String, Entity<?>> staged, boolean historical) Description copied from interface:ModelGraphResolverReconstructs explicitly requested values together; unrelated metadata nodes must remain unloaded.- Specified by:
loadGraphValuesin interfaceModelGraphResolver
-
loadGraphRelations
public ModelGraphResolver.Relations loadGraphRelations(List<String> modelIds, ModelRelationshipRead.Direction direction, ModelReadBoundary boundary, Map<String, Entity<?>> staged, boolean historical) Description copied from interface:ModelGraphResolverReads 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:
loadGraphRelationsin interfaceModelGraphResolver
-
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:ModelRepositoryReconstructs one model graph at the supplied current, state, commit, event, or before boundary.- Specified by:
loadGraphin interfaceModelRepository
-
loadAncestorGraph
public <A> Optional<Graph<A>> loadAncestorGraph(String modelId, Class<?> modelType, Class<A> ancestorType, ModelReadBoundary boundary) Description copied from interface:ModelAncestorResolverResolves and loads only the closest ancestor assignable toancestorTypeat the graph's read boundary. Intermediate parent values must remain unloaded.- Specified by:
loadAncestorGraphin interfaceModelAncestorResolver
-
loadAncestorGraphs
public <A> List<Graph<A>> loadAncestorGraphs(String modelId, Class<?> modelType, Class<A> ancestorType, ModelReadBoundary boundary) Description copied from interface:ModelAncestorResolverResolves every reachable ancestor assignable toancestorTypeat 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:
loadAncestorGraphsin interfaceModelAncestorResolver
-
loadAncestorGraph
public <A> Optional<Graph<A>> loadAncestorGraph(String modelId, Class<?> modelType, Class<A> ancestorType, ModelReadBoundary boundary, Consumer<ModelAncestorResolver.AncestorReads> observer) Description copied from interface:ModelAncestorResolverResolves 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:
loadAncestorGraphin interfaceModelAncestorResolver
-
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
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
Loads all direct commit targets at one state boundary.A
nullboundary 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:
loadContextin interfaceModelRepository
-
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
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
Adds this repository's visible pending values and commit dependencies to a prefetched durable context. -
updateAfterCommit
Makes accepted local model transitions immediately visible through this repository. -
beginLocalCommit
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
-
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
Description copied from interface:ModelRepositoryReindexes the current durable state of exactly one Model. Custom repositories must implement the guarded capability explicitly. SeeGraph.reindex()for cutoff and completion semantics.- Specified by:
reindexin interfaceModelRepository
-
loadCurrentState
public <T> ModelState<T> loadCurrentState(@NonNull @NonNull String modelId, @NonNull @NonNull Class<T> modelType) Description copied from interface:ModelRepositoryReads 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:
loadCurrentStatein interfaceModelRepository
-