Skip to main content

ReplayCursor

Struct ReplayCursor 

Source
pub struct ReplayCursor<S: KernelState> {
    pub events: Box<dyn EventStore>,
    pub snaps: Option<Box<dyn SnapshotStore<S>>>,
    pub reducer: Box<dyn Reducer<S>>,
}
Expand description

Replay cursor: reconstructs state from the event log. No executor, no live execution.

Use this when you need to replay a run (e.g. verify, debug, or resume). The cursor loads the latest checkpoint if available, then applies all subsequent events in order. Action results are taken from the log (ActionSucceeded/ActionFailed), not from live execution.

Fields§

§events: Box<dyn EventStore>

Event store (source of truth).

§snaps: Option<Box<dyn SnapshotStore<S>>>

Optional snapshot store for checkpoint-based replay (optimization).

§reducer: Box<dyn Reducer<S>>

Reducer to apply each event to state (deterministic).

Implementations§

Source§

impl<S: KernelState> ReplayCursor<S>

Source

pub fn replay(&self, run_id: &RunId, initial_state: S) -> Result<S, KernelError>

Replays the run: load checkpoint (if any) → replay events → return final state.

Recorded outputs are injected via the event log (reducer applies ActionSucceeded/ActionFailed). No live tool or LLM execution occurs.

Source

pub fn replay_from( &self, run_id: &RunId, initial_state: S, snapshot: Option<&Snapshot<S>>, ) -> Result<S, KernelError>

Replays from an optional snapshot. If snapshot is provided, state starts at snapshot.state and only events with seq > snapshot.at_seq are applied.

Source

pub fn replay_from_checkpoint( &self, run_id: &RunId, initial_state: S, ) -> Result<S, KernelError>

Replays using the latest snapshot from the snapshot store (if any). Equivalent to load checkpoint → replay events → reconstruct state.

Source

pub fn replay_step<'a>( &'a self, run_id: &RunId, initial_state: S, from_seq: Seq, ) -> Result<ReplayStepIter<'a, S>, KernelError>

Replays event-by-event, yielding state after each applied event (for debugging/verify). No live execution; each event is applied via the reducer only.

Auto Trait Implementations§

§

impl<S> Freeze for ReplayCursor<S>

§

impl<S> !RefUnwindSafe for ReplayCursor<S>

§

impl<S> Send for ReplayCursor<S>

§

impl<S> Sync for ReplayCursor<S>

§

impl<S> Unpin for ReplayCursor<S>

§

impl<S> UnsafeUnpin for ReplayCursor<S>

§

impl<S> !UnwindSafe for ReplayCursor<S>

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<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

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> Same for T

Source§

type Output = T

Should always be Self
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.