pub struct SnapshotStore { /* private fields */ }Expand description
Storage for snapshots with automatic expiration
Implementations§
Source§impl SnapshotStore
impl SnapshotStore
Sourcepub fn with_window(window_duration: Duration) -> Self
pub fn with_window(window_duration: Duration) -> Self
Create a new snapshot store with custom window duration
Sourcepub async fn save(
&mut self,
board: &HypothesisBoard,
graph: &BeliefGraph,
) -> SnapshotId
pub async fn save( &mut self, board: &HypothesisBoard, graph: &BeliefGraph, ) -> SnapshotId
Save current state as a snapshot
Captures all hypotheses and dependency relationships from the board and graph. Automatically cleans up expired snapshots before saving.
Sourcepub fn get(&self, id: &SnapshotId) -> Option<&BeliefSnapshot>
pub fn get(&self, id: &SnapshotId) -> Option<&BeliefSnapshot>
Get a snapshot by ID
Sourcepub async fn restore(
&self,
id: &SnapshotId,
_board: &Arc<HypothesisBoard>,
_graph: &Arc<BeliefGraph>,
) -> Result<()>
pub async fn restore( &self, id: &SnapshotId, _board: &Arc<HypothesisBoard>, _graph: &Arc<BeliefGraph>, ) -> Result<()>
Restore state from a snapshot
Clears existing hypotheses and dependencies, then restores from snapshot. Returns error if snapshot not found or expired.
Sourcepub fn get_snapshot_data(&self, id: &SnapshotId) -> Result<BeliefSnapshot>
pub fn get_snapshot_data(&self, id: &SnapshotId) -> Result<BeliefSnapshot>
Get snapshot data for restoration (returns owned data)
Sourcepub fn list_snapshots(&self) -> Vec<&BeliefSnapshot>
pub fn list_snapshots(&self) -> Vec<&BeliefSnapshot>
List all active (non-expired) snapshots
Sourcepub fn is_expired(&self, id: &SnapshotId) -> bool
pub fn is_expired(&self, id: &SnapshotId) -> bool
Check if a snapshot is expired
Sourcepub fn active_count(&self) -> usize
pub fn active_count(&self) -> usize
Get the number of active snapshots
Sourcepub fn remove(&mut self, id: &SnapshotId) -> bool
pub fn remove(&mut self, id: &SnapshotId) -> bool
Manually remove a snapshot by ID
Trait Implementations§
Auto Trait Implementations§
impl Freeze for SnapshotStore
impl RefUnwindSafe for SnapshotStore
impl Send for SnapshotStore
impl Sync for SnapshotStore
impl Unpin for SnapshotStore
impl UnsafeUnpin for SnapshotStore
impl UnwindSafe for SnapshotStore
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
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more