Replay all records from all segments in a WAL directory, in LSN order. Segments are read in order of their first_lsn. Within each segment, records are read sequentially. This produces a globally ordered stream.
(wal_dir: &Path)
| 287 | /// Segments are read in order of their first_lsn. Within each segment, |
| 288 | /// records are read sequentially. This produces a globally ordered stream. |
| 289 | pub fn replay_all_segments(wal_dir: &Path) -> Result<Vec<WalRecord>> { |
| 290 | let segments = discover_segments(wal_dir)?; |
| 291 | let mut all_records = Vec::new(); |
| 292 | |
| 293 | for seg in &segments { |
| 294 | let reader = crate::reader::WalReader::open(&seg.path)?; |
| 295 | for record_result in reader.records() { |
| 296 | all_records.push(record_result?); |
| 297 | } |
| 298 | } |
| 299 | |
| 300 | Ok(all_records) |
| 301 | } |
| 302 | |
| 303 | /// Paginated replay from a WAL directory: reads at most `max_records` from `from_lsn`. |
| 304 | /// |