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>,
start_time: DateTime<Utc>,
) -> Result<()>;
fn cleanup<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn shutdown<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn advise_low_memory<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<isize>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
}
Required Methods§
sourcefn 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 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
sourcefn 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 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
sourcefn 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 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
sourcefn enumerate(
&self,
sender: Sender<SpoolEntry>,
start_time: DateTime<Utc>,
) -> Result<()>
fn enumerate( &self, sender: Sender<SpoolEntry>, start_time: DateTime<Utc>, ) -> 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.
sourcefn cleanup<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
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
sourcefn shutdown<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn shutdown<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Shutdown the store
sourcefn advise_low_memory<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<isize>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn advise_low_memory<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<isize>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Called when system memory is low. The spool module should flush and drop caches. Returns the number of bytes that were saved, which might be negative if the flush actually increased the total.