Table of Contents

Struct LeaseToken

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

An opaque ownership term identifying one holder of a lease on an inbox entry, returned by TryAcquireLeaseAsync(string, string, TimeSpan, CancellationToken) and presented back on every later write.

public readonly record struct LeaseToken : IEquatable<LeaseToken>
Implements
Inherited Members
Extension Methods

Remarks

The value is chosen and written by the store, never computed by the caller, and is compared only for equality inside the store's own atomic step. Callers MUST treat it as opaque: do not parse it, order it, or derive meaning from it. Each store picks whatever term it already has — a server-written expiry, a document revision, a sequence-and-primary-term pair — so a store with a native term is never forced to carry a second, redundant one.

The term is what makes a lapsed holder harmless. A caller whose lease expired still holds the term of the lease it lost; the holder that replaced it carries a different one, so the lapsed caller's write matches no row and takes no effect. Status alone cannot express this: at the instant of the bad write the entry is legitimately Processing — its successor's — so a status predicate protects the terminal state and not the term.

Constructors

LeaseToken(string)

An opaque ownership term identifying one holder of a lease on an inbox entry, returned by TryAcquireLeaseAsync(string, string, TimeSpan, CancellationToken) and presented back on every later write.

public LeaseToken(string Value)

Parameters

Value string

The store-chosen term. Opaque to callers.

Remarks

The value is chosen and written by the store, never computed by the caller, and is compared only for equality inside the store's own atomic step. Callers MUST treat it as opaque: do not parse it, order it, or derive meaning from it. Each store picks whatever term it already has — a server-written expiry, a document revision, a sequence-and-primary-term pair — so a store with a native term is never forced to carry a second, redundant one.

The term is what makes a lapsed holder harmless. A caller whose lease expired still holds the term of the lease it lost; the holder that replaced it carries a different one, so the lapsed caller's write matches no row and takes no effect. Status alone cannot express this: at the instant of the bad write the entry is legitimately Processing — its successor's — so a status predicate protects the terminal state and not the term.

Properties

Value

The store-chosen term. Opaque to callers.

public string Value { get; init; }

Property Value

string

Methods

ToString()

Returns the opaque term. Provided for diagnostics only; never parse this.

public override string ToString()

Returns

string

The store-chosen term value.