Skip to main content

Target

Trait Target 

pub trait Target: Send + Sync {
    // Required methods
    fn put(&self, name: &str, bytes: &[u8]) -> Result<()>;
    fn get(&self, name: &str) -> Result<Option<Vec<u8>>>;
    fn list(&self, prefix: &str) -> Result<Vec<String>>;
    fn delete(&self, name: &str) -> Result<()>;
    fn put_manifest(&self, bytes: &[u8]) -> Result<()>;
    fn get_manifest(&self) -> Result<Option<Vec<u8>>>;
    fn describe(&self) -> String;

    // Provided method
    fn cleanup(&self) -> Result<()> { ... }
}
Expand description

Object storage for backups.

Names are relative paths of [A-Za-z0-9._-] segments separated by /. The backup writes each name once, except to replace an object no manifest names (a retry after a crash). Objects written before put_manifest must be durable before the manifest is, and a reader sees either the old manifest or the new one, whole.

Required Methods§

fn put(&self, name: &str, bytes: &[u8]) -> Result<()>

fn get(&self, name: &str) -> Result<Option<Vec<u8>>>

None if there is no such object.

fn list(&self, prefix: &str) -> Result<Vec<String>>

Every object name starting with prefix, sorted. The manifest is not an object.

fn delete(&self, name: &str) -> Result<()>

Removing a missing object succeeds.

fn put_manifest(&self, bytes: &[u8]) -> Result<()>

fn get_manifest(&self) -> Result<Option<Vec<u8>>>

fn describe(&self) -> String

For messages: where the target is.

Provided Methods§

fn cleanup(&self) -> Result<()>

Removes debris of interrupted writes. Called with no writes running.

Implementors§