Trait CacheTracker

Source
pub trait CacheTracker:
    Debug
    + Send
    + Sync {
    // Required method
    fn has_persistent_state(&self) -> bool;

    // Provided methods
    fn blocks_accessed(&self, blocks: Vec<BlockInfo>) { ... }
    fn blocks_written(&self, blocks: Vec<WriteInfo>) { ... }
    fn blocks_deleted(&self, blocks: Vec<BlockInfo>) { ... }
    fn sort_ids(&self, ids: &mut [i64]) { ... }
    fn retain_ids(&self, ids: &[i64]) { ... }
}
Expand description

tracks block reads and writes to provide info about which blocks to evict from the LRU cache

Required Methods§

Source

fn has_persistent_state(&self) -> bool

indicate whether retain_ids should be called on startup

Provided Methods§

Source

fn blocks_accessed(&self, blocks: Vec<BlockInfo>)

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.

Source

fn blocks_written(&self, blocks: Vec<WriteInfo>)

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.

Source

fn blocks_deleted(&self, blocks: Vec<BlockInfo>)

called whenever blocks have been deleted by gc.

Source

fn sort_ids(&self, ids: &mut [i64])

sort ids by importance. More important ids should go to the end.

this will be called from inside gc

Source

fn retain_ids(&self, ids: &[i64])

notification that only these ids should be retained

this will be called once during startup

Implementations on Foreign Types§

Source§

impl CacheTracker for Arc<dyn CacheTracker>

Source§

fn blocks_accessed(&self, blocks: Vec<BlockInfo>)

Source§

fn blocks_written(&self, blocks: Vec<WriteInfo>)

Source§

fn sort_ids(&self, ids: &mut [i64])

Source§

fn blocks_deleted(&self, blocks: Vec<BlockInfo>)

Source§

fn has_persistent_state(&self) -> bool

Source§

fn retain_ids(&self, ids: &[i64])

Implementors§