Class CommittedBatch
- Namespace
- Stratara.Abstractions.CommitOrder
- Assembly
- Stratara.Abstractions.dll
One batch from an ICommittedPositionReader: the entries in commit order, each with its own position, and the position to resume from once all of them are applied.
public sealed record CommittedBatch : IEquatable<CommittedBatch>
- Inheritance
-
CommittedBatch
- Implements
- Inherited Members
- Extension Methods
Remarks
Two entries may share a position — one transaction wrote both — and a batch never holds part of such a group. A consumer that applies a batch only partly resumes from the highest position strictly below the first entry it did not apply, which ResumePositionBefore(int, long) computes.
Constructors
CommittedBatch(IReadOnlyList<CommittedEntry>, long)
One batch from an ICommittedPositionReader: the entries in commit order, each with its own position, and the position to resume from once all of them are applied.
public CommittedBatch(IReadOnlyList<CommittedEntry> Entries, long Position)
Parameters
EntriesIReadOnlyList<CommittedEntry>The entries, in the order they are to be applied.
PositionlongThe position to store after applying every entry in
Entries.
Remarks
Two entries may share a position — one transaction wrote both — and a batch never holds part of such a group. A consumer that applies a batch only partly resumes from the highest position strictly below the first entry it did not apply, which ResumePositionBefore(int, long) computes.
Properties
Entries
The entries, in the order they are to be applied.
public IReadOnlyList<CommittedEntry> Entries { get; init; }
Property Value
HasMore
Whether the partition held more entries after this batch when it was read. A consumer that has applied a batch without more stops reading until the next wake-up instead of issuing an empty read.
public bool HasMore { get; init; }
Property Value
Position
The position to store after applying every entry in Entries.
public long Position { get; init; }
Property Value
Methods
Empty(long)
An empty batch that leaves the position where it was.
public static CommittedBatch Empty(long position)
Parameters
positionlongThe position the read was asked for.
Returns
- CommittedBatch
A batch with no entries and
positionunchanged.
ResumePositionBefore(int, long)
The position to resume from when the entries before firstUnappliedIndex
were applied and the rest were not.
public long ResumePositionBefore(int firstUnappliedIndex, long positionBeforeBatch)
Parameters
firstUnappliedIndexintThe index of the first entry that was not applied.
positionBeforeBatchlongThe position the batch was read after.
Returns
- long
The highest applied position no unapplied entry shares, or
positionBeforeBatch.