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<()>;
    fn get_file_symbols(&self, path: &str) -> Result<Vec<(String, String)>>;
    fn get_file_content(&self, path: &str) -> Result<Option<Vec<u8>>>;
    fn list_file_paths(&self) -> Result<Vec<String>>;
    fn list_files_with_symbols(&self) -> Result<FileSymbolList>;
    fn search_symbol_ids(&self, like_pattern: &str) -> Result<Vec<String>>;
}

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

Source

fn get_file_symbols(&self, path: &str) -> Result<Vec<(String, String)>>

Get symbols for a file

Source

fn get_file_content(&self, path: &str) -> Result<Option<Vec<u8>>>

Get the raw content bytes of a file by path

Source

fn list_file_paths(&self) -> Result<Vec<String>>

List all file paths stored in the database

Source

fn list_files_with_symbols(&self) -> Result<FileSymbolList>

List all files with their associated symbols (kind, name), ordered by byte_offset

Source

fn search_symbol_ids(&self, like_pattern: &str) -> Result<Vec<String>>

Search symbol IDs whose name matches a SQL LIKE pattern

Implementors§