Struct ProjectionPosition
- Namespace
- Excalibur.EventSourcing
- Assembly
- Excalibur.EventSourcing.Abstractions.dll
A projection's progress assertion or terminal retirement state.
public readonly record struct ProjectionPosition : IEquatable<ProjectionPosition>
- Implements
- Inherited Members
Remarks
Providers store state and position atomically. Existing unnumbered and unplaceable rows cannot accept an ordinary positioned advance; a full rebuild can repair them. A retired key cannot be repaired in place: its payload is gone and every writer must preserve the deletion marker. Repopulation requires a new physical generation. An absent row has no assertion and reads as Unplaceable; it is distinct from a retained retirement marker even though both expose no payload.
Fields
RetiredSentinel
Encoding of terminal deletion within a physical generation.
public const long RetiredSentinel = -3
Field Value
UnnumberedSentinel
Encoding of a complete fold without a global coordinate.
public const long UnnumberedSentinel = -1
Field Value
UnplaceableSentinel
Encoding of state that is not a fold over a known prefix.
public const long UnplaceableSentinel = -2
Field Value
Properties
ExpectedPositionOrNull
Gets the observed global coordinate, or null for a state without one.
public long? ExpectedPositionOrNull { get; }
Property Value
- long?
Remarks
Null does not authorize insertion. The store checks row existence and retirement atomically with every write; a retired row refuses even a caller that read no position.
Kind
Gets the meaning of the stored position.
public ProjectionPositionKind Kind { get; }
Property Value
Retired
Gets a terminal deletion marker with no payload or global coordinate.
public static ProjectionPosition Retired { get; }
Property Value
Unnumbered
Gets a complete fold whose global coordinate is unknown.
public static ProjectionPosition Unnumbered { get; }
Property Value
Unplaceable
Gets state that cannot be related to a known event prefix.
public static ProjectionPosition Unplaceable { get; }
Property Value
Value
Gets the global coordinate of a positioned row.
public long Value { get; }
Property Value
Exceptions
- InvalidOperationException
This state carries no global coordinate.
Methods
At(long)
Creates an assertion that the state is folded through the given position.
public static ProjectionPosition At(long position)
Parameters
positionlongA non-negative global coordinate.
Returns
- ProjectionPosition
The positioned assertion.
Exceptions
- ArgumentOutOfRangeException
The coordinate is negative.
FromStored(long?)
Decodes the shared storage representation.
public static ProjectionPosition FromStored(long? stored)
Parameters
storedlong?The stored number, or null when no assertion was recorded.
Returns
- ProjectionPosition
The explicit state; absent or unknown negative values are unplaceable.
ToStored()
Encodes the assertion, preserving the fail-safe default struct value.
public long ToStored()
Returns
- long
The coordinate or shared sentinel.
ToString()
Returns the global coordinate or state name for diagnostics.
public override string ToString()
Returns
- string
A diagnostic string.