Skip to main content

CacheStore

Trait CacheStore 

Source
pub trait CacheStore {
    // Required methods
    fn init(&self) -> Result<()>;
    fn upsert_file(&self, path: &str, hash: &str, content: &[u8]) -> Result<i64>;
    fn get_file_hash(&self, path: &str) -> Result<Option<String>>;
    fn insert_symbol(&self, symbol: &Symbol) -> Result<()>;
    fn get_symbol_content(&self, symbol_id: &str) -> Result<Option<Vec<u8>>>;
    fn delete_file(&self, path: &str) -> Result<()>;
}

Required Methods§

Source

fn init(&self) -> Result<()>

Initialize the database schema

Source

fn upsert_file(&self, path: &str, hash: &str, content: &[u8]) -> Result<i64>

Insert or update a file and its content. Returns the file_id.

Source

fn get_file_hash(&self, path: &str) -> Result<Option<String>>

Get a file’s hash to check if it has changed

Source

fn insert_symbol(&self, symbol: &Symbol) -> Result<()>

Insert a symbol

Source

fn get_symbol_content(&self, symbol_id: &str) -> Result<Option<Vec<u8>>>

Retrieve the raw bytes of a symbol using SQLite substr()

Source

fn delete_file(&self, path: &str) -> Result<()>

Delete a file and cascade delete its symbols

Implementors§