Trait easy_fs::block_cache::CacheManager
source · [−]pub trait CacheManager {
type CacheType: Cache;
const CACHE_SZ: usize;
fn new() -> Self
where
Self: Sized;
fn try_get_block_cache(
&mut self,
block_id: usize,
inner_cache_id: usize
) -> Option<Arc<Mutex<Self::CacheType>>>;
fn get_block_cache<FUNC>(
&mut self,
block_id: usize,
inner_cache_id: usize,
neighbor: FUNC,
block_device: Arc<dyn BlockDevice>
) -> Arc<Mutex<Self::CacheType>>
where
FUNC: Fn() -> Vec<usize>;
}
Associated Types
Associated Constants
Required methods
Try to get the block cache and return None
if not found.
Argument
block_id
: The demanded block.
inner_blk_id
: The ordinal number of the block inside the block.
inode_id
: The inode_id the block cache belongs to.
Attempt to get block cache from the cache. If failed, the manager should try to copy the block from sdcard.
Argument
block_id
: The demanded block.
inner_blk_id
: The ordinal number of the block inside the block.
inode_id
: The inode_id the block cache belongs to.
block_device
: The pointer to the block_device.