pub struct SnapshotManager {
snapshots: HashMap<Hash, Snapshot>,
by_creator: HashMap<String, Vec<Hash>>,
latest: Option<Hash>,
config: SnapshotConfig,
}Expand description
Manages snapshot creation and retrieval.
Fields§
§snapshots: HashMap<Hash, Snapshot>All known snapshots, indexed by ID.
by_creator: HashMap<String, Vec<Hash>>Snapshots indexed by creator.
latest: Option<Hash>The latest snapshot ID.
config: SnapshotConfigConfiguration for snapshot creation.
Implementations§
Source§impl SnapshotManager
impl SnapshotManager
Sourcepub fn with_config(config: SnapshotConfig) -> Self
pub fn with_config(config: SnapshotConfig) -> Self
Create a snapshot manager with custom configuration.
Sourcepub fn config(&self) -> &SnapshotConfig
pub fn config(&self) -> &SnapshotConfig
Get the configuration.
Sourcepub fn by_creator(&self, creator: &str) -> Vec<&Snapshot>
pub fn by_creator(&self, creator: &str) -> Vec<&Snapshot>
Get all snapshots by a specific creator.
Sourcepub fn find_covering(&self, vv: &VersionVector) -> Option<&Snapshot>
pub fn find_covering(&self, vv: &VersionVector) -> Option<&Snapshot>
Find the best snapshot that covers a given version vector.
Sourcepub fn should_snapshot(
&self,
current_vv: &VersionVector,
current_time: u64,
) -> bool
pub fn should_snapshot( &self, current_vv: &VersionVector, current_time: u64, ) -> bool
Check if a new snapshot should be created based on configuration.
Sourcefn gc_old_snapshots(&mut self)
fn gc_old_snapshots(&mut self)
Remove old snapshots to stay within limits.
Sourcepub fn stats(&self) -> SnapshotStats
pub fn stats(&self) -> SnapshotStats
Get statistics about managed snapshots.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for SnapshotManager
impl RefUnwindSafe for SnapshotManager
impl Send for SnapshotManager
impl Sync for SnapshotManager
impl Unpin for SnapshotManager
impl UnwindSafe for SnapshotManager
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