pub struct SequenceHead { /* private fields */ }Expand description
Tracks the current persisted sequence head for one workflow history.
The head is the store’s expected_seq value: empty histories start at 0, and after appending
N events the head advances by exactly N. Callers should advance this tracker only after the
backing store has accepted the append.
Implementations§
Source§impl SequenceHead
impl SequenceHead
Sourcepub const fn from_head(head: u64) -> Self
pub const fn from_head(head: u64) -> Self
Creates a tracker from an explicitly derived persisted head.
Sourcepub const fn next_seq(&self) -> Option<u64>
pub const fn next_seq(&self) -> Option<u64>
Returns the sequence number for the first event in the next append batch.
Sourcepub fn mark_append_success(
&mut self,
event_count: usize,
) -> Result<(), DurabilityError>
pub fn mark_append_success( &mut self, event_count: usize, ) -> Result<(), DurabilityError>
Marks a successful append and advances the head by the number of appended events.
Advancing by zero is accepted as a no-op because stores may accept empty append batches, but the Recorder only records non-empty single-event batches.
§Errors
Returns DurabilityError::HistoryShape if the event count cannot fit into u64 or if the
resulting sequence head would overflow.
Trait Implementations§
Source§impl Clone for SequenceHead
impl Clone for SequenceHead
Source§fn clone(&self) -> SequenceHead
fn clone(&self) -> SequenceHead
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for SequenceHead
impl Debug for SequenceHead
Source§impl Default for SequenceHead
impl Default for SequenceHead
Source§fn default() -> SequenceHead
fn default() -> SequenceHead
impl Eq for SequenceHead
Source§impl PartialEq for SequenceHead
impl PartialEq for SequenceHead
impl StructuralPartialEq for SequenceHead
Auto Trait Implementations§
impl Freeze for SequenceHead
impl RefUnwindSafe for SequenceHead
impl Send for SequenceHead
impl Sync for SequenceHead
impl Unpin for SequenceHead
impl UnsafeUnpin for SequenceHead
impl UnwindSafe for SequenceHead
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.