Expand description
Streaming replay for large traces.
This module provides streaming support for processing traces that are too large to fit in memory. The key types are:
StreamingReplayer: Replays traces directly from file with O(1) memoryReplayCheckpoint: Saves replay state for resumptionReplayProgress: Progress tracking during replay
§Memory Guarantees
StreamingReplayer: O(1) memory - only buffers current event- Reading: Uses
TraceReaderwith streaming reads - Writing: Uses
TraceWriterwith streaming writes
§Example
ⓘ
use asupersync::trace::streaming::{StreamingReplayer, ReplayProgress};
use std::path::Path;
// Open a large trace file for streaming replay
let mut replayer = StreamingReplayer::open("large_trace.bin")?;
// Process events one at a time
while let Some(event) = replayer.next_event()? {
println!("Event: {:?}", event);
// Check progress
if replayer.progress().percent() > 50.0 {
println!("Halfway done!");
}
}
// For very long replays, checkpoint and resume later
let checkpoint = replayer.checkpoint()?;
std::fs::write("checkpoint.bin", checkpoint.to_bytes()?)?;
// Later: resume from checkpoint
let checkpoint = ReplayCheckpoint::from_bytes(&std::fs::read("checkpoint.bin")?)?;
let mut resumed = StreamingReplayer::resume("large_trace.bin", checkpoint)?;Structs§
- Replay
Checkpoint - A checkpoint for resuming long replays.
- Replay
Progress - Progress information during streaming replay.
- Streaming
Replayer - A streaming replayer that processes traces with O(1) memory.
Enums§
- Streaming
Replay Error - Errors specific to streaming replay operations.
Type Aliases§
- Streaming
Replay Result - Result type for streaming replay operations.