Interface ICommittedPositionReader
- Namespace
- Stratara.Abstractions.CommitOrder
- Assembly
- Stratara.Abstractions.dll
Reads the event store in commit order, one partition at a time. The promise that distinguishes it from a plain "after sequence number" read: no entry whose position is at or below the Position of a returned batch can still commit later. A reader that keeps that promise can be resumed from a stored position without ever skipping an entry.
public interface ICommittedPositionReader
- Extension Methods
Remarks
What a position is depends on the implementation — a sequence number, a per-partition counter, a transaction id — and a stored position is only meaningful to the reader that produced it. A read that orders by sequence number alone does not keep the promise: a transaction can take the lower sequence number and commit after one that took a higher.
Properties
Name
The stable name positions are stored under. It names the ordering the positions belong to and the partition count they were written under, so a checkpoint is refused by a reader of another kind or under another count, and renaming a class changes nothing a checkpoint is keyed on.
string Name { get; }
Property Value
Methods
ReadAfterAsync(int, long, int, CancellationToken)
Returns up to batchSize entries of partition that come
after afterPosition in commit order, together with the position to resume
from.
Task<CommittedBatch> ReadAfterAsync(int partition, long afterPosition, int batchSize, CancellationToken cancellationToken = default)
Parameters
partitionintThe partition to read, from
0to the configured partition count − 1.afterPositionlongThe position returned by the previous batch, or
0to start from the beginning.batchSizeintThe maximum number of entries to return.
cancellationTokenCancellationTokenPropagated to the store.
Returns
- Task<CommittedBatch>
The entries in commit order, and the position to store; an empty batch keeps the position it was asked for.