Skip to main content

Storage

Trait Storage 

Source
pub trait Storage:
    Debug
    + Send
    + Sync {
    // Required methods
    fn put<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        key: &'life1 StorageKey,
        content: &'life2 [u8],
        intent: StorageWriteIntent,
    ) -> Pin<Box<dyn Future<Output = Result<StorageKey>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait;
    fn put_file<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        key: &'life1 StorageKey,
        source: &'life2 Path,
        intent: StorageWriteIntent,
    ) -> Pin<Box<dyn Future<Output = Result<StorageKey>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait;
    fn promote<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        temporary_key: &'life1 StorageKey,
        durable_key: &'life2 StorageKey,
    ) -> Pin<Box<dyn Future<Output = Result<StorageKey>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait;
    fn get<'life0, 'life1, 'async_trait>(
        &'life0 self,
        key: &'life1 StorageKey,
        intent: StorageWriteIntent,
    ) -> Pin<Box<dyn Future<Output = Result<Vec<u8>>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn get_to_file<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        key: &'life1 StorageKey,
        destination: &'life2 Path,
        intent: StorageWriteIntent,
    ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait;
    fn exists<'life0, 'life1, 'async_trait>(
        &'life0 self,
        key: &'life1 StorageKey,
    ) -> Pin<Box<dyn Future<Output = Result<bool>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn delete<'life0, 'life1, 'async_trait>(
        &'life0 self,
        key: &'life1 StorageKey,
    ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn list_prefix<'life0, 'life1, 'async_trait>(
        &'life0 self,
        prefix: &'life1 StorageKey,
    ) -> Pin<Box<dyn Future<Output = Result<Vec<StorageKey>>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn delete_prefix_older_than<'life0, 'life1, 'async_trait>(
        &'life0 self,
        prefix: &'life1 StorageKey,
        older_than: SystemTime,
    ) -> Pin<Box<dyn Future<Output = Result<u64>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;

    // Provided method
    fn delete_prefix<'life0, 'life1, 'async_trait>(
        &'life0 self,
        prefix: &'life1 StorageKey,
    ) -> Pin<Box<dyn Future<Output = Result<u64>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait { ... }
}
Expand description

Minimal object-storage interface used by services and workers.

Required Methods§

Source

fn put<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, key: &'life1 StorageKey, content: &'life2 [u8], intent: StorageWriteIntent, ) -> Pin<Box<dyn Future<Output = Result<StorageKey>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Store content at a storage-relative key. Implementations must not overwrite.

Source

fn put_file<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, key: &'life1 StorageKey, source: &'life2 Path, intent: StorageWriteIntent, ) -> Pin<Box<dyn Future<Output = Result<StorageKey>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Store a local file at a storage-relative key. Implementations must not overwrite.

Source

fn promote<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, temporary_key: &'life1 StorageKey, durable_key: &'life2 StorageKey, ) -> Pin<Box<dyn Future<Output = Result<StorageKey>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Promote a temporary object to a durable storage-relative key without overwriting.

Source

fn get<'life0, 'life1, 'async_trait>( &'life0 self, key: &'life1 StorageKey, intent: StorageWriteIntent, ) -> Pin<Box<dyn Future<Output = Result<Vec<u8>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Read content from a storage-relative key with an object-size cap.

Source

fn get_to_file<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, key: &'life1 StorageKey, destination: &'life2 Path, intent: StorageWriteIntent, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Download an object into a local file with an object-size cap.

Source

fn exists<'life0, 'life1, 'async_trait>( &'life0 self, key: &'life1 StorageKey, ) -> Pin<Box<dyn Future<Output = Result<bool>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Return whether a storage-relative key exists.

Source

fn delete<'life0, 'life1, 'async_trait>( &'life0 self, key: &'life1 StorageKey, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Delete a storage-relative key if it exists.

Source

fn list_prefix<'life0, 'life1, 'async_trait>( &'life0 self, prefix: &'life1 StorageKey, ) -> Pin<Box<dyn Future<Output = Result<Vec<StorageKey>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

List object keys below a storage-relative prefix.

Source

fn delete_prefix_older_than<'life0, 'life1, 'async_trait>( &'life0 self, prefix: &'life1 StorageKey, older_than: SystemTime, ) -> Pin<Box<dyn Future<Output = Result<u64>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Delete every object below a storage-relative prefix older than the cutoff.

Provided Methods§

Source

fn delete_prefix<'life0, 'life1, 'async_trait>( &'life0 self, prefix: &'life1 StorageKey, ) -> Pin<Box<dyn Future<Output = Result<u64>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Delete every object below a storage-relative prefix.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§