pub struct StreamingCheckpointManager { /* private fields */ }Expand description
Zero-copy streaming checkpoint manager [50].
Eliminates Muda of Processing by streaming directly from serializer to compressor to memory-mapped file without intermediate allocations.
Implementations§
Source§impl StreamingCheckpointManager
impl StreamingCheckpointManager
Sourcepub fn new(
base_path: impl Into<PathBuf>,
interval: u64,
compression_level: i32,
) -> SimResult<Self>
pub fn new( base_path: impl Into<PathBuf>, interval: u64, compression_level: i32, ) -> SimResult<Self>
Sourcepub const fn should_checkpoint(&self, step: u64) -> bool
pub const fn should_checkpoint(&self, step: u64) -> bool
Check if checkpoint should be created at this step.
Sourcepub fn checkpoint_streaming<S: Serialize>(
&mut self,
time: SimTime,
step: u64,
state: &S,
rng_state: &RngState,
) -> SimResult<PathBuf>
pub fn checkpoint_streaming<S: Serialize>( &mut self, time: SimTime, step: u64, state: &S, rng_state: &RngState, ) -> SimResult<PathBuf>
Create checkpoint with streaming serialization (zero intermediate allocation).
§Errors
Returns error if serialization or file I/O fails.
Sourcepub fn restore_streaming<S: DeserializeOwned>(
&self,
path: &Path,
) -> SimResult<(CheckpointHeader, S)>
pub fn restore_streaming<S: DeserializeOwned>( &self, path: &Path, ) -> SimResult<(CheckpointHeader, S)>
Sourcepub const fn checkpoint_count(&self) -> usize
pub const fn checkpoint_count(&self) -> usize
Get checkpoint count.
Sourcepub const fn total_bytes_written(&self) -> usize
pub const fn total_bytes_written(&self) -> usize
Get total bytes written.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for StreamingCheckpointManager
impl RefUnwindSafe for StreamingCheckpointManager
impl Send for StreamingCheckpointManager
impl Sync for StreamingCheckpointManager
impl Unpin for StreamingCheckpointManager
impl UnsafeUnpin for StreamingCheckpointManager
impl UnwindSafe for StreamingCheckpointManager
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more