Trait mithril_persistence::store::StorePruner
source · pub trait StorePruner {
type Key: Sync + Send;
type Record: Sync + Send;
// Required methods
fn get_adapter(
&self,
) -> &RwLock<Box<dyn StoreAdapter<Key = Self::Key, Record = Self::Record>>>;
fn get_max_records(&self) -> Option<usize>;
// Provided method
fn prune<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = StdResult<()>> + Send + 'async_trait>>
where Self: Sync + 'async_trait,
'life0: 'async_trait { ... }
}
Expand description
Implementing this trait will make store able to limit the number of the stored records by pruning them if a limit is set.
Required Associated Types§
Required Methods§
sourcefn get_adapter(
&self,
) -> &RwLock<Box<dyn StoreAdapter<Key = Self::Key, Record = Self::Record>>>
fn get_adapter( &self, ) -> &RwLock<Box<dyn StoreAdapter<Key = Self::Key, Record = Self::Record>>>
This trait requires a way to get the internal adapter.
sourcefn get_max_records(&self) -> Option<usize>
fn get_max_records(&self) -> Option<usize>
Return the maximum number of elements that can exist in this store. If None, there is no limit.