Table of Contents

Struct RunSearchCursor

Namespace
FlowOrchestrator.Core.Storage
Assembly
FlowOrchestrator.Core.dll

Keyset position in the run list: the (StartedAt, Id) of the last row of a page. Passing it back as After reads the rows that follow it, newest first, with an index seek instead of an OFFSET that re-reads every skipped row.

public readonly record struct RunSearchCursor : IEquatable<RunSearchCursor>
Implements
Inherited Members

Remarks

The run list is ordered by StartedAt descending, then Id ascending in the provider's own key order (SQL Server orders uniqueidentifier differently from .NET and PostgreSQL). A cursor is therefore only meaningful to the provider that issued it; treat the encoded form as opaque.

Unlike Skip, a cursor is stable while new runs are inserted at the head of the list: the next page starts after the same row instead of shifting by the number of runs started in between.

Constructors

RunSearchCursor(DateTimeOffset, Guid)

Keyset position in the run list: the (StartedAt, Id) of the last row of a page. Passing it back as After reads the rows that follow it, newest first, with an index seek instead of an OFFSET that re-reads every skipped row.

public RunSearchCursor(DateTimeOffset StartedAt, Guid Id)

Parameters

StartedAt DateTimeOffset

Start time of the last row of the previous page.

Id Guid

Run id of the last row of the previous page; breaks ties between equal start times.

Remarks

The run list is ordered by StartedAt descending, then Id ascending in the provider's own key order (SQL Server orders uniqueidentifier differently from .NET and PostgreSQL). A cursor is therefore only meaningful to the provider that issued it; treat the encoded form as opaque.

Unlike Skip, a cursor is stable while new runs are inserted at the head of the list: the next page starts after the same row instead of shifting by the number of runs started in between.

Fields

MaxEncodedLength

Upper bound on the length of an encoded cursor; longer input is rejected without decoding.

public const int MaxEncodedLength = 64

Field Value

int

Properties

Id

Run id of the last row of the previous page; breaks ties between equal start times.

public Guid Id { get; init; }

Property Value

Guid

StartedAt

Start time of the last row of the previous page.

public DateTimeOffset StartedAt { get; init; }

Property Value

DateTimeOffset

Methods

After(FlowRunRecord)

Creates the cursor that continues after run.

public static RunSearchCursor After(FlowRunRecord run)

Parameters

run FlowRunRecord

The last row of a page.

Returns

RunSearchCursor

The keyset position of that row.

Encode()

Encodes the cursor as a URL-safe token (base64url, no padding) for an HTTP query string.

public string Encode()

Returns

string

The opaque token; decode it with TryParse(ReadOnlySpan<char>, out RunSearchCursor).

Remarks

The start time is stored as UTC ticks, so the offset of the original value is not preserved — the instant is.

Precedes(FlowRunRecord)

Returns true when run sorts strictly after this cursor in the in-process order (StartedAt descending, then CompareTo(Guid) ascending).

public bool Precedes(FlowRunRecord run)

Parameters

run FlowRunRecord

The candidate row.

Returns

bool

Whether the row belongs to a page that continues after the cursor.

Remarks

Used by in-process providers; SQL providers express the same predicate in their own key order.

TryParse(ReadOnlySpan<char>, out RunSearchCursor)

Decodes a token produced by Encode().

public static bool TryParse(ReadOnlySpan<char> value, out RunSearchCursor cursor)

Parameters

value ReadOnlySpan<char>

The token, typically from the after query parameter.

cursor RunSearchCursor

The decoded cursor when the method returns true.

Returns

bool

false for blank, over-long, malformed or unknown-version input; never throws.