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
StartedAtDateTimeOffsetStart time of the last row of the previous page.
IdGuidRun 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
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
StartedAt
Start time of the last row of the previous page.
public DateTimeOffset StartedAt { get; init; }
Property Value
Methods
After(FlowRunRecord)
Creates the cursor that continues after run.
public static RunSearchCursor After(FlowRunRecord run)
Parameters
runFlowRunRecordThe 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
runFlowRunRecordThe 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
valueReadOnlySpan<char>The token, typically from the
afterquery parameter.cursorRunSearchCursorThe decoded cursor when the method returns true.