Trait spool::Spool

source ·
pub trait Spool: Send + Sync {
    // Required methods
    fn load<'life0, 'async_trait>(
        &'life0 self,
        id: SpoolId,
    ) -> Pin<Box<dyn Future<Output = Result<Vec<u8>>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn remove<'life0, 'async_trait>(
        &'life0 self,
        id: SpoolId,
    ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn store<'life0, 'async_trait>(
        &'life0 self,
        id: SpoolId,
        data: Arc<Box<[u8]>>,
        force_sync: bool,
    ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn enumerate(&self, sender: Sender<SpoolEntry>) -> Result<()>;
    fn cleanup<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
}

Required Methods§

source

fn load<'life0, 'async_trait>( &'life0 self, id: SpoolId, ) -> Pin<Box<dyn Future<Output = Result<Vec<u8>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Load the data corresponding to the provided Id

source

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

Remove the data associated with the provided Id

source

fn store<'life0, 'async_trait>( &'life0 self, id: SpoolId, data: Arc<Box<[u8]>>, force_sync: bool, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Write/Replace the data associated with the provided Id

source

fn enumerate(&self, sender: Sender<SpoolEntry>) -> Result<()>

Scan the contents of the spool, and emit a SpoolEntry for each item to the provided channel sender. The items are enumerated in an unspecified order. It is recommended that you use a bounded channel.

The results are undefined if you enumerate concurrently with load/remove/store operations.

source

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

Perform some periodic cleanup/maintenance

Implementors§