pub trait DataBlockCache<InsertError>:
Send
+ Sync
+ Display
+ Sized
+ 'static {
// Required methods
fn new(
capacity_mb: u64,
block_size: u64,
total_size: u64,
) -> Result<Self, CacheError<InsertError>>;
fn get<'life0, 'async_trait>(
&'life0 self,
pos: u64,
) -> Pin<Box<dyn Future<Output = Option<RwLockReadGuard<'_, Block>>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn insert_lock<'life0, 'async_trait, A>(
&'life0 self,
pos: u64,
f: impl 'async_trait + Future<Output = Result<A, InsertError>> + Send,
) -> Pin<Box<dyn Future<Output = Result<RwLockReadGuard<'_, Block>, CacheError<InsertError>>> + Send + 'async_trait>>
where A: 'async_trait + AsRef<[u8]> + Send,
Self: 'async_trait,
'life0: 'async_trait;
fn stats(&self) -> &CacheStats;
}
Expand description
Block cache trait
Required Methods§
Sourcefn new(
capacity_mb: u64,
block_size: u64,
total_size: u64,
) -> Result<Self, CacheError<InsertError>>
fn new( capacity_mb: u64, block_size: u64, total_size: u64, ) -> Result<Self, CacheError<InsertError>>
Create a new block cache with given maximal capacity, block size, and cumulative size of all blocks.
Sourcefn get<'life0, 'async_trait>(
&'life0 self,
pos: u64,
) -> Pin<Box<dyn Future<Output = Option<RwLockReadGuard<'_, Block>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn get<'life0, 'async_trait>(
&'life0 self,
pos: u64,
) -> Pin<Box<dyn Future<Output = Option<RwLockReadGuard<'_, Block>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Get the block at a position.
Sourcefn insert_lock<'life0, 'async_trait, A>(
&'life0 self,
pos: u64,
f: impl 'async_trait + Future<Output = Result<A, InsertError>> + Send,
) -> Pin<Box<dyn Future<Output = Result<RwLockReadGuard<'_, Block>, CacheError<InsertError>>> + Send + 'async_trait>>
fn insert_lock<'life0, 'async_trait, A>( &'life0 self, pos: u64, f: impl 'async_trait + Future<Output = Result<A, InsertError>> + Send, ) -> Pin<Box<dyn Future<Output = Result<RwLockReadGuard<'_, Block>, CacheError<InsertError>>> + Send + 'async_trait>>
Insert a block at a position, locking until the output is ready.
Sourcefn stats(&self) -> &CacheStats
fn stats(&self) -> &CacheStats
Caching statistics.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.