pub struct HistoryCursor { /* private fields */ }Expand description
Ordered cursor over a workflow’s recorded history.
Commands consume only their own events. Asynchronous arrivals (signals,
child terminals, a parallel activity’s events) can be recorded anywhere
inside another command’s event range, so consumption is tracked per
event: a resolved command marks exactly its own events consumed and
skipped interior events stay matchable for their own commands.
position is the low-water mark — the first index that is neither
consumed nor already skipped past — and scans resume from it.
Implementations§
Source§impl HistoryCursor
impl HistoryCursor
Sourcepub fn new(events: Vec<Event>) -> Result<Self, DurabilityError>
pub fn new(events: Vec<Event>) -> Result<Self, DurabilityError>
Builds a cursor from ordered read-history output.
§Errors
Returns DurabilityError::HistoryShape when event sequence numbers decrease.
Sourcepub fn current_sequence(&self) -> Option<u64>
pub fn current_sequence(&self) -> Option<u64>
Returns the sequence number at the current cursor position, or None when exhausted.
Sourcepub const fn position_index(&self) -> usize
pub const fn position_index(&self) -> usize
Returns the current zero-based index into the owned history.
Sourcepub fn next_key(&self, family: RecordedEventFamily) -> Option<CorrelationKey>
pub fn next_key(&self, family: RecordedEventFamily) -> Option<CorrelationKey>
Returns the next matchable correlation key for family without consuming history.
Sourcepub fn fast_forward_to_key(&mut self, key: &CorrelationKey)
pub fn fast_forward_to_key(&mut self, key: &CorrelationKey)
Advance past recorded commands that earlier resolver instances of the same live execution already consumed.
NIF calls each build a fresh resolver whose cursor starts at the top
of history, so commands resolved by earlier calls sit before the one
being resolved now. Skipping stops at the first matchable entry whose
correlation key equals key — or at history end, leaving live
resolution to proceed — so a genuinely out-of-order command for an
already-positioned key still surfaces as a mismatch in
HistoryCursor::resolve_next. Strict full-history replay
(recovery, the replay driver) never calls this.
Sourcepub fn fast_forward_to_child_terminal(&mut self, child_workflow_id: &WorkflowId)
pub fn fast_forward_to_child_terminal(&mut self, child_workflow_id: &WorkflowId)
Advance to the recorded terminal outcome for child_workflow_id.
AwaitChild has no positional correlation key — its replay identity
is the child workflow id returned by the matching spawn — so it gets
the same skip treatment keyed commands receive from
HistoryCursor::fast_forward_to_key: recorded commands consumed by
earlier resolver instances of the same live execution are skipped
until the awaited child’s ChildWorkflowCompleted/ChildWorkflowFailed
is reached. With no recorded terminal for that child the cursor
exhausts, leaving resolution to hand off live. Strict full-history
replay (recovery, the replay driver) never calls this.
Sourcepub fn resolve_child_terminal(
&mut self,
child_workflow_id: &WorkflowId,
) -> ChildTerminalResolveResult
pub fn resolve_child_terminal( &mut self, child_workflow_id: &WorkflowId, ) -> ChildTerminalResolveResult
Resolves the next recorded child terminal outcome for child_workflow_id.
Sourcepub fn resolve_next(
&mut self,
family: RecordedEventFamily,
expected_key: CorrelationKey,
) -> CursorResolveResult
pub fn resolve_next( &mut self, family: RecordedEventFamily, expected_key: CorrelationKey, ) -> CursorResolveResult
Resolves the next recorded outcome for the expected family and correlation key.
Trait Implementations§
Source§impl Clone for HistoryCursor
impl Clone for HistoryCursor
Source§fn clone(&self) -> HistoryCursor
fn clone(&self) -> HistoryCursor
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more