pub struct ReplayHarness;Expand description
Drives an Eventsourced aggregate
through a recorded entry stream, restoring RNG state first so derived
computation is bit-identical to the original run.
§Replay contract
For each recorded PersistentRepr in sequence order:
ExternalCommandentries are decoded and applied as recorded — they represent inputs the aggregate cannot reproduce on its own.DerivedEvententries (and untagged entries, treated as derived) are decoded, applied, and — when the caller routes the originating command back throughcommand_to_events— compared byte-for-byte against the recording. Any mismatch flipsReplayReport::matchedtofalse.
The harness is intentionally generic and minimal: state is rebuilt purely
by apply_event, so two replays from the same seed + snapshot yield
identical Eventsourced::State.
Implementations§
Source§impl ReplayHarness
impl ReplayHarness
Sourcepub fn replay<E, F, G>(
rng_state: RngState,
state: &mut E::State,
recorded: &[PersistentRepr],
decode: F,
re_encode: G,
) -> ReplayReport
pub fn replay<E, F, G>( rng_state: RngState, state: &mut E::State, recorded: &[PersistentRepr], decode: F, re_encode: G, ) -> ReplayReport
Replay recorded entries into state, restoring rng_state first.
decode turns a payload into an event; re_encode re-serializes a
recomputed derived event so it can be compared against the recording.
Returns a ReplayReport.
Auto Trait Implementations§
impl Freeze for ReplayHarness
impl RefUnwindSafe for ReplayHarness
impl Send for ReplayHarness
impl Sync for ReplayHarness
impl Unpin for ReplayHarness
impl UnsafeUnpin for ReplayHarness
impl UnwindSafe for ReplayHarness
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
Mutably borrows from an owned value. Read more