Trait checkpoint::Storage [] [src]

pub trait Storage {
    type Committed: CommittedCheckpoint;
    type Uncommitted: UncommittedCheckpoint;
    fn create_checkpoint(
        &mut self,
        identifier: &str
    ) -> Result<Self::Uncommitted>;
fn commit_checkpoint(
        &mut self,
        uncommitted: Self::Uncommitted
    ) -> Result<Self::Committed>;
fn load_checkpoint(&mut self, identifier: &str) -> Result<Self::Committed>;
fn remove_checkpoint(&mut self, identifier: &str) -> Result<()>;
fn checkpoint_identifiers(&mut self) -> Result<Vec<String>>; }

The Storage trait allows checkpoints to be created, committed, loaded, and removed from the underlying storage medium.

Associated Types

The type representing committed checkpoints.

The type representing uncommitted checkpoints.

Required Methods

Creates a new checkpoint with the specified identifier.

The checkpoint will not be saved permanently until it has been committed via the commit_checkpoint method.

Care must be taken to ensure that the same identifier isn't used for multiple uncommitted checkpoints. It is recommended that types which implement Storage be wrapped in the GuardWrapper type (or implement its functionality) to prevent uncommitted checkpoints from being given the same identifier.

Commits an uncommitted checkpoint, permanently saving its data to the underlying storage medium.

Loads the committed checkpoint associated with the provided identifier, allowing its data to be retrieved.

Removes the committed checkpoint associated with the provided identifier.

Care must be taken to ensure that checkpoints which are in use (i.e. have a binding created by either the commit_checkpoint method or the load_checkpoint method) are not removed. It is recommended that types which implement Storage be wrapped in the GuardWrapper type (or implement its functionality) to prevent accidental removal of checkpoints which are in use.

Returns a list of all committed checkpoint identifiers in the underlying storage medium.

Implementors