pub struct ReplayDriver<R: WalReader> { /* private fields */ }Expand description
A replay driver that loads events from a reader and feeds them to a reducer.
Implementations§
Source§impl<R: WalReader> ReplayDriver<R>
impl<R: WalReader> ReplayDriver<R>
Sourcepub fn new(reader: R, reducer: ReplayReducer) -> Self
pub fn new(reader: R, reducer: ReplayReducer) -> Self
Creates a new replay driver with the given reader and reducer.
Sourcepub fn run(&mut self) -> Result<(), WalReaderError>
pub fn run(&mut self) -> Result<(), WalReaderError>
Runs the replay, feeding events from the reader to the reducer.
Reads events sequentially from the reader and applies them to the reducer.
If strict WAL corruption is encountered, returns WalReaderError::Corruption.
If all events are processed successfully, returns Ok(()).
§Errors
Returns WalReaderError::Corruption if strict corruption is detected
in the event stream.
Returns WalReaderError::IoError if an I/O error occurs during reading.
Returns WalReaderError::ReducerError if the reducer encounters an error applying an event
(e.g., invalid transition, duplicate event).
Sourcepub fn run_with_applied_count(&mut self) -> Result<u64, WalReaderError>
pub fn run_with_applied_count(&mut self) -> Result<u64, WalReaderError>
Runs replay and returns the authoritative count of applied replay events.
This is the counting seam used by recovery bootstrap metrics population.
Sourcepub fn into_reducer(self) -> ReplayReducer
pub fn into_reducer(self) -> ReplayReducer
Returns the reducer after replay has completed.