Table of Contents

Interface IScheduleExecutionStore

Namespace
Excalibur.Dispatch.Delivery
Assembly
Excalibur.Dispatch.Abstractions.dll

Optional authoritative occurrence-admission capability on the configured schedule store.

public interface IScheduleExecutionStore : IScheduleStore
Inherited Members
Extension Methods

Remarks

Cast the configured IScheduleStore to this capability; a separately resolved store is not the same authority. Admission, administrative mutation and progress must share one linearization boundary. This capability does not by itself promise durable storage, distributed ownership, exactly-once effects, lease expiry or recovery after a worker dies. Providers must document those guarantees separately.

Methods

GetExecutionSnapshotsAsync(CancellationToken)

Reads detached schedule snapshots with opaque administrative generations.

Task<IReadOnlyList<ScheduleExecutionSnapshot>> GetExecutionSnapshotsAsync(CancellationToken cancellationToken)

Parameters

cancellationToken CancellationToken

Cancellation token.

Returns

Task<IReadOnlyList<ScheduleExecutionSnapshot>>

The versioned snapshots.

ReleaseExecutionAsync(ScheduleExecutionLease, CancellationToken)

Releases only matching authority, including after its progress commit.

Task<bool> ReleaseExecutionAsync(ScheduleExecutionLease lease, CancellationToken cancellationToken)

Parameters

lease ScheduleExecutionLease

Exact admitted bearer authority.

cancellationToken CancellationToken

Cancellation token.

Returns

Task<bool>

True when matching authority was released.

TryAcquireExecutionAsync(Guid, Guid, DateTimeOffset, CancellationToken)

Admits one unowned occurrence only if its generation and enabled stored occurrence are still current, and it is due.

Task<ScheduleExecutionLease?> TryAcquireExecutionAsync(Guid scheduleId, Guid generation, DateTimeOffset occurrenceUtc, CancellationToken cancellationToken)

Parameters

scheduleId Guid

Schedule identifier.

generation Guid

Generation from the detached snapshot.

occurrenceUtc DateTimeOffset

Exact occurrence from that snapshot.

cancellationToken CancellationToken

Cancellation token.

Returns

Task<ScheduleExecutionLease>

Bearer authority for the occurrence, or null when admission loses.

Remarks

Admission validates stored identity, ownership, and wall-clock eligibility. The scheduler also checks due-ness with its own TimeProvider before asking, but that check is an optimisation and never the guarantee: an implementation MUST refuse an occurrence whose instant is still in the future according to the STORE's own clock.

Why the store is the time authority. Admission is first-come, so if due-ness rests on each caller's clock the host running fastest wins every occurrence — not occasionally, but for the whole inventory, and it runs all of them early. One misconfigured host is enough, the records it writes carry its own skewed instants, and nothing downstream can distinguish the result from correct operation. A single comparison against the store's clock removes any need for hosts to agree.

The clock MUST be the store's own (for a relational provider, the database server's), never a value the caller supplies — a caller-supplied "now" reinstates exactly the trust this refusal removes.

TryUpdateProgressAsync(ScheduleExecutionLease, ScheduleExecutionResult, CancellationToken)

Commits at most one bounded progress result under a still-current lease.

Task<bool> TryUpdateProgressAsync(ScheduleExecutionLease lease, ScheduleExecutionResult result, CancellationToken cancellationToken)

Parameters

lease ScheduleExecutionLease

Exact admitted bearer authority.

result ScheduleExecutionResult

Bounded progress update.

cancellationToken CancellationToken

Cancellation token.

Returns

Task<bool>

True only when this is the first successful progress commit for this admission.

Remarks

Only last execution, next execution and disabling may change. Payload replacement and enabling require administrative storage and a fresh generation.