Stager

Trait Stager 

Source
pub trait Stager: Send + Sync {
    type Blob: BlobGuard + Sync;
    type Dir: DirGuard;
    type FileHandle: ToString + Clone + Send + Sync;

    // Required methods
    fn get_blob<'a, 'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        handle: &'life1 Self::FileHandle,
        key: &'life2 str,
        init_factory: Box<dyn InitBlobFn + Send + Sync + 'a>,
    ) -> Pin<Box<dyn Future<Output = Result<Self::Blob>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'a: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait;
    fn get_dir<'a, 'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        handle: &'life1 Self::FileHandle,
        key: &'life2 str,
        init_fn: Box<dyn InitDirFn + Send + Sync + 'a>,
    ) -> Pin<Box<dyn Future<Output = Result<(Self::Dir, DirMetrics)>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'a: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait;
    fn put_dir<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        handle: &'life1 Self::FileHandle,
        key: &'life2 str,
        dir_path: PathBuf,
        dir_size: u64,
    ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait;
    fn purge<'life0, 'life1, 'async_trait>(
        &'life0 self,
        handle: &'life1 Self::FileHandle,
    ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
}
Expand description

Stager manages the staging area for the puffin files.

Required Associated Types§

Required Methods§

Source

fn get_blob<'a, 'life0, 'life1, 'life2, 'async_trait>( &'life0 self, handle: &'life1 Self::FileHandle, key: &'life2 str, init_factory: Box<dyn InitBlobFn + Send + Sync + 'a>, ) -> Pin<Box<dyn Future<Output = Result<Self::Blob>> + Send + 'async_trait>>
where Self: 'async_trait, 'a: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Retrieves a blob, initializing it if necessary using the provided init_fn.

The returned BlobGuard is used to access the blob reader. The caller is responsible for holding the BlobGuard until they are done with the blob.

Source

fn get_dir<'a, 'life0, 'life1, 'life2, 'async_trait>( &'life0 self, handle: &'life1 Self::FileHandle, key: &'life2 str, init_fn: Box<dyn InitDirFn + Send + Sync + 'a>, ) -> Pin<Box<dyn Future<Output = Result<(Self::Dir, DirMetrics)>> + Send + 'async_trait>>
where Self: 'async_trait, 'a: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Retrieves a directory, initializing it if necessary using the provided init_fn.

The returned tuple contains the DirGuard and DirMetrics. The DirGuard is used to access the directory in the filesystem. The caller is responsible for holding the DirGuard until they are done with the directory.

Source

fn put_dir<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, handle: &'life1 Self::FileHandle, key: &'life2 str, dir_path: PathBuf, dir_size: u64, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Stores a directory in the staging area.

Source

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

Purges all content for the given puffin file from the staging area.

Implementations on Foreign Types§

Source§

impl<T: Stager + ?Sized> Stager for Arc<T>
where Arc<T>: Send + Sync,

Source§

type Blob = <T as Stager>::Blob

Source§

type Dir = <T as Stager>::Dir

Source§

type FileHandle = <T as Stager>::FileHandle

Source§

fn get_blob<'a, 'life0, 'life1, 'life2, 'async_trait>( &'life0 self, handle: &'life1 Self::FileHandle, key: &'life2 str, init_factory: Box<dyn InitBlobFn + Send + Sync + 'a>, ) -> Pin<Box<dyn Future<Output = Result<Self::Blob>> + Send + 'async_trait>>
where Self: 'async_trait, 'a: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Source§

fn get_dir<'a, 'life0, 'life1, 'life2, 'async_trait>( &'life0 self, handle: &'life1 Self::FileHandle, key: &'life2 str, init_fn: Box<dyn InitDirFn + Send + Sync + 'a>, ) -> Pin<Box<dyn Future<Output = Result<(Self::Dir, DirMetrics)>> + Send + 'async_trait>>
where Self: 'async_trait, 'a: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Source§

fn put_dir<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, handle: &'life1 Self::FileHandle, key: &'life2 str, dir_path: PathBuf, dir_size: u64, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Source§

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

Implementors§