Skip to main content

ReplayEngine

Struct ReplayEngine 

Source
pub struct ReplayEngine { /* private fields */ }

Implementations§

Source§

impl ReplayEngine

Source

pub fn new(source: &str, target: &str, from_tick: u64, to_tick: u64) -> Self

Create a replay engine for the given source/target and tick range.

Source

pub fn source_timeline(&self) -> &str

Return a reference to the source timeline ID.

Source

pub fn target_timeline(&self) -> &str

Return a reference to the target timeline ID.

Source

pub fn from_tick(&self) -> u64

Return the start tick (inclusive).

Source

pub fn to_tick(&self) -> u64

Return the end tick (inclusive).

Source

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

Return a reference to all loaded events.

Source

pub fn add_event( &mut self, event: CanonEventSnapshot, ) -> Result<(), ChronoshiftError>

Append an event to the replay buffer.

Returns Err(ReplayOverflow) if the buffer has reached MAX_REPLAY_EVENTS.

Source

pub fn validate_chain(&self) -> Result<(), ChronoshiftError>

Validate the digest chain of all loaded events.

For each event after the first, recompute the expected digest from the event fields and compare it to the stored digest. The first event’s digest is trusted as the chain root.

Returns Ok(()) if the chain is intact, or Err at the first broken link.

Source

pub fn replay_tick(&self, tick: u64) -> Vec<CanonEventSnapshot>

Get all events for a specific tick, in sequence order.

Source

pub fn replay_range(&self, from: u64, to: u64) -> Vec<CanonEventSnapshot>

Get all events in a tick range [from, to] inclusive, in order.

Source

pub fn compute_determinism_hash(&self) -> String

Compute a BLAKE3 hash over all replayed events for determinism comparison. The hash covers event_id, event_type, tick, seq, and digest of every event in canonical order.

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<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, 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.