string Value { get; }
Source
Gets the opaque scope value.
Identifies the trusted application scope that owns a durable aggregate.
Scope identifiers must come from an application-authorized context. A caller-supplied route, form, event, or instance identifier is not sufficient authorization to construct a durable operation.
string Value { get; }
Source
Gets the opaque scope value.
Identifies one accepted durable work aggregate independently of its retries and leases.
DurableWorkId New()
Creates a cryptographically random identifier suitable for a new work aggregate.
A new durable work identifier.
string Value { get; }
Source
Gets the opaque identifier value.
Identifies one idempotent durable command.
DurableCommandId New()
Creates a cryptographically random identifier suitable for a new command.
A new durable command identifier.
string Value { get; }
Source
Gets the opaque identifier value.
Shared validation for opaque durable identifiers.
string Require(string value, string parameterName, int maximumLength)
Validates a required privacy-safe identifier without changing its ordinal value.
string RequireText(string value, string parameterName, int maximumLength)
Validates bounded non-control text without claiming it is an opaque identifier.
string RequireSafeLabel(string value, string parameterName, int maximumLength)
Validates a bounded human label while rejecting common secret, URL, email, and raw-payload shapes.
Identifies the versioned canonical semantic content of a command-bearing durable mutation.
DurableCommandFingerprintMatch Compare(DurableCommandFingerprint persisted)
Compares a persisted fingerprint without reinterpreting an unknown schema.
persisted
DurableCommandFingerprintMatch.Exact
for identical schemas and digests, DurableCommandFingerprintMatch.Conflict
for differing digests under the same schema, or DurableCommandFingerprintMatch.UnsupportedSchema
for differing schemas.
ArgumentNullException
persisted
is null.string SchemaId { get; }
Source
Gets the versioned canonicalization schema.
string Sha256 { get; }
Source
Gets the lowercase SHA-256 digest of canonical semantic fields.
Creates canonical versioned fingerprints for command-bearing mutations.
DurableCommandFingerprint Create(string schemaId, params object?[] values)
Hashes an ordered sequence of supported semantic values under one schema identity.
schemaId
values
A fingerprint containing the schema identity and canonical SHA-256 digest.
ArgumentException
schemaId
is invalid.InvalidOperationException
Ordering is significant. Supported values use the closed canonical encodings below rather than culture-sensitive text conversion. Before either independent compatibility boundary—the first supported publication or any persisted deployment—an unpublished preview schema may receive a one-time compatibility correction. After either boundary, any change to value ordering, null markers, supported types, or their byte encodings must use a new schemaId
so persisted fingerprints are never compared under incompatible semantics.
Supplies persisted input for exactly one registered Flow node evaluation.
string NodeId { get; }
Source
Gets the node to evaluate.
DurableEncodedPayload Context { get; }
Source
Gets the persisted Flow context.
string? ResumeEventName { get; }
Source
Gets the external event name, if any.
DurableEncodedPayload? ResumeEventPayload { get; }
Source
Gets the allowlisted external event payload, if any.
bool IsTimeout { get; }
Source
Gets whether the event represents a durable wait timeout.
string? ActivityCallsiteId { get; }
Source
Gets the activity callsite that produced a result, if any.
DurableEncodedPayload? ActivityResult { get; }
Source
Gets the encoded activity result, if any.
Describes the durable work command produced by one Flow activity transition.
string CallsiteId { get; }
Source
Gets the stable Flow callsite.
int ResultContractVersion { get; }
Source
Gets the expected Flow result contract version.
string WorkName { get; }
Source
Gets the registered durable work name.
string WorkVersion { get; }
Source
Gets the registered durable work version.
DurableProviderSafety ProviderSafety { get; }
Source
Gets the provider ambiguity policy.
DurableEncodedPayload Work { get; }
Source
Gets the encoded activity work.
DurableActivityResultExpectation? ResultExpectation { get; }
Source
Gets the exact registered result identity persisted with a new activity wait.
Captures the exact immutable result identity expected by one persisted Flow activity wait.
Describes the exact payload contract accepted by one persisted external-event wait.
bool PayloadRequired { get; }
Source
Gets whether the external event must carry a payload.
string? ContractName { get; }
Source
Gets the exact payload contract name, or null for a no-payload wait.
string? ContractVersion { get; }
Source
Gets the exact payload contract version, or null for a no-payload wait.
DurableDataClassification? Classification { get; }
Source
Gets the exact approved classification, or null for a no-payload wait.
string? RetentionPolicyId { get; }
Source
Gets the exact retention policy identity, or null for a no-payload wait.
Binds one typed Flow event callsite to the exact durable payload codec allowed to cross that wait boundary.
IFlowEventCallsite Callsite { get; }
Source
Gets the exact callsite instance nodes must return when waiting for this event.
IDurablePayloadCodec PayloadCodec { get; }
Source
Gets the exact durable payload codec instance accepted by this event boundary.
Typed binding between a Flow event callsite and its durable payload codec.
TPayload
Carries the persistable result of exactly one Flow transition evaluation.
FlowTransitionKind Kind { get; }
Source
Gets the transition kind.
string NodeId { get; }
Source
Gets the node that produced the transition.
DurableEncodedPayload? Context { get; }
Source
Gets the encoded resulting context for non-fault transitions.
string? NextNodeId { get; }
Source
Gets the declared next node.
string? EventName { get; }
Source
Gets the external wait or timeout event name.
FlowTimeout? Timeout { get; }
Source
Gets the optional durable wait timeout.
FlowFault? Fault { get; }
Source
Gets a process-level Flow fault.
DurableFlowActivityCommand? Activity { get; }
Source
Gets an atomically accepted activity command.
DurableFlowEventContract? EventContract { get; }
Source
Gets the exact external-event payload contract for a wait transition.
Binds a Flow activity callsite to one registered durable work contract.
TContext
DurableEncodedPayload EncodeWork(IFlowActivityRequest<TContext> activity)
Encodes work from one evaluated activity request.
FlowActivityWorkResult DecodeResult(DurableEncodedPayload result)
Decodes a persisted result into the typed Flow resume contract.
string CallsiteId { get; }
Source
Gets the stable callsite identifier.
DurableWorkRegistration WorkRegistration { get; }
Source
Gets the registered durable work contract.
int WorkContractVersion { get; }
Source
Gets the immutable activity work contract version.
int ResultContractVersion { get; }
Source
Gets the immutable activity result contract version.
DurableActivityResultExpectation ResultExpectation { get; }
Source
Gets the exact registered payload identity expected of the activity result.
Typed binding between a Flow callsite and a durable work registration.
Evaluates one registered Flow version through versioned durable codecs.
ValueTask<DurableFlowEvaluationResult> EvaluateAsync(DurableFlowEvaluationInput input, IDurablePayloadCodecRegistry payloadCodecs, CancellationToken cancellationToken = default)
Evaluates and encodes exactly one transition.
string FlowId { get; }
Source
Gets the stable Flow definition id.
string FlowVersion { get; }
Source
Gets the immutable Flow definition version.
string ImplementationVersion { get; }
Source
Gets the application-owned implementation manifest version for executable node semantics not represented by graph topology or contract metadata.
string StartNodeId { get; }
Source
Gets the stable node id used for newly accepted instances.
string DefinitionFingerprint { get; }
Source
Gets the deterministic lowercase SHA-256 definition-manifest fingerprint.
string AuthoringModel { get; }
Source
Gets the authoring model required to interpret persisted transition history.
IDurablePayloadCodec ContextCodec { get; }
Source
Gets the Flow context codec.
IReadOnlyList<DurableFlowEventBinding> EventBindings { get; }
Source
Gets the exact typed external-event bindings declared by this Flow manifest.
IReadOnlyList<DurableWorkRegistration> ActivityWorkRegistrations { get; }
Source
Gets the exact durable work registrations referenced by activity callsites.
Typed, reflection-free durable registration for one Flow definition version.
IDurablePayloadCodec ResolveCodec(IDurablePayloadCodecRegistry payloadCodecs, IDurablePayloadCodec expected, Type payloadType, string contractName, string contractVersion, string boundary)
Resolves an exact registry codec and verifies that it is the expected registration-owned source or an equivalent package-owned snapshot view. Retains captured guards when a custom registry selects the original raw source, so one evaluation uses one guarded codec instance for both decoding and encoding.
DurableEncodedPayload EncodeContext(IDurablePayloadCodec contextCodec, TContext context)
Encodes context through the codec selected for the current evaluation.
Resolves immutable durable Flow registrations by id and version.
DurableFlowRegistration GetRequired(string flowId, string flowVersion)
Gets a required Flow registration.
Immutable durable Flow registry built at host startup.
Emits only the value-free diagnostics defined by the durable trace contract.
Versioned retry and lease snapshot stored when durable work is accepted.
DurableWorkRetryPolicy Default { get; }
Source
Gets the safe default policy for ordinary durable work.
int MaximumAttempts { get; }
Source
Gets the maximum number of execution attempts.
TimeSpan MaximumElapsedTime { get; }
Source
Gets the maximum time from acceptance through retry exhaustion.
TimeSpan InitialRetryDelay { get; }
Source
Gets the first retry delay.
TimeSpan MaximumRetryDelay { get; }
Source
Gets the retry delay cap.
TimeSpan LeaseDuration { get; }
Source
Gets the bounded claim lease duration.
TimeSpan RenewalCadence { get; }
Source
Gets the recommended lease renewal cadence.
TimeSpan MaximumLeaseLifetime { get; }
Source
Gets the maximum lifetime of one claim generation.
string BackoffAlgorithm { get; }
Source
Gets the versioned backoff algorithm identifier.
Describes one idempotent durable work submission.
DurableScopeId ScopeId { get; }
Source
Gets the trusted owning scope.
DurableCommandId CommandId { get; }
Source
Gets the idempotent command identifier.
string IdempotencyKey { get; }
Source
Gets the caller retry key, scoped to the owning scope.
string WorkName { get; }
Source
Gets the registered work name.
string WorkVersion { get; }
Source
Gets the registered work contract version.
DurableEncodedPayload Payload { get; }
Source
Gets the immutable encoded work payload.
DurableProviderSafety ProviderSafety { get; }
Source
Gets the provider ambiguity policy snapshot.
DurableWorkRetryPolicy RetryPolicy { get; }
Source
Gets the retry and lease policy snapshot.
DateTimeOffset? DueAtUtc { get; }
Source
Gets the first UTC eligibility time, or immediate eligibility when absent.
DurableCommandFingerprint Fingerprint { get; }
Source
Gets the computed versioned fingerprint of mutation-affecting semantic fields.
Records the stable outcome of accepting durable work.
DurableWorkId WorkId { get; }
Source
Gets the immutable durable work identifier.
DurableCommandId CommandId { get; }
Source
Gets the accepted command identifier.
DurableWorkAcceptanceKind Kind { get; }
Source
Gets whether the request was new or deduplicated.
long Revision { get; }
Source
Gets the aggregate revision produced by acceptance.
DateTimeOffset AcceptedAtUtc { get; }
Source
Gets the authoritative store acceptance time in UTC.
Accepts durable work outside an existing caller-owned transaction.
ValueTask<DurableOperationResult<DurableWorkAcceptance>> EnqueueAsync(DurableWorkRequest request, CancellationToken cancellationToken = default)
Accepts work atomically in a runtime-owned authoritative-store transaction.
Identifies one durable Flow instance independently of its current node or runtime claim.
DurableFlowInstanceId New()
Creates a cryptographically random Flow instance identifier.
string Value { get; }
Source
Gets the opaque identifier value.
Identifies a single-use external Flow event independently of transport retries.
DurableFlowEventId New()
Creates a cryptographically random event identifier.
string Value { get; }
Source
Gets the opaque identifier value.
Describes one idempotent durable Flow start.
DurableScopeId ScopeId { get; }
Source
Gets the trusted owning scope.
DurableCommandId CommandId { get; }
Source
Gets the idempotent command identifier.
string IdempotencyKey { get; }
Source
Gets the caller retry key.
DurableFlowInstanceId InstanceId { get; }
Source
Gets the requested Flow instance identifier.
string FlowId { get; }
Source
Gets the registered Flow definition identifier.
string FlowVersion { get; }
Source
Gets the immutable Flow definition version.
DurableEncodedPayload Context { get; }
Source
Gets the encoded initial context.
DurableCommandFingerprint Fingerprint { get; }
Source
Gets the computed semantic command fingerprint.
Delivers one authorized external event only to an active matching wait.
DurableScopeId ScopeId { get; }
Source
Gets the trusted owning scope.
DurableCommandId CommandId { get; }
Source
Gets the command identifier used for transport deduplication.
DurableFlowEventId EventId { get; }
Source
Gets the single-use event identifier.
DurableFlowInstanceId InstanceId { get; }
Source
Gets the target Flow instance.
string EventName { get; }
Source
Gets the exact case-sensitive wait event name.
DurableEncodedPayload? Payload { get; }
Source
Gets the optional allowlisted event payload.
long? ExpectedRevision { get; }
Source
Gets an optional optimistic Flow revision.
DurableCommandFingerprint Fingerprint { get; }
Source
Gets the computed semantic command fingerprint.
Requests cooperative cancellation of a durable Flow instance.
DurableScopeId ScopeId { get; }
Source
Gets the trusted owning scope.
DurableCommandId CommandId { get; }
Source
Gets the command identifier.
DurableFlowInstanceId InstanceId { get; }
Source
Gets the target Flow instance.
string ActorId { get; }
Source
Gets the privacy-safe authorized actor identifier recorded for audit.
string ReasonCode { get; }
Source
Gets the privacy-safe cancellation reason code.
long ExpectedRevision { get; }
Source
Gets the required optimistic Flow revision.
DurableCommandFingerprint Fingerprint { get; }
Source
Gets the computed semantic command fingerprint.
Requests an audited release of a recoverably suspended Flow, or direct adoption of an exact-revision dormant Flow from an older runtime epoch, after an operator has verified runtime compatibility or resolved ambiguous child-work truth.
Direct epoch adoption retains the instance's prior nonterminal state and active wait shape. It does not adopt an evaluating, terminal, or current-epoch non-suspended instance, and it never bypasses manifest compatibility.
DurableScopeId ScopeId { get; }
Source
Gets the trusted owning scope.
DurableCommandId CommandId { get; }
Source
Gets the idempotent operator command identifier.
DurableFlowInstanceId InstanceId { get; }
Source
Gets the target Flow instance.
string ActorId { get; }
Source
Gets the privacy-safe authorized operator identifier recorded for audit.
string ReasonCode { get; }
Source
Gets the privacy-safe release reason recorded for audit.
long ExpectedRevision { get; }
Source
Gets the required Flow revision.
DurableCommandFingerprint Fingerprint { get; }
Source
Gets the computed semantic command fingerprint.
Requests a payload-free snapshot of one Flow in an application-authorized scope.
DurableScopeId ScopeId { get; }
Source
Gets the trusted owning scope.
DurableFlowInstanceId InstanceId { get; }
Source
Gets the target Flow instance.
Requests one bounded, authorized page of payload-free Flow snapshots.
The optional recovery filter identifies dormant nonterminal instances whose persisted runtime epoch differs from the active client epoch. It is an inventory aid, not proof that manifest, state-shape, or external-effect recovery checks will permit release.
DurableScopeId ScopeId { get; }
Source
Gets the trusted owning scope.
DurableFlowState? State { get; }
Source
Gets the optional lifecycle-state filter.
bool? RequiresRecoveryRelease { get; }
Source
Gets the optional old-epoch recovery filter.
int PageSize { get; }
Source
Gets the maximum snapshots returned by this page.
string? ContinuationToken { get; }
Source
Gets the opaque continuation token of at most 512 characters, or null
for the first page.
Represents one bounded page of payload-free Flow snapshots.
IReadOnlyList<DurableFlowSnapshot> Flows { get; }
Source
Gets the immutable page of Flow snapshots.
string? ContinuationToken { get; }
Source
Gets the next opaque continuation token of at most 512 characters, or null
on the final page.
Provides payload-free durable Flow state suitable for status pages, optimistic commands, and operator recovery.
DurableFlowInstanceId InstanceId { get; }
Source
Gets the Flow instance identifier.
string FlowId { get; }
Source
Gets the immutable Flow definition identifier.
string FlowVersion { get; }
Source
Gets the immutable Flow definition version.
DurableFlowState State { get; }
Source
Gets the authoritative lifecycle state.
string CurrentNodeId { get; }
Source
Gets the current stable node identifier.
long Revision { get; }
Source
Gets the aggregate revision required by optimistic commands.
DateTimeOffset CreatedAtUtc { get; }
Source
Gets when the Flow was accepted.
DateTimeOffset UpdatedAtUtc { get; }
Source
Gets when the Flow aggregate last changed.
DateTimeOffset? CancellationRequestedAtUtc { get; }
Source
Gets when cancellation was first requested, if applicable.
DateTimeOffset? TerminalAtUtc { get; }
Source
Gets when a terminal state was reached, if applicable.
string? TerminalCode { get; }
Source
Gets the privacy-safe terminal or suspension code, if present.
bool RequiresRecoveryRelease { get; }
Source
Gets whether this dormant nonterminal instance belongs to an older runtime epoch and requires an audited recovery release before the active runtime may continue it.
This inventory flag does not prove manifest compatibility, wait-shape validity, or resolved external-effect truth. Evaluating and terminal rows are false because they are not directly releasable dormant instances.
Records the stable outcome of a durable Flow command.
DurableFlowInstanceId InstanceId { get; }
Source
Gets the Flow instance.
DurableFlowCommandOutcome Outcome { get; }
Source
Gets the command outcome.
DurableFlowState State { get; }
Source
Gets the resulting authoritative state.
long Revision { get; }
Source
Gets the resulting aggregate revision.
Starts, resumes, and cancels durable Flow instances through application-authorized calls.
ValueTask<DurableOperationResult<DurableFlowSnapshot>> GetAsync(DurableFlowGetRequest request, CancellationToken cancellationToken = default)
Reads a payload-free snapshot from the authorized scope.
ValueTask<DurableOperationResult<DurableFlowListResult>> ListAsync(DurableFlowListRequest request, CancellationToken cancellationToken = default)
Lists one bounded, authorized page of payload-free Flow snapshots, optionally filtered by lifecycle state and old-epoch recovery requirement.
ValueTask<DurableOperationResult<DurableFlowCommandResult>> StartAsync(DurableFlowStartRequest request, CancellationToken cancellationToken = default)
Accepts an idempotent Flow start.
ValueTask<DurableOperationResult<DurableFlowCommandResult>> RaiseEventAsync(DurableFlowEventRequest request, CancellationToken cancellationToken = default)
Delivers an authorized event to an active matching wait.
V1 does not buffer early events. DurableFlowCommandOutcome.NotWaitingYet
means the event id was not consumed and the caller may retry after observing the wait.
ValueTask<DurableOperationResult<DurableFlowCommandResult>> CancelAsync(DurableFlowCancelRequest request, CancellationToken cancellationToken = default)
Requests cooperative cancellation at an expected revision.
ValueTask<DurableOperationResult<DurableFlowCommandResult>> ReleaseSuspensionAsync(DurableFlowReleaseRequest request, CancellationToken cancellationToken = default)
Releases a recoverable suspension or directly adopts a dormant nonterminal Flow from an older runtime epoch, only after exact runtime-manifest, optimistic-revision, and persisted-state-shape validation. Authorization remains application-owned.
A direct epoch release preserves the prior ready, event-wait, timer-wait, activity-wait, or cancel-pending state. A terminal result is reported without mutation; incompatible manifests and unsafe state shapes fail.
Captures validated codec facts separately from caller-owned executable behavior.
Capture reads each metadata getter once. Views never poll or dispose the source; callers own its concurrency safety.
IDurablePayloadCodec CreateView()
Creates an independent guarded projection without rereading metadata.
DurablePayloadCodecSnapshot Capture(IDurablePayloadCodec codec)
Captures an untyped raw source or reuses a package-owned view's original snapshot.
DurablePayloadCodecSnapshot Capture<T>(IDurablePayloadCodec<T> codec, string parameterName = "codec")
Captures a typed source and verifies its declared CLR type independently of its contract namespace.
codec
parameterName
DurablePayloadCodecSnapshot? GetSnapshot(IDurablePayloadCodec codec)
Retrieves provenance only from an unforgeable package implementation.
bool AreCompatible(IDurablePayloadCodec expected, IDurablePayloadCodec actual)
Accepts exact references or package projections of the same source and complete captured facts.
IDurablePayloadCodec RetainGuardedView(IDurablePayloadCodec expected, IDurablePayloadCodec selected)
Retains captured guards when a compatible registry selects the original raw source.
Call after compatibility validation. A selected package view remains authoritative; otherwise an expected view invokes that same selected source without rereading metadata or changing registration state.
DurableEncodedPayload RequireEncodedPayload(DurableEncodedPayload? payload)
Distinguishes a missing codec output from an invalid supplied payload.
DurableEncodedPayload RequirePayload(DurableEncodedPayload? payload)
Rejects incompatible payloads before decode and after encode without changing bytes or exposing values.
IDurablePayloadCodec Source { get; }
Source
Gets the exact caller-owned source; metadata equality never substitutes for this identity.
Metadata Facts { get; }
Source
Gets the facts captured once from the source.
Complete immutable facts used for identity, indexing and payload guards.
Untyped projection used by registry-only sources and untyped provider boundaries.
Typed projection preserving the source's typed invocation boundary and payload guards.
A closed codec contribution; frozen projections are required only for definition-based public paths.
Represents one validated, versioned W3C context that can become durable causal evidence.
TraceParent
00
W3C parent persisted only as a propagation input.TraceId
TraceParent
.SpanId
TraceParent
.TraceFlags
TraceParent
.TraceState
null
when it was absent or rejected.CorrelationToken
The type is internal to the Durable package family. It deliberately contains no baggage, authorization, scope, or payload metadata. Its raw W3C members are persistence and propagation inputs only; instrumentation must not tag or log them.
ActivityContext ToActivityContext()
Creates the remote W3C context used exclusively for a causal ActivityLink
.
The recorded bit is retained, all reserved trace-flag bits are ignored, and the normalized opaque state is propagated without becoming a telemetry tag.
DurableTraceContextCapture CaptureCurrent()
Captures the current W3C activity as ambient durable context.
An absent capture when no valid W3C activity is current; otherwise an ambient capture with a new correlation token.
DurableTraceContextCapture Capture(Activity? activity)
Captures a sampled activity as ambient durable context.
activity
An absent capture for a missing or non-W3C activity; otherwise a validated ambient capture.
DurableTraceContextCapture Parse(string? traceParent, string? traceState, DurableTraceContextStatus validStatus = DurableTraceContextStatus.Linked)
Parses persisted or ambient W3C members into a bounded durable capture.
An invalid parent returns DurableTraceContextStatus.Invalid
with ASDUR212
and drops both values. A valid parent with rejected state retains the parent, drops the state, and returns ASDUR213
. Every retained context receives a new runtime-generated correlation token.
DurableTraceContextCapture CaptureExecution(Activity? activity, DurableTraceContextCapture committedCause)
Captures a fresh execution activity while retaining the committed cause's value-free status.
A listener-created execution activity has a fresh W3C context and is therefore ambient when captured directly. Durable telemetry instead reports the status of the committed trigger ( linked
, absent
, or invalid
) while persisting the fresh execution context. A missing activity preserves the supplied capture.
Returns a context with a value-free status and optional diagnostic code.
Strongly typed result from a provider reconciliation read.
TResult
DurableEffectReconciliation<TResult> Applied(TResult result)
Creates an applied result with terminal provider truth.
DurableEffectReconciliation<TResult> NotApplied()
Creates a result proving that the external effect did not occur.
DurableEffectReconciliation<TResult> Unknown()
Creates a result that leaves the external effect ambiguous.
DurableEffectReconciliationKind Kind { get; }
Source
Gets the proven provider state.
TResult? Result { get; }
Source
Gets the terminal result when Kind
is DurableEffectReconciliationKind.Applied
.
Performs a side-effect-free provider read after an allowed effect has an unknown outcome.
TWork
TResult
Reconciliation must never repeat the provider mutation. It queries provider state using the immutable provider key and returns what can be proven. Returning DurableEffectReconciliationKind.Unknown
keeps work suspended.
ValueTask<DurableEffectReconciliation<TResult>> ReconcileAsync(DurableWorkerEnvelope<TWork> work, CancellationToken cancellationToken = default)
Reads provider state for the original activity-derived provider key.
Encoded reconciliation result used by the runtime store boundary.
DurableEffectReconciliationKind Kind { get; }
Source
Gets the proven provider state.
DurableEncodedPayload? Result { get; }
Source
Gets the encoded terminal result for an applied effect.
Validates the bounded W3C fields accepted by the durable trace contract.
Carries an immutable, versioned, allowlisted payload ready for durable persistence.
bool Equals(DurableEncodedPayload? other)
Compares payload metadata and canonical content bytes by value.
other
true
when metadata and content bytes are equal.
string ContractName { get; }
Source
Gets the stable registered contract name.
string ContractVersion { get; }
Source
Gets the stable registered contract version.
DurableDataClassification Classification { get; }
Source
Gets the approved durable-data classification.
string RetentionPolicyId { get; }
Source
Gets the stable retention policy identity snapshotted by the registered codec.
ReadOnlyMemory<byte> Content { get; }
Source
Gets a copy-safe view of the canonical encoded bytes.
string Sha256 { get; }
Source
Gets the lowercase SHA-256 hash of the exact encoded bytes.
Encodes and decodes one registered durable payload contract without runtime type-name serialization.
DurableEncodedPayload EncodeObject(object value)
Encodes a value after applying its registration-time data policy.
object DecodeObject(DurableEncodedPayload payload)
Decodes bytes only when their contract identity exactly matches this codec.
Type PayloadType { get; }
Source
Gets the supported CLR payload type.
string ContractName { get; }
Source
Gets the stable contract name.
string ContractVersion { get; }
Source
Gets the stable contract version.
DurableDataClassification Classification { get; }
Source
Gets the exact classification this codec accepts and emits.
string RetentionPolicyId { get; }
Source
Gets the stable application-owned retention policy identity this codec accepts and emits.
Strongly typed durable payload codec.
T
DurableEncodedPayload Encode(T value)
Encodes a typed payload.
T Decode(DurableEncodedPayload payload)
Decodes a typed payload.
Source-generation-friendly JSON codec for an explicitly registered payload type.
T
DurableDataClassification Classification { get; }
Source
Gets the approved data classification.
Resolves only explicitly registered durable payload codecs.
void Register(IDurablePayloadCodec codec)
Registers one codec by CLR type and durable contract identity.
IDurablePayloadCodec GetRequired(Type payloadType)
Gets the required codec for a CLR type.
IDurablePayloadCodec GetRequired(Type payloadType, string contractName, string contractVersion)
Gets a required codec for an exact CLR type and persisted contract identity.
IDurablePayloadCodec GetRequired(string contractName, string contractVersion)
Gets the required codec for persisted contract identity.
Thread-safe in-memory registry for explicitly allowlisted durable payload codecs.
void Register(IDurablePayloadCodec codec)
Equivalent raw/view registrations are idempotent. A frozen view upgrades a raw entry without downgrades; references returned before a manual upgrade remain caller-owned references.
void AddEntry(Entry entry)
Populates both indexes with one validated entry; caller holds the lock or owns an unpublished registry.
Entry GetEntry(string contractName, string contractVersion)
Resolves by validated identifiers using captured metadata; caller holds the registry lock.
One entry is shared by all indexes; an upgrade publishes its canonical view atomically under the registry lock.
void Upgrade(DurablePayloadCodecSnapshot incoming)
Creates before publishing so a failed upgrade leaves every index unchanged.
Binds an ordinary executor to a definition without resolving services or executing code.
TWork
TResult
TExecutor
DurableReconciledWorkBinding<TWork, TResult, TExecutor, TReconciler> ReconciledBy<TReconciler>()
Completes a reconcile-before-retry binding with its side-effect-free reconciler.
TReconciler
A complete immutable binding.
InvalidOperationException
DurableWorkDefinition<TWork, TResult> Definition { get; }
Source
Gets the exact definition owning this binding's facts.
Complete reconcile-before-retry binding; no repeated contract facts or mutable options.
TWork
TResult
TExecutor
TReconciler
DurableWorkDefinition<TWork, TResult> Definition { get; }
Source
Gets the exact definition owning this binding's facts.
Complete ProviderKeyed exit binding; reconciliation is deliberately unavailable.
TWork
TResult
TExecutor
DurableWorkDefinition<TWork, TResult> Definition { get; }
Source
Gets the exact definition owning this binding's facts.
Registration helpers for typed durable worker executors.
IServiceCollection AddDurableWork<TWork, TResult, TExecutor>(this IServiceCollection services, DurableWorkBinding<TWork, TResult, TExecutor> binding)
Registers exact definition/binding singleton values and a transient ordinary executor.
TWork
TResult
TExecutor
services
binding
The same service collection.
ArgumentNullException
InvalidOperationException
Validation precedes descriptor changes. Duplicate Work identities fail when default registries resolve.
IServiceCollection AddDurableWork<TWork, TResult, TExecutor, TReconciler>(this IServiceCollection services, DurableReconciledWorkBinding<TWork, TResult, TExecutor, TReconciler> binding)
Registers exact contract values and transient executor/reconciler implementations.
TWork
TResult
TExecutor
TReconciler
services
binding
The same service collection.
ArgumentNullException
IServiceCollection AddDurableWork<TWork, TResult, TExecutor>(this IServiceCollection services, DurableExitWorkBinding<TWork, TResult, TExecutor> binding)
Registers exact contract values and a transient ProviderKeyed exit-aware executor.
TWork
TResult
TExecutor
services
binding
The same service collection.
ArgumentNullException
Deploy exit-capable workers before using new exit-aware Work versions; historical executor semantics remain immutable.
IServiceCollection AddDurableWork<TWork, TResult, TExecutor>(this IServiceCollection services, string workName, string workVersion, DurableProviderSafety providerSafety, IDurablePayloadCodec<TWork> workCodec, IDurablePayloadCodec<TResult> resultCodec)
Registers one versioned work contract, its allowlisted codecs, and its transient executor.
services
workName
workVersion
providerSafety
workCodec
resultCodec
The same service collection.
ArgumentException
ArgumentNullException
IServiceCollection AddDurableWorkExit<TWork, TResult, TExecutor>(this IServiceCollection services, string workName, string workVersion, IDurablePayloadCodec<TWork> workCodec, IDurablePayloadCodec<TResult> resultCodec)
Registers one immutable Work contract whose executor returns an explicit provider-effect exit.
TWork
TResult
TExecutor
services
workName
workVersion
workCodec
resultCodec
The same service collection.
ArgumentException
ArgumentNullException
V1 intentionally fixes this registration to DurableProviderSafety.ProviderKeyed
. Register a new immutable Work version only after every eligible worker uses a provider that calls DurablePreparedWork.InvokeExitAsync(CancellationToken)
; do not convert an accepted Work version in place. Keep the legacy AddDurableWork{TWork,TResult,TExecutor}(IServiceCollection,string,string,DurableProviderSafety,IDurablePayloadCodec{TWork},IDurablePayloadCodec{TResult})
contract when an executor cannot prove one of the four exit facts.
IServiceCollection AddDurableWorkWithReconciler<TWork, TResult, TExecutor, TReconciler>(this IServiceCollection services, string workName, string workVersion, IDurablePayloadCodec<TWork> workCodec, IDurablePayloadCodec<TResult> resultCodec)
Registers provider work that must reconcile an unknown effect before any retry.
services
workName
workVersion
workCodec
resultCodec
The same service collection.
ArgumentException
ArgumentNullException
Use this overload for DurableProviderSafety.ReconcileBeforeRetry
so unknown effects are reconciled before retry.
IServiceCollection AddDurableFlow<TContext>(this IServiceCollection services, ForgeTrust.AppSurface.Flow.FlowDefinition<TContext> definition, IDurablePayloadCodec<TContext> contextCodec, string implementationVersion, IEnumerable<DurableFlowActivityBinding<TContext>>? activityBindings = null, IEnumerable<DurableFlowEventBinding>? eventBindings = null, ForgeTrust.AppSurface.Flow.IFlowTransitionEvaluator<TContext>? evaluator = null)
Registers one immutable Flow definition, its approved context codec, and its durable activity bindings.
TContext
services
definition
contextCodec
implementationVersion
activityBindings
eventBindings
evaluator
The same service collection.
Owns the fixed, value-free vocabulary emitted by durable trace instrumentation.
void Apply(Activity? activity, string executionKind, string triggerKind, string flowState, string outcome, Guid correlationToken, DurableTraceContextStatus contextStatus)
Applies the fixed, value-free Durable trace tag vocabulary to an active execution activity.
A null
activity
is a no-op because no listener requested an activity. The emitted keys are ContractVersion
, ExecutionKind
, TriggerKind
, FlowState
, Outcome
, ContextStatus
, and, only when available, CorrelationToken
. contextStatus
is a DurableTraceContextStatus
value from validated durable trace capture; header values, baggage, and tenant data are never emitted.
Stable diagnostic codes shared by durable results, logs, metrics, operator history, and documentation.
Codes are append-only compatibility identifiers. Never renumber or reuse a code for a different condition.
Materializes and validates local Work values before any codec enumeration can mask duplicate Work.
IReadOnlyDictionary<(string Name, string Version), DurableWorkRegistration> Registrations { get; }
Source
Gets exact immutable registration values indexed by Work identity.
IReadOnlyList<DurableWorkContractIdentity> Contracts { get; }
Source
Gets sorted public discovery identities.
Installs acyclic passive defaults without replacing or reordering consumer descriptors.
void AddDefaults(IServiceCollection services)
Uses TryAdd for each default so module/Work/Flow ordering preserves consumer overrides.
Creates immutable typed Work contracts without activating storage or execution.
DurableWorkDefinition<TWork, TResult> Define<TWork, TResult>(string workName, string workVersion, IDurablePayloadCodec<TWork> workCodec, IDurablePayloadCodec<TResult> resultCodec, DurableProviderSafety providerSafety, DurableWorkRetryPolicy defaultRetryPolicy)
Defines Work identity, codec facts, provider safety and an explicit default retry policy once.
TWork
TResult
workName
workVersion
workCodec
resultCodec
providerSafety
defaultRetryPolicy
DurableWorkRetryPolicy.Default
for ordinary policy.A passive definition with stable guarded codec views.
ArgumentNullException
ArgumentException
ArgumentOutOfRangeException
InvalidOperationException
Metadata is captured once per source. Custom getter exceptions propagate; no serializer or executor runs.
Owns immutable Work contract facts and builds equivalent ordinary durable requests.
TWork
TResult
Safe to reuse statically when custom codecs and their dependencies support concurrent calls. Frozen metadata does not freeze application behavior. Changing defaults affects future requests only; accepted Work retains its facts.
DurableWorkRequest CreateRequest(DurableScopeId scopeId, DurableCommandId commandId, string idempotencyKey, TWork work, DurableWorkRetryPolicy? retryPolicy = null, DateTimeOffset? dueAtUtc = null)
Validates caller choices, encodes input once and creates the existing immutable request.
scopeId
commandId
idempotencyKey
work
retryPolicy
dueAtUtc
A request with the same fields and fingerprint as equivalent direct construction.
ArgumentException
ArgumentNullException
InvalidOperationException
All caller identity checks precede encoding. Codec exceptions propagate. No registration or storage is required.
DurableWorkBinding<TWork, TResult, TExecutor> ExecutedBy<TExecutor>()
Binds an ordinary transient executor; reconcile-before-retry still requires a reconciler before registration.
TExecutor
A passive binding referencing this exact definition.
DurableExitWorkBinding<TWork, TResult, TExecutor> ExecutedByExit<TExecutor>()
Binds an exit-aware transient executor for ProviderKeyed Work.
TExecutor
A complete passive exit binding.
InvalidOperationException
DurableWorkContractSnapshot<TWork, TResult> Snapshot { get; }
Source
Gets the authoritative internal contract; binding and registration never reconstruct it.
string WorkName { get; }
Source
Gets the stable Work name.
string WorkVersion { get; }
Source
Gets the immutable Work version.
DurableWorkContractIdentity ContractIdentity { get; }
Source
Gets the exact Work registry identity.
IDurablePayloadCodec<TWork> WorkCodec { get; }
Source
Gets the definition-owned guarded input codec with captured metadata.
IDurablePayloadCodec<TResult> ResultCodec { get; }
Source
Gets the definition-owned guarded successful result codec with captured metadata.
DurableProviderSafety ProviderSafety { get; }
Source
Gets the declared provider-effect ambiguity policy.
DurableWorkRetryPolicy DefaultRetryPolicy { get; }
Source
Gets the explicit retry policy used when a request omits an override.
Shared closed Work facts used by all built-in registrations and definitions.
DurableWorkContractIdentity Validate(string workName, string workVersion, DurableProviderSafety providerSafety, DurableWorkRetryPolicy defaultRetryPolicy)
Validates common facts without invoking consumer codec behavior.
DurableWorkContractSnapshot Capture(string name, string version, DurableProviderSafety safety, IDurablePayloadCodec workCodec, IDurablePayloadCodec resultCodec)
Closes external subclasses of the legacy abstract registration without exposing a new public seam.
(DurablePayloadCodecSnapshot Work, DurablePayloadCodecSnapshot Result) CaptureCodecs<TWorkCodec, TResultCodec>(TWorkCodec workCodec, TResultCodec resultCodec, Func<TWorkCodec, DurablePayloadCodecSnapshot> captureWork, Func<TResultCodec, DurablePayloadCodecSnapshot> captureResult)
Captures each distinct source once, reuses supplied views and rejects conflicting facts for one source.
Capture delegates preserve typed invocation when closing generic contracts and untyped legacy subclasses.
DurableWorkContractIdentity Identity { get; }
Source
Exact validated Work name/version.
DurableProviderSafety ProviderSafety { get; }
Source
Declared provider-effect ambiguity policy.
DurableWorkRetryPolicy DefaultRetryPolicy { get; }
Source
Request construction default, never a replacement for accepted policy.
DurablePayloadCodecSnapshot Work { get; }
Source
Captured input source and metadata.
DurablePayloadCodecSnapshot Result { get; }
Source
Captured successful-result source and metadata.
Typed projection of the shared contract; views are created once and never recapture metadata.
DurableWorkContractSnapshot<TWork, TResult> Create(string name, string version, DurableProviderSafety safety, IDurablePayloadCodec<TWork> workCodec, IDurablePayloadCodec<TResult> resultCodec, DurableWorkRetryPolicy retry)
Captures each unique source once, with independent exact generic-type checks.
IDurablePayloadCodec<TWork> WorkView { get; }
Source
Stable typed input projection used by definition and invocation.
IDurablePayloadCodec<TResult> ResultView { get; }
Source
Stable typed result projection used by definition and invocation.
Registers host-neutral durable contracts and registries without starting storage or workers.
Add a provider module to select storage and explicitly opt into hosted execution. This module alone performs no network access, schema creation, polling, scheduling, or provider work.
Identity pair for one durable work contract.
bool IsDefault { get; }
Source
Gets whether this value is the default struct value.
string WorkName { get; }
Source
Gets the work contract name.
string WorkVersion { get; }
Source
Gets the work contract version.
Provides privacy-safe, actionable details for a failed durable operation.
string Code { get; }
Source
Gets the stable machine-readable code.
string Problem { get; }
Source
Gets the safe problem description.
string Cause { get; }
Source
Gets the safe cause description.
string Fix { get; }
Source
Gets the safe corrective guidance.
Uri DocumentationUrl { get; }
Source
Gets the canonical documentation URL.
string CorrelationId { get; }
Source
Gets the opaque correlation identifier.
Represents either a successful durable operation value or an actionable problem.
T
DurableOperationResult<T> Success(T value)
Creates a successful result.
DurableOperationResult<T> Failure(DurableProblem problem)
Creates a failed result.
bool IsSuccess { get; }
Source
Gets whether the operation succeeded.
T? Value { get; }
Source
Gets the successful value, or null
when the operation failed.
DurableProblem? Problem { get; }
Source
Gets the problem, or null
when the operation succeeded.
Reports whether two evaluations of the same persisted Flow input produced byte-for-byte equivalent durable decisions.
string FirstEvaluationSha256 { get; }
Source
Gets the canonical SHA-256 fingerprint of the first evaluation.
string SecondEvaluationSha256 { get; }
Source
Gets the canonical SHA-256 fingerprint of the second evaluation.
bool IsDeterministic { get; }
Source
Gets whether both evaluations produced the same durable decision.
Test harness that evaluates one durable Flow input twice and compares canonical transition bytes.
Use this in definition tests and deployment validation. It deliberately executes node code twice, so do not place external effects in nodes and do not use this helper as the production transition commit path. A passing sample proves only that the supplied input was stable; source-generator determinism warnings and explicit persisted inputs remain necessary for other branches.
ValueTask<DurableFlowDeterminismReport> VerifyAsync(DurableFlowRegistration registration, DurableFlowEvaluationInput input, IDurablePayloadCodecRegistry payloadCodecs, CancellationToken cancellationToken = default)
Evaluates the same registered input twice and returns canonical decision fingerprints.
registration
input
payloadCodecs
cancellationToken
A report whose DurableFlowDeterminismReport.IsDeterministic
value compares both runs.
ValueTask<DurableFlowDeterminismReport> VerifyAndThrowAsync(DurableFlowRegistration registration, DurableFlowEvaluationInput input, IDurablePayloadCodecRegistry payloadCodecs, CancellationToken cancellationToken = default)
Evaluates the same registered input twice and throws when the canonical decisions differ.
registration
input
payloadCodecs
cancellationToken
The deterministic comparison report.
InvalidOperationException
Carries one validated work item across the provider-to-application executor boundary.
A provider creates this context only after validating its claim and execution fence. It is not an authorization token by itself; a provider must record an effect permit against the same identity immediately before provider I/O.
DurableScopeId ScopeId { get; }
Source
Gets the trusted owning scope.
DurableWorkId WorkId { get; }
Source
Gets the immutable work aggregate identifier.
string WorkName { get; }
Source
Gets the registered work name.
string WorkVersion { get; }
Source
Gets the registered work version.
DurableEncodedPayload Payload { get; }
Source
Gets the encoded work payload.
DurableProviderSafety ProviderSafety { get; }
Source
Gets the provider ambiguity policy snapshot.
DurableWorkerExecutionIdentity ExecutionIdentity { get; }
Source
Gets the provider-validated execution identity and authorization fence.
Represents a locally validated work invocation that is ready for the runtime to record an external-effect permit.
Preparation decodes the registered payload and resolves the executor before any permit exists. Calling InvokeAsync
is the provider-effect boundary and must happen only after the matching permit commits.
ValueTask<DurableEncodedPayload> InvokeAsync(CancellationToken cancellationToken = default)
Executes the already prepared provider work and returns its encoded terminal result.
cancellationToken
The registered codec's encoded terminal result.
Call only after the matching external-effect permit commits.
ValueTask<DurableEncodedWorkExit> InvokeExitAsync(CancellationToken cancellationToken = default)
Executes prepared work and returns its encoded exit fact.
cancellationToken
The registered codec's encoded success result wrapped as an exit fact.
This compatibility implementation preserves legacy prepared Work behavior by calling InvokeAsync(CancellationToken)
and wrapping its result as DurableWorkExitKind.Succeeded
. Exit-aware registrations override it to return their explicit fact. Call only after the matching external-effect permit commits.
Describes and invokes one registered durable work contract without reflection.
DurablePreparedWork Prepare(IServiceProvider services, DurableWorkExecutionContext work)
Decodes and validates claimed bytes and resolves local executor dependencies without calling a provider.
services
work
A prepared invocation that performs no provider I/O until invoked.
ValueTask<DurableEncodedPayload> InvokeAsync(IServiceProvider services, DurableWorkExecutionContext work, CancellationToken cancellationToken = default)
Invokes the registered executor and encodes its terminal business result.
services
work
cancellationToken
The registered codec's encoded terminal result.
Runtime code must persist an effect permit before calling this method. Exceptions after that permit represent a potentially applied external effect and must be handled according to ProviderSafety
.
ValueTask<DurableEncodedEffectReconciliation> ReconcileAsync(IServiceProvider services, DurableWorkExecutionContext work, CancellationToken cancellationToken = default)
Reconciles an unknown provider outcome without repeating the external mutation.
services
work
cancellationToken
Applied, not-applied, or unknown provider truth.
InvalidOperationException
DurableWorkContractSnapshot Snapshot { get; }
Source
Gets the closed facts used by provider-local registry aggregation.
bool RequiresFrozenView { get; }
Source
Gets whether the public registration path requires frozen codec projections.
string WorkName { get; }
Source
Gets the stable work name.
string WorkVersion { get; }
Source
Gets the stable work contract version.
DurableProviderSafety ProviderSafety { get; }
Source
Gets the declared provider ambiguity policy.
IDurablePayloadCodec WorkCodec { get; }
Source
Gets the work payload codec.
IDurablePayloadCodec ResultCodec { get; }
Source
Gets the result payload codec.
bool CanReconcile { get; }
Source
Gets whether a side-effect-free reconciler is registered.
Reflection-free registration for one typed durable worker executor.
TWork
TResult
TExecutor
Reflection-free registration for one typed executor that returns an explicit durable Work exit.
TWork
TResult
TExecutor
ValueTask<DurableEncodedPayload> InvokeAsync(IServiceProvider services, DurableWorkExecutionContext work, CancellationToken cancellationToken = default)
Invokes the exit-aware executor through the legacy success-only provider boundary.
DurableWorkExitCompatibilityException
Providers that support typed exits must invoke DurablePreparedWork.InvokeExitAsync(CancellationToken)
through the provider invocation boundary instead. This compatibility member returns an encoded result only for DurableWorkExitKind.Succeeded
; every non-success exit throws DurableWorkExitCompatibilityException
so a legacy provider follows its conservative ambiguous external-outcome path after the effect permit.
Resolves durable work registrations by their stable name and version.
DurableWorkRegistration GetRequired(string workName, string workVersion)
Gets a required registration or throws before work is accepted or claimed.
workName
workVersion
The matching registration.
ArgumentException
InvalidOperationException
IReadOnlyList<DurableWorkContractIdentity> RegisteredContracts { get; }
Source
Gets all registered work contracts, or throws if unavailable.
NotSupportedException
A custom registry used with the PostgreSQL worker host must return one complete, exact, stable snapshot. The provider normalizes its order while forming the activation-time snapshot and does not reread later mutations, so restart the host to change discovery authority. A registry that cannot enumerate its registrations is valid for other consumers but cannot activate PostgreSQL Work discovery.
Immutable registry of durable work registrations built during host startup.
Represents the fact returned by an IDurableWorkExitExecutor{TWork,TResult}
.
TResult
Only Succeeded(TResult)
carries a result. The other factories require a bounded, identifier-safe application code and do not provide a result. An executor must return RetryBeforeEffect(string)
only when it can prove the failure happened before a provider mutation. Read-only provider I/O is allowed; this boundary is about the provider effect, not the Durable effect permit.
DurableWorkExit<TResult> Succeeded(TResult result)
Creates a successful exit with a terminal result.
result
A successful exit.
ArgumentNullException
result
is null.DurableWorkExit<TResult> RetryBeforeEffect(string code)
Creates an exit that proves the executor did not begin a provider mutation.
code
A no-effect retry fact for the provider to evaluate.
This does not mean a Durable effect permit was absent. It asserts only that the executor did not begin an external provider mutation; read-only provider I/O is allowed. The provider still decides whether the fact is current and retryable.
DurableWorkExit<TResult> FailedTerminal(string code)
Creates an exit for a terminal local executor outcome.
code
A terminal-failure fact for the provider to evaluate.
DurableWorkExit<TResult> AmbiguousExternalOutcome(string code)
Creates an exit for an outcome whose external provider effect may be unknown.
code
An ambiguous-outcome fact for the provider to evaluate.
DurableWorkExitKind Kind { get; }
Source
Gets the fact that the executor returned.
string? Code { get; }
Source
Gets the safe application code for a non-success exit, or null
for success.
TResult? Result { get; }
Source
Gets the successful result, or null
for a non-success exit.
Carries the encoded form of a DurableWorkExit{TResult}
across the provider boundary.
This type exposes no public constructor so providers cannot invent an arbitrary result/code combination. Its result is present only for DurableWorkExitKind.Succeeded
, and its code is present only for a non-success exit.
DurableWorkExitKind Kind { get; }
Source
Gets the fact returned by the executor.
string? Code { get; }
Source
Gets the safe application code for a non-success exit, or null
for success.
DurableEncodedPayload? Result { get; }
Source
Gets the encoded successful result, or null
for a non-success exit.
Executes one opt-in durable Work and returns an explicit provider-effect fact.
TWork
TResult
Use this contract only when the executor can honestly return one of the four defined facts. Use IDurableWorkerExecutor{TWork,TResult}
for the established success-or-exception contract.
ValueTask<DurableWorkExit<TResult>> ExecuteAsync(DurableWorkerEnvelope<TWork> work, CancellationToken cancellationToken = default)
Executes the Work and returns its explicit exit fact.
work
cancellationToken
The executor fact for the provider to translate.
Indicates that exit-aware Work was invoked through a legacy success-only provider boundary.
The exception intentionally includes no result, application code, provider response, or nested exception. Its provider-facing handling remains the ordinary ambiguous-outcome path after a committed effect permit.
Creates durable runtime activities as new roots with an optional committed-cause link.
DurableTraceActivityScope StartRoot(string operationName, ActivityKind kind, DurableTraceContext? committedCause)
Starts a short-lived unparented durable execution with an optional committed-cause link.
The returned scope must be disposed to end the Activity. If a caller ambient Activity exists, creation and disposal run without that execution context so the durable execution remains a root and the caller remains unchanged. Activity-listener failures are relayed synchronously to the caller.
Owns a durable root activity and preserves any caller ambient activity when it is disposed.
When a caller has an ambient activity, .NET's ActivitySource
has no root-start overload that both bypasses that parent and preserves it for the caller. This scope therefore starts and disposes the Activity on a ThreadPool callback without the caller's execution context. Consumers can add the fixed durable telemetry tags through Activity
, but must dispose this scope rather than the exposed activity.
Activity? Activity { get; }
Source
Gets the short-lived root activity, or null
when no listener sampled it.
Identifies a durable schedule independently from work, Flow, command, and occurrence identities.
DurableScheduleId New()
string Value { get; }
Source
Gets the opaque identifier value.
Stable problem codes returned by durable schedule operations.
Requests creation of one durable schedule.
DurableScopeId ScopeId { get; }
Source
Gets the trusted owning scope.
DurableCommandId CommandId { get; }
Source
Gets the idempotent command identity.
string IdempotencyKey { get; }
Source
Gets the caller retry key, unique within the owning scope.
DurableScheduleId ScheduleId { get; }
Source
Gets the caller-selected schedule identity used for deterministic H
expansion.
DurableSchedule Schedule { get; }
Source
Gets the immutable timing and policy definition.
DurableScheduleTarget Target { get; }
Source
Gets the registered durable work or Flow target.
string? DisplayName { get; }
Source
Gets the optional privacy-safe operator label.
DurableCommandFingerprint Fingerprint { get; }
Source
Gets the computed semantic command fingerprint.
Requests replacement of a schedule definition and target under optimistic concurrency.
A successful update increments the schedule generation and invalidates undispatched occurrences from the prior generation. An already-running prior-generation target may finish and continues to occupy its concurrency slot.
DurableScopeId ScopeId { get; }
Source
Gets the trusted owning scope.
DurableCommandId CommandId { get; }
Source
Gets the idempotent command identity.
DurableScheduleId ScheduleId { get; }
Source
Gets the schedule identity.
long ExpectedRevision { get; }
Source
Gets the required authoritative revision.
DurableSchedule Schedule { get; }
Source
Gets the replacement timing and policy definition.
DurableScheduleTarget Target { get; }
Source
Gets the replacement registered target.
string? DisplayName { get; }
Source
Gets the replacement optional operator label.
DurableCommandFingerprint Fingerprint { get; }
Source
Gets the computed semantic command fingerprint.
Requests a pause, resume, or delete under optimistic concurrency.
DurableScheduleCommandKind Kind { get; }
Source
Gets the operation whose schema is encoded in the fingerprint.
DurableScopeId ScopeId { get; }
Source
Gets the trusted owning scope.
DurableCommandId CommandId { get; }
Source
Gets the idempotent command identity.
DurableScheduleId ScheduleId { get; }
Source
Gets the schedule identity.
string ActorId { get; }
Source
Gets the privacy-safe authorized actor identifier recorded in schedule history.
string ReasonCode { get; }
Source
Gets the privacy-safe reason code recorded in schedule history.
long ExpectedRevision { get; }
Source
Gets the required authoritative revision.
DurableCommandFingerprint Fingerprint { get; }
Source
Gets the computed operation-specific semantic command fingerprint.
Records the stable successful result of a schedule mutation.
DurableScheduleId ScheduleId { get; }
Source
Gets the schedule identity.
DurableCommandId CommandId { get; }
Source
Gets the accepted command identity.
DurableScheduleMutationCode Code { get; }
Source
Gets the stable successful outcome.
long Generation { get; }
Source
Gets the active definition generation.
long Revision { get; }
Source
Gets the authoritative aggregate revision.
DateTimeOffset CommittedAtUtc { get; }
Source
Gets the authoritative store commit timestamp in UTC.
Represents an authorized durable schedule query result.
DurableScheduleId ScheduleId { get; }
Source
Gets the schedule identity.
string? DisplayName { get; }
Source
Gets the optional privacy-safe operator label.
DurableScheduleState State { get; }
Source
Gets the authoritative lifecycle state.
long Generation { get; }
Source
Gets the active definition generation.
long Revision { get; }
Source
Gets the aggregate revision.
DurableSchedule Schedule { get; }
Source
Gets the immutable timing and policy definition.
DurableScheduleTargetSnapshot Target { get; }
Source
Gets the registered target.
DateTimeOffset? NextOccurrenceUtc { get; }
Source
Gets the next materialized or evaluated UTC occurrence.
Describes the exact registered target and encoded input persisted for a schedule generation.
Create and update use a typed DurableScheduleTarget
. Queries return this encoded snapshot because a durable schedule can be inspected without loading arbitrary CLR types; applications may resolve its registered codec when they need to decode the approved input.
DurableScheduleTargetKind Kind { get; }
Source
Gets whether this target starts registered durable work or a registered Flow.
string RegisteredName { get; }
Source
Gets the registered work name or Flow id.
string RegisteredVersion { get; }
Source
Gets the immutable work or Flow version.
DurableEncodedPayload Input { get; }
Source
Gets the allowlisted encoded work input or initial Flow context.
DurableProviderSafety? ProviderSafety { get; }
Source
Gets the snapshotted work-provider safety, or null
for Flow targets.
Requests a bounded authorized schedule listing.
DurableScopeId ScopeId { get; }
Source
Gets the trusted owning scope.
int PageSize { get; }
Source
Gets the maximum number of schedules to return.
string? ContinuationToken { get; }
Source
Gets the opaque continuation token, or null
for the first page.
DurableScheduleState? State { get; }
Source
Gets the optional authoritative lifecycle-state filter.
bool? RequiresRecoveryRelease { get; }
Source
Gets the optional old-epoch nonterminal recovery filter.
Represents one payload-free schedule inventory item.
DurableScheduleId ScheduleId { get; }
Source
Gets the opaque schedule identity.
string? DisplayName { get; }
Source
Gets the optional privacy-safe display label.
DurableScheduleState State { get; }
Source
Gets the authoritative lifecycle state.
long Generation { get; }
Source
Gets the active definition generation.
long Revision { get; }
Source
Gets the aggregate revision required by mutations.
DurableScheduleKind ScheduleKind { get; }
Source
Gets the timing definition kind without its expression or payload.
ScheduleOverlapPolicy OverlapPolicy { get; }
Source
Gets the immutable overlap policy.
ScheduleMisfirePolicy MisfirePolicy { get; }
Source
Gets the immutable misfire policy.
DurableScheduleTargetKind TargetKind { get; }
Source
Gets the registered target surface.
string TargetName { get; }
Source
Gets the registered target name.
string TargetVersion { get; }
Source
Gets the registered target version.
DurableProviderSafety? TargetProviderSafety { get; }
Source
Gets Work provider safety, or null
for a Flow target.
DateTimeOffset? NextOccurrenceUtc { get; }
Source
Gets the next nominal occurrence time.
bool RequiresRecoveryRelease { get; }
Source
Gets whether this nonterminal schedule belongs to an older runtime epoch.
Represents one bounded page of authorized payload-free schedule inventory items.
IReadOnlyList<DurableScheduleListItem> Schedules { get; }
Source
Gets the immutable page of payload-free schedule inventory items.
string? ContinuationToken { get; }
Source
Gets the next opaque continuation token to return unchanged in a subsequent DurableScheduleListRequest
, or null
when this is the last page.
Requests a side-effect-free preview of upcoming occurrences before or after persistence.
DurableScopeId ScopeId { get; }
Source
Gets the trusted owning scope.
DurableScheduleId ScheduleId { get; }
Source
Gets the schedule id used for deterministic H
expansion.
DurableSchedule Schedule { get; }
Source
Gets the definition to explain.
DateTimeOffset AnchorUtc { get; }
Source
Gets the preview anchor and acceptance-time approximation.
int OccurrenceCount { get; }
Source
Gets the maximum number of upcoming occurrences to return.
Describes a side-effect-free evaluated schedule in operationally useful terms.
Cron explanations form a discriminated union with Kind
: when the kind is DurableScheduleKind.Cron
, callers must supply CronDialect
, CronGrammar
, and IanaTimeZoneId
together. For every non-Cron kind, callers must omit all three values. Partial Cron metadata and Cron metadata attached to a non-Cron explanation are invalid.
DurableScheduleId ScheduleId { get; }
Source
Gets the schedule identity.
DurableScheduleKind Kind { get; }
Source
Gets the schedule shape.
ScheduleOverlapPolicy OverlapPolicy { get; }
Source
Gets the effective overlap behavior.
ScheduleMisfirePolicy MisfirePolicy { get; }
Source
Gets the effective downtime behavior.
IReadOnlyList<DateTimeOffset> NextOccurrencesUtc { get; }
Source
Gets upcoming evaluated instants normalized to UTC.
CronDialect? CronDialect { get; }
Source
Gets the required Cron dialect for a Cron explanation, or null
otherwise.
CronGrammar? CronGrammar { get; }
Source
Gets the required Cron grammar for a Cron explanation, or null
otherwise.
string? IanaTimeZoneId { get; }
Source
Gets the required IANA time zone for a Cron explanation, or null
otherwise.
string? EvaluatorVersion { get; }
Source
Gets the pinned evaluator package version when applicable.
int? JitterSeed { get; }
Source
Gets the deterministic H
expansion seed when applicable.
string? TimeZoneRulesFingerprint { get; }
Source
Gets the fingerprint of the time-zone rules used for this calculation.
IReadOnlyList<string> Notes { get; }
Source
Gets safe explanatory notes, including DST or acceptance-anchor caveats.
Creates, inspects, explains, updates, pauses, resumes, and deletes durable schedules.
The application must authorize the trusted DurableScopeId
before invoking this client. Delete blocks every not-yet-started occurrence but does not revoke a target that already started. Pause preserves same-generation pending work but prevents it from starting until resume.
ValueTask<DurableOperationResult<DurableScheduleMutationResult>> CreateAsync(DurableScheduleCreateRequest request, CancellationToken cancellationToken = default)
Durably creates a schedule or returns the exact prior idempotent outcome.
ValueTask<DurableOperationResult<DurableScheduleMutationResult>> UpdateAsync(DurableScheduleUpdateRequest request, CancellationToken cancellationToken = default)
Replaces the definition and target, incrementing the generation on success.
ValueTask<DurableOperationResult<DurableScheduleMutationResult>> ApplyLifecycleCommandAsync(DurableScheduleCommand command, CancellationToken cancellationToken = default)
Applies the pause, resume, delete, or recovery-release operation selected by the command kind.
command
DurableScheduleCommand.Kind
is the sole operation selector.cancellationToken
The accepted mutation result or an actionable durable problem.
Pause blocks new starts without canceling an already-running target; resume makes preserved pending work eligible; delete invalidates every target that has not started; recovery release rebinds restore-fenced state to the active runtime epoch. Callers must not dispatch the same command through a second method-name operation selector.
ValueTask<DurableOperationResult<DurableScheduleSnapshot>> GetAsync(DurableScopeId scopeId, DurableScheduleId scheduleId, CancellationToken cancellationToken = default)
Gets one authorized schedule snapshot.
ValueTask<DurableOperationResult<DurableScheduleListResult>> ListAsync(DurableScheduleListRequest request, CancellationToken cancellationToken = default)
Lists one bounded authorized page of schedule snapshots.
ValueTask<DurableOperationResult<DurableScheduleExplanation>> ExplainNextOccurrencesAsync(DurableScheduleExplainRequest request, CancellationToken cancellationToken = default)
Explains upcoming occurrences and effective policy without mutating runtime state.
Describes how a schedule handles overlapping occurrences.
QueueOne
is the safe default: it bounds backlog growth while ensuring that an overlap causes one follow-up run after the active run reaches any terminal state. Use Skip
only when losing an occurrence is acceptable. AllowConcurrent(int)
should be reserved for targets that are safe to execute in parallel.
ScheduleOverlapPolicy AllowConcurrent(int maximumConcurrentRuns)
Creates a bounded concurrent-execution policy.
maximumConcurrentRuns
A bounded concurrent-execution policy.
ArgumentOutOfRangeException
maximumConcurrentRuns
is less than two. ScheduleOverlapPolicy QueueOne { get; }
Source
Gets the default policy, which retains one coalesced pending occurrence.
ScheduleOverlapPolicy Skip { get; }
Source
Gets the policy that discards occurrences which overlap an active run.
ScheduleOverlapPolicyKind Kind { get; }
Source
Gets the policy behavior.
int MaximumConcurrentRuns { get; }
Source
Gets the maximum number of active runs. This value is greater than one only for ScheduleOverlapPolicyKind.AllowConcurrent
.
Describes how a schedule recovers occurrences missed during downtime.
RunOnce
is the safe default and never enumerates every tick in a long missed range. Bounded catch-up is appropriate only when each nominal occurrence carries distinct business meaning. The runtime may apply a lower per-pass evaluation budget than MaximumOccurrences
and continue recovery in a later pass.
ScheduleMisfirePolicy CatchUp(int maximumOccurrences)
Creates an oldest-first bounded catch-up policy.
maximumOccurrences
A bounded catch-up policy.
ArgumentOutOfRangeException
maximumOccurrences
is not positive. ScheduleMisfirePolicy RunOnce { get; }
Source
Gets the default policy, which coalesces a missed range into one recovery run.
ScheduleMisfirePolicy Skip { get; }
Source
Gets the policy that advances past missed occurrences without running them.
ScheduleMisfirePolicyKind Kind { get; }
Source
Gets the misfire behavior.
int MaximumOccurrences { get; }
Source
Gets the maximum number of missed occurrences that may be materialized by one complete catch-up operation.
Describes when a durable target should run and how overlap and downtime are handled.
Definitions are immutable values. The default composition is ScheduleOverlapPolicy.QueueOne
plus ScheduleMisfirePolicy.RunOnce
. Use WithOverlap
or WithMisfire
to opt a particular schedule into different behavior.
DurableAtSchedule At(DateTimeOffset at)
Creates a schedule that runs once at an absolute instant.
at
An absolute one-time schedule.
DurableAfterSchedule After(TimeSpan delay)
Creates a schedule that runs once after durable acceptance.
delay
A delayed one-time schedule.
DurableEverySchedule Every(TimeSpan interval, DateTimeOffset? anchor = null)
Creates an elapsed-UTC recurring schedule.
interval
anchor
An elapsed-UTC interval schedule.
Use Cron
for calendar-time recurrence or daylight-saving-aware wall-clock behavior.
DurableCronSchedule Cron(string expression, string ianaTimeZoneId, CronGrammar grammar = CronGrammar.Standard)
Creates a CronosV1 calendar schedule.
expression
ianaTimeZoneId
America/New_York
.grammar
A CronosV1 schedule.
The selected provider validates the expression and time zone before accepting the schedule. Cronos H
fields are expanded from a stable cryptographic hash of the schedule id.
DurableSchedule WithOverlap(ScheduleOverlapPolicy policy)
Returns a copy with the supplied overlap policy.
policy
A schedule with the new policy.
DurableSchedule WithMisfire(ScheduleMisfirePolicy policy)
Returns a copy with the supplied downtime recovery policy.
policy
A schedule with the new policy.
DurableScheduleKind Kind { get; }
Source
Gets the persisted schedule shape.
ScheduleOverlapPolicy OverlapPolicy { get; init; }
Source
Gets the effective overlap policy. The default is ScheduleOverlapPolicy.QueueOne
.
ScheduleMisfirePolicy MisfirePolicy { get; init; }
Source
Gets the effective downtime policy. The default is ScheduleMisfirePolicy.RunOnce
.
A one-time schedule at an absolute UTC instant.
DateTimeOffset AtUtc { get; }
Source
Gets the absolute run instant, normalized to UTC.
A one-time delay anchored to the authoritative store timestamp of the durable acceptance transaction.
TimeSpan Delay { get; }
Source
Gets the elapsed delay from durable acceptance.
An elapsed-UTC recurring schedule.
TimeSpan Interval { get; }
Source
Gets the elapsed UTC interval.
DateTimeOffset? AnchorUtc { get; }
Source
Gets the explicit UTC anchor, or null
to anchor at durable acceptance.
A calendar schedule evaluated by a versioned Cronos dialect in an IANA time zone.
string Expression { get; }
Source
Gets the raw expression exactly as supplied.
string IanaTimeZoneId { get; }
Source
Gets the IANA time-zone identifier.
CronDialect Dialect { get; }
Source
Gets the versioned public cron semantics.
CronGrammar Grammar { get; }
Source
Gets the persisted five- or six-field grammar mode.
Describes the registered durable target started by each schedule occurrence.
Targets encode typed input values immediately through an explicitly supplied durable codec. Persisted schedules never serialize executable delegates or resolve a target from a CLR type name. Registered names and versions accept only ASCII letters, digits, hyphens, underscores, periods, and colons. Empty, whitespace-only, control-containing, and other-character values are rejected.
DurableWorkScheduleTarget<TWork> Work<TWork>(string workName, string workVersion, TWork input, IDurablePayloadCodec<TWork> codec)
Creates a target for a registered durable work type.
TWork
workName
workVersion
input
codec
A typed durable work target.
DurableFlowScheduleTarget<TContext> Flow<TContext>(string flowId, string version, TContext initialContext, IDurablePayloadCodec<TContext> codec)
Creates a target for an immutable registered Flow version.
TContext
flowId
version
initialContext
codec
A typed durable Flow target.
DurableScheduleTargetKind Kind { get; }
Source
Gets the target subsystem.
string RegisteredName { get; }
Source
Gets the provider-readable registered Work name or Flow id.
string RegisteredVersion { get; }
Source
Gets the provider-readable immutable Work or Flow version.
DurableEncodedPayload EncodedInput { get; }
Source
Gets the immutable encoded input a provider persists without inspecting the CLR generic type.
A schedule target that enqueues a registered durable work input.
TWork
string WorkName { get; }
Source
Gets the stable registered work name, limited to 200 durable-identifier characters.
string WorkVersion { get; }
Source
Gets the immutable registered work contract version, limited to 100 durable-identifier characters.
IDurablePayloadCodec<TWork> Codec { get; }
Source
Gets the exact codec used to encode the immutable target input.
DurableEncodedPayload EncodedInputPayload { get; }
Source
Gets the immutable encoded target input.
A schedule target that starts an immutable registered Flow version.
TContext
string FlowId { get; }
Source
Gets the stable Flow identifier, limited to 200 durable-identifier characters.
string Version { get; }
Source
Gets the immutable Flow graph version, limited to 100 durable-identifier characters.
IDurablePayloadCodec<TContext> Codec { get; }
Source
Gets the exact codec used to encode the immutable initial context.
DurableEncodedPayload EncodedInitialContext { get; }
Source
Gets the immutable encoded initial context.
Compares a replayed command with a previously persisted semantic fingerprint.
Declares how the runtime may recover after an external provider outcome becomes unknown.
Represents the authoritative lifecycle state of a durable work aggregate.
Indicates whether a durable acceptance was newly committed or deduplicated.
Represents the authoritative lifecycle state of a durable Flow instance.
Describes the result of a durable Flow command.
Classifies the safely handled state of ambient or persisted durable trace context.
Identifies what a side-effect-free provider reconciliation established.
Classifies data that has been explicitly approved for durable persistence.
Describes the fact an exit-aware durable executor can prove after it is invoked.
An exit is not a durable Work state transition. The provider remains authoritative for permits, claims, cancellation, retry timing, and the resulting persisted state.
Identifies the stable successful outcome of a schedule mutation.
Represents the authoritative lifecycle state of a durable schedule.
Identifies the operation represented by a shared schedule lifecycle command.
Identifies how a schedule behaves when an occurrence is due while a prior occurrence is still running.
Identifies how occurrences missed while the scheduler was unavailable are recovered.
Identifies the persisted shape of a durable schedule.
Identifies the versioned public semantics used to evaluate a cron expression.
A behavior-changing Cronos upgrade must introduce a new dialect or an explicit persisted-schedule migration. It must never silently reinterpret a schedule stored as CronosV1
.
Identifies whether a CronosV1 expression contains five fields or includes a leading seconds field.
Identifies the durable subsystem started by a schedule occurrence.