FerroReplay
Getting started
Use FerroReplay to make event processing deterministic.
FerroReplay keeps time explicit. A strategy, matching engine, or analytics
pipeline should depend on an injected Clock and let the replay producer
advance VirtualClock from ordered event metadata instead of reading host
wall-clock time.
Add the crate
[dependencies]
ferro-replay = { version = "0.1" }Clock boundary
Production services usually receive Arc<dyn Clock>. Live paths use
SystemClock; replay and tests use VirtualClock.
use std::sync::Arc;
use ferro_replay::{Clock, SystemClock, VirtualClock};
fn live_clock() -> Arc<dyn Clock> {
Arc::new(SystemClock::new())
}
fn replay_clock(start_ns: i64) -> VirtualClock {
VirtualClock::new(start_ns)
}Contract
- Event order is explicit.
- Time comes from
Clock, not direct process wall-clock reads. - Replay advances
VirtualClockto the next event timestamp before dispatch. - Timers use
intervalso live and replay cadence behavior share one path.
Use the API reference for exact clock, virtual-clock, and interval types.