_Cache

Trait _Cache 

Source
pub trait _Cache {
    // Required methods
    fn new(
        mem_size: Option<usize>,
        tmp_path: PathBuf,
        thread_num: usize,
    ) -> Self
       where Self: Sized;
    fn get_hash(&self, offset: usize) -> Option<SHA1>;
    fn insert(
        &self,
        offset: usize,
        hash: SHA1,
        obj: CacheObject,
    ) -> Arc<CacheObject>;
    fn get_by_offset(&self, offset: usize) -> Option<Arc<CacheObject>>;
    fn get_by_hash(&self, h: SHA1) -> Option<Arc<CacheObject>>;
    fn total_inserted(&self) -> usize;
    fn memory_used(&self) -> usize;
    fn clear(&self);
}

Required Methods§

Source

fn new(mem_size: Option<usize>, tmp_path: PathBuf, thread_num: usize) -> Self
where Self: Sized,

Source

fn get_hash(&self, offset: usize) -> Option<SHA1>

Source

fn insert( &self, offset: usize, hash: SHA1, obj: CacheObject, ) -> Arc<CacheObject>

Source

fn get_by_offset(&self, offset: usize) -> Option<Arc<CacheObject>>

Source

fn get_by_hash(&self, h: SHA1) -> Option<Arc<CacheObject>>

Source

fn total_inserted(&self) -> usize

Source

fn memory_used(&self) -> usize

Source

fn clear(&self)

Implementors§