Table of Contents

Class GlobalStreamPosition

Namespace
Excalibur.EventSourcing.Queries
Assembly
Excalibur.EventSourcing.dll

Represents a position in the global event stream, combining an ordinal position with a timestamp for correlation.

public sealed record GlobalStreamPosition : IEquatable<GlobalStreamPosition>
Inheritance
GlobalStreamPosition
Implements
Inherited Members

Remarks

The position value is provider-specific. For SQL-based stores, it typically maps to a global sequence number. For cloud-native stores, it may map to a change feed token.

Constructors

GlobalStreamPosition(long, DateTimeOffset)

Represents a position in the global event stream, combining an ordinal position with a timestamp for correlation.

public GlobalStreamPosition(long Position, DateTimeOffset Timestamp)

Parameters

Position long

The LAST POSITION ALREADY DELIVERED -- not the next one to read. A read from this position is EXCLUSIVE of it, so a consumer stores the position of the last event it handled and passes that back verbatim.

This is stated because the alternative convention (store last-delivered, read from last-delivered PLUS ONE) was in use at six call sites and got it wrong in two different ways within one file. There is now exactly one rule: the cursor IS the last delivered position, every query is exclusive, and no caller adds or subtracts anything.

Timestamp DateTimeOffset

The timestamp associated with this position.

Remarks

The position value is provider-specific. For SQL-based stores, it typically maps to a global sequence number. For cloud-native stores, it may map to a change feed token.

Properties

Position

The LAST POSITION ALREADY DELIVERED -- not the next one to read. A read from this position is EXCLUSIVE of it, so a consumer stores the position of the last event it handled and passes that back verbatim.

This is stated because the alternative convention (store last-delivered, read from last-delivered PLUS ONE) was in use at six call sites and got it wrong in two different ways within one file. There is now exactly one rule: the cursor IS the last delivered position, every query is exclusive, and no caller adds or subtracts anything.

public long Position { get; init; }

Property Value

long

Start

Gets a position representing the start of the global stream: before any event has been delivered.

public static GlobalStreamPosition Start { get; }

Property Value

GlobalStreamPosition

Remarks

Position 0 is the correct "nothing delivered yet" value because allocated positions begin at 1, so an exclusive read from 0 returns the first event rather than skipping it.

Timestamp

The timestamp associated with this position.

public DateTimeOffset Timestamp { get; init; }

Property Value

DateTimeOffset