[−][src]Trait ipfs_sqlite_block_store::cache::CacheTracker
tracks block reads and writes to provide info about which blocks to evict from the LRU cache
Provided methods
pub fn blocks_accessed(&self, blocks: Vec<BlockInfo>)
[src]
called whenever blocks were accessed
note that this method will be called very frequently, on every block access. it is fire and forget, so it is perfectly ok to offload the writing to another thread.
pub fn blocks_written(&self, blocks: Vec<WriteInfo>)
[src]
called whenever blocks were written
note that this method will be called frequently, on every block write. it is fire and forget, so it is perfectly ok to offload the writing to another thread.
pub fn blocks_deleted(&self, blocks: Vec<BlockInfo>)
[src]
called whenever blocks have been deleted by gc.
pub fn sort_ids(&self, ids: &mut [i64])
[src]
sort ids by importance. More important ids should go to the end.
this will be called from inside gc
pub fn retain_ids(&self, ids: &[i64])
[src]
notification that only these ids should be retained
this will be called once during startup
Implementations on Foreign Types
impl CacheTracker for Box<dyn CacheTracker>
[src]
pub fn blocks_accessed(&self, blocks: Vec<BlockInfo>)
[src]
pub fn blocks_written(&self, blocks: Vec<WriteInfo>)
[src]
pub fn sort_ids(&self, ids: &mut [i64])
[src]
pub fn blocks_deleted(&self, blocks: Vec<BlockInfo>)
[src]
pub fn retain_ids(&self, ids: &[i64])
[src]
Implementors
impl CacheTracker for NoopCacheTracker
[src]
impl CacheTracker for SortByIdCacheTracker
[src]
impl<F> CacheTracker for SqliteCacheTracker<F> where
F: Fn(i64, BlockInfo) -> Option<i64> + Send,
[src]
F: Fn(i64, BlockInfo) -> Option<i64> + Send,
pub fn blocks_accessed(&self, blocks: Vec<BlockInfo>)
[src]
pub fn blocks_deleted(&self, blocks: Vec<BlockInfo>)
[src]
pub fn retain_ids(&self, ids: &[i64])
[src]
pub fn sort_ids(&self, ids: &mut [i64])
[src]
impl<S, T> CacheTracker for AsyncCacheTracker<S, T> where
S: Spawner,
T: CacheTracker + Send + 'static,
[src]
S: Spawner,
T: CacheTracker + Send + 'static,
pub fn blocks_accessed(&self, blocks: Vec<BlockInfo>)
[src]
pub fn blocks_written(&self, blocks: Vec<WriteInfo>)
[src]
pub fn blocks_deleted(&self, blocks: Vec<BlockInfo>)
[src]
pub fn retain_ids(&self, ids: &[i64])
[src]
pub fn sort_ids(&self, ids: &mut [i64])
[src]
impl<T, F> CacheTracker for InMemCacheTracker<T, F> where
T: Ord + Clone + Debug + Send,
F: Fn(Duration, BlockInfo) -> Option<T> + Send,
[src]
T: Ord + Clone + Debug + Send,
F: Fn(Duration, BlockInfo) -> Option<T> + Send,
pub fn blocks_accessed(&self, blocks: Vec<BlockInfo>)
[src]
called whenever blocks were accessed
pub fn blocks_deleted(&self, blocks: Vec<BlockInfo>)
[src]
notification that these ids no longer have to be tracked
pub fn retain_ids(&self, ids: &[i64])
[src]
notification that only these ids should be retained
pub fn sort_ids(&self, ids: &mut [i64])
[src]
sort ids by importance. More important ids should go to the end.