pub trait DataCache {
// Required methods
fn get_block<'life0, 'life1, 'async_trait>(
&'life0 self,
cache_key: &'life1 ObjectId,
block_idx: BlockIndex,
block_offset: u64,
object_size: usize,
) -> Pin<Box<dyn Future<Output = DataCacheResult<Option<ChecksummedBytes>>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn put_block<'life0, 'async_trait>(
&'life0 self,
cache_key: ObjectId,
block_idx: BlockIndex,
block_offset: u64,
bytes: ChecksummedBytes,
object_size: usize,
) -> Pin<Box<dyn Future<Output = DataCacheResult<()>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn block_size(&self) -> u64;
}Expand description
Data cache for fixed-size checksummed buffers.
TODO: Deletion and eviction of cache entries. TODO: Some version information (ETag) independent from ObjectId to allow smarter eviction?
Required Methods§
Sourcefn get_block<'life0, 'life1, 'async_trait>(
&'life0 self,
cache_key: &'life1 ObjectId,
block_idx: BlockIndex,
block_offset: u64,
object_size: usize,
) -> Pin<Box<dyn Future<Output = DataCacheResult<Option<ChecksummedBytes>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn get_block<'life0, 'life1, 'async_trait>(
&'life0 self,
cache_key: &'life1 ObjectId,
block_idx: BlockIndex,
block_offset: u64,
object_size: usize,
) -> Pin<Box<dyn Future<Output = DataCacheResult<Option<ChecksummedBytes>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Get block of data from the cache for the given ObjectId and BlockIndex, if available.
Operation may fail due to errors, or return None if the block was not available in the cache.
Sourcefn put_block<'life0, 'async_trait>(
&'life0 self,
cache_key: ObjectId,
block_idx: BlockIndex,
block_offset: u64,
bytes: ChecksummedBytes,
object_size: usize,
) -> Pin<Box<dyn Future<Output = DataCacheResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn put_block<'life0, 'async_trait>(
&'life0 self,
cache_key: ObjectId,
block_idx: BlockIndex,
block_offset: u64,
bytes: ChecksummedBytes,
object_size: usize,
) -> Pin<Box<dyn Future<Output = DataCacheResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Put block of data to the cache for the given ObjectId and BlockIndex.
Sourcefn block_size(&self) -> u64
fn block_size(&self) -> u64
Returns the block size for the data cache.