Backend

Trait Backend 

Source
pub trait Backend:
    Debug
    + Send
    + Sync
    + 'static {
    // Required methods
    fn name(&self) -> &'static str;
    fn put_object<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        id: &'life1 ObjectId,
        metadata: &'life2 Metadata,
        stream: ClientStream,
    ) -> Pin<Box<dyn Future<Output = Result<PutResponse>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait;
    fn get_object<'life0, 'life1, 'async_trait>(
        &'life0 self,
        id: &'life1 ObjectId,
    ) -> Pin<Box<dyn Future<Output = Result<GetResponse>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn delete_object<'life0, 'life1, 'async_trait>(
        &'life0 self,
        id: &'life1 ObjectId,
    ) -> Pin<Box<dyn Future<Output = Result<DeleteResponse>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;

    // Provided methods
    fn get_metadata<'life0, 'life1, 'async_trait>(
        &'life0 self,
        id: &'life1 ObjectId,
    ) -> Pin<Box<dyn Future<Output = Result<MetadataResponse>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait { ... }
    fn join<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait { ... }
}
Expand description

Trait implemented by all storage backends.

Required Methods§

Source

fn name(&self) -> &'static str

The backend name, used for diagnostics.

Source

fn put_object<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, id: &'life1 ObjectId, metadata: &'life2 Metadata, stream: ClientStream, ) -> Pin<Box<dyn Future<Output = Result<PutResponse>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Stores an object at the given path with the given metadata.

Source

fn get_object<'life0, 'life1, 'async_trait>( &'life0 self, id: &'life1 ObjectId, ) -> Pin<Box<dyn Future<Output = Result<GetResponse>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Retrieves an object at the given path, returning its metadata and a stream of bytes.

Source

fn delete_object<'life0, 'life1, 'async_trait>( &'life0 self, id: &'life1 ObjectId, ) -> Pin<Box<dyn Future<Output = Result<DeleteResponse>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Deletes the object at the given path.

Provided Methods§

Source

fn get_metadata<'life0, 'life1, 'async_trait>( &'life0 self, id: &'life1 ObjectId, ) -> Pin<Box<dyn Future<Output = Result<MetadataResponse>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Retrieves only the metadata for an object, without the payload.

Source

fn join<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Waits for any outstanding background operations to complete before shutdown.

The default implementation is a no-op. Backends that spawn background tasks (such as TieredStorage) should override this to wait for those tasks to complete.

Implementors§