pub struct CheckpointManager { /* private fields */ }Expand description
Checkpoint manager for incremental checkpointing.
Implementations§
Source§impl CheckpointManager
impl CheckpointManager
Sourcepub fn new(interval: u64, max_storage: usize, compression_level: i32) -> Self
pub fn new(interval: u64, max_storage: usize, compression_level: i32) -> Self
Create a new checkpoint manager.
Sourcepub const fn should_checkpoint(&self, step: u64) -> bool
pub const fn should_checkpoint(&self, step: u64) -> bool
Check if a checkpoint should be created at this step.
Sourcepub fn checkpoint(
&mut self,
time: SimTime,
step: u64,
state: &SimState,
rng_state: RngState,
) -> SimResult<()>
pub fn checkpoint( &mut self, time: SimTime, step: u64, state: &SimState, rng_state: RngState, ) -> SimResult<()>
Sourcepub fn get_checkpoint_at(&self, time: SimTime) -> Option<&Checkpoint>
pub fn get_checkpoint_at(&self, time: SimTime) -> Option<&Checkpoint>
Get checkpoint at or before given time.
Sourcepub fn restore_at(&self, time: SimTime) -> SimResult<(SimState, SimTime)>
pub fn restore_at(&self, time: SimTime) -> SimResult<(SimState, SimTime)>
Restore state from nearest checkpoint.
§Errors
Returns error if no checkpoint found or restoration fails.
Sourcepub fn num_checkpoints(&self) -> usize
pub fn num_checkpoints(&self) -> usize
Get number of stored checkpoints.
Sourcepub const fn storage_used(&self) -> usize
pub const fn storage_used(&self) -> usize
Get current storage usage in bytes.
Trait Implementations§
Source§impl Debug for CheckpointManager
impl Debug for CheckpointManager
Source§impl Default for CheckpointManager
impl Default for CheckpointManager
Source§fn default() -> CheckpointManager
fn default() -> CheckpointManager
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for CheckpointManager
impl RefUnwindSafe for CheckpointManager
impl Send for CheckpointManager
impl Sync for CheckpointManager
impl Unpin for CheckpointManager
impl UnsafeUnpin for CheckpointManager
impl UnwindSafe for CheckpointManager
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