SnapshotSet

Trait SnapshotSet 

Source
pub trait SnapshotSet: Send {
    // Required methods
    fn create_or_get_snapshot(
        &mut self,
        snapshot_type: SnapshotType,
        shard_count: u64,
        may_append_existing: bool,
    ) -> Result<SnapshotInfo, Error>;
    fn publish_completed_snapshot(
        &mut self,
        pending_snapshot_ordinal: SnapshotOrdinal,
        purge_obsolete_diff_snapshots: bool,
        purge_obsolete_pending_snapshots: bool,
    ) -> Result<(), Error>;
    fn get_snapshots_to_restore(&self) -> Vec<&SnapshotInfo>;
}
Expand description

A set of snapshot files, used to manage and query snapshots in a given folder. Provides operations to query snapshots that exist with their types and to add new snapshot file (names) to the set.

This type only manages file names and creates/removes files as a whole, it does not actually read/write snapshots contents.

Required Methods§

Source

fn create_or_get_snapshot( &mut self, snapshot_type: SnapshotType, shard_count: u64, may_append_existing: bool, ) -> Result<SnapshotInfo, Error>

Registers a new snapshot path usable for the given snapshot type. This will return a new snapshot path that can be used to write the snapshot to.

If may_append_existing is set to true, an existing snapshot file may be returned if there is no (completed) full snapshot with a higher ordinal.

A new snapshot file will have a ordinal higher than all previous snapshots. A new shapshot file will be created with empty contents.

Source

fn publish_completed_snapshot( &mut self, pending_snapshot_ordinal: SnapshotOrdinal, purge_obsolete_diff_snapshots: bool, purge_obsolete_pending_snapshots: bool, ) -> Result<(), Error>

Publishes a pending snapshot as a full snapshot. This will rename the snapshot file to indicate that it is a full snapshot and considered complete. purge_obsolete_diff_snapshots specifies if differential snapshots that are now obsolete should be auto-deleted. purge_obsolete_pending_snapshots specifies if pending snapshots that precede the now completed snapshot should be auto-deleted.

Source

fn get_snapshots_to_restore(&self) -> Vec<&SnapshotInfo>

Returns all snapshots that need to be restored in order to get the latest state. This includes the latest full snapshot and all differential snapshots since then.

Implementors§