pub trait ExternalBuffer<T: Sized>: Send + Sync {
// Required methods
fn push<'life0, 'async_trait>(
&'life0 self,
item: T,
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn shift<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Option<T>, Error>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
}Expand description
The external buffer here allow us to:
- save items in an external perssistant storage to achieve crash save for data.
- even with a in memory buffer, we can still implement a priority queue for push and shift actions.