Skip to main content

ObjectStore

Trait ObjectStore 

Source
pub trait ObjectStore: Send + Sync {
    // Required methods
    fn put(&self, key: &ObjectKey, data: &[u8]) -> Result<()>;
    fn get(&self, key: &ObjectKey) -> Result<Vec<u8>>;
    fn delete(&self, key: &ObjectKey) -> Result<()>;
    fn list(&self, prefix: &str) -> Result<Vec<ObjectMetadata>>;
    fn head(&self, key: &ObjectKey) -> Result<ObjectMetadata>;

    // Provided methods
    fn exists(&self, key: &ObjectKey) -> bool { ... }
    fn copy(&self, src: &ObjectKey, dst: &ObjectKey) -> Result<()> { ... }
    fn rename(&self, src: &ObjectKey, dst: &ObjectKey) -> Result<()> { ... }
}
Expand description

Trait for object storage backends.

Implementations must be Send + Sync to allow use from multiple threads.

Required Methods§

Source

fn put(&self, key: &ObjectKey, data: &[u8]) -> Result<()>

Store data under key, overwriting any existing object.

Source

fn get(&self, key: &ObjectKey) -> Result<Vec<u8>>

Retrieve the object stored under key.

Source

fn delete(&self, key: &ObjectKey) -> Result<()>

Delete the object at key. Returns Ok(()) if the key does not exist.

Source

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

List all keys whose URI starts with prefix.

Source

fn head(&self, key: &ObjectKey) -> Result<ObjectMetadata>

Return metadata for a single object without downloading its content.

Provided Methods§

Source

fn exists(&self, key: &ObjectKey) -> bool

Check whether an object exists.

Source

fn copy(&self, src: &ObjectKey, dst: &ObjectKey) -> Result<()>

Copy an object from src to dst within the same store.

Source

fn rename(&self, src: &ObjectKey, dst: &ObjectKey) -> Result<()>

Rename/move an object from src to dst.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§