FerroReplay

Replay loop

A minimal deterministic event-processing loop.

The replay loop should be boring: read the next event, advance the deterministic clock, apply the event, and persist any emitted result. FerroReplay supplies the clock machinery; your application owns the event type and dispatch semantics.

use ferro_replay::{Clock, VirtualClock};
 
struct Event {
    timestamp_ns: i64,
    payload: Vec<u8>,
}
 
let clock = VirtualClock::new(0);
 
for event in load_session("session.frj")? {
    let event: Event = event?;
    clock.advance_to(event.timestamp_ns).await;
 
    let outputs = engine.apply(event.payload, clock.now_ns())?;
    for output in outputs {
        writer.append(output)?;
    }
}
# Ok::<(), Box<dyn std::error::Error>>(())

That shape is what makes an Anvil run reproducible: every downstream engine observes the same event sequence and the same logical time.