Skip to main content

HistoryCursor

Struct HistoryCursor 

Source
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

Source

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.

Source

pub fn current_sequence(&self) -> Option<u64>

Returns the sequence number at the current cursor position, or None when exhausted.

Source

pub fn events(&self) -> &[Event]

Returns the ordered history backing this cursor.

Source

pub const fn position_index(&self) -> usize

Returns the current zero-based index into the owned history.

Source

pub fn next_key(&self, family: RecordedEventFamily) -> Option<CorrelationKey>

Returns the next matchable correlation key for family without consuming history.

Source

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.

Source

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.

Source

pub fn resolve_child_terminal( &mut self, child_workflow_id: &WorkflowId, ) -> ChildTerminalResolveResult

Resolves the next recorded child terminal outcome for child_workflow_id.

Source

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

Source§

fn clone(&self) -> HistoryCursor

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for HistoryCursor

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more