pub struct InMemoryDataCache { /* private fields */ }Expand description
Simple in-memory (RAM) implementation of DataCache. Recommended for use in testing only.
Implementations§
Source§impl InMemoryDataCache
impl InMemoryDataCache
Sourcepub fn new(block_size: u64) -> Self
pub fn new(block_size: u64) -> Self
Create a new instance of an InMemoryDataCache with the specified block_size.
Sourcepub fn block_count(&self, cache_key: &ObjectId) -> usize
pub fn block_count(&self, cache_key: &ObjectId) -> usize
Get number of caching blocks for the given cache key.
Trait Implementations§
Source§impl DataCache for InMemoryDataCache
impl DataCache for InMemoryDataCache
Source§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 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,
Source§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 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.
Source§fn block_size(&self) -> u64
fn block_size(&self) -> u64
Returns the block size for the data cache.
Auto Trait Implementations§
impl !Freeze for InMemoryDataCache
impl RefUnwindSafe for InMemoryDataCache
impl Send for InMemoryDataCache
impl Sync for InMemoryDataCache
impl Unpin for InMemoryDataCache
impl UnwindSafe for InMemoryDataCache
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more