pub struct IndexStore { /* private fields */ }Expand description
SQLite-backed symbol index store.
Implementations§
Source§impl IndexStore
impl IndexStore
Sourcepub fn open(db_path: &Path) -> Result<Self>
pub fn open(db_path: &Path) -> Result<Self>
Open (or create) the index database at the given path.
§Errors
Returns an error if the database can’t be opened or schema migration fails.
Sourcepub fn insert_symbols(&self, path: &str, symbols: &[CachedSymbol]) -> Result<()>
pub fn insert_symbols(&self, path: &str, symbols: &[CachedSymbol]) -> Result<()>
Insert symbols for a file, replacing any existing ones.
Sourcepub fn batch_commit(
&self,
results: &[(String, String, Vec<CachedSymbol>)],
) -> Result<usize>
pub fn batch_commit( &self, results: &[(String, String, Vec<CachedSymbol>)], ) -> Result<usize>
Write all index results in a single transaction for performance.
This is ~100x faster than individual inserts because it avoids per-statement autocommit overhead.
Sourcepub fn find_symbols_by_name(&self, name: &str) -> Result<Vec<CachedSymbol>>
pub fn find_symbols_by_name(&self, name: &str) -> Result<Vec<CachedSymbol>>
Find symbols by name (exact match).
Sourcepub fn find_symbols_by_path(&self, path: &str) -> Result<Vec<CachedSymbol>>
pub fn find_symbols_by_path(&self, path: &str) -> Result<Vec<CachedSymbol>>
Find symbols by file path.
Sourcepub fn get_file_hash(&self, path: &str) -> Result<Option<String>>
pub fn get_file_hash(&self, path: &str) -> Result<Option<String>>
Get the stored BLAKE3 hash for a file.
Sourcepub fn cache_get(&self, request_hash: &str) -> Result<Option<String>>
pub fn cache_get(&self, request_hash: &str) -> Result<Option<String>>
Get a cached LSP response by request hash.
Sourcepub fn cache_put(&self, request_hash: &str, response_json: &str) -> Result<()>
pub fn cache_put(&self, request_hash: &str, response_json: &str) -> Result<()>
Store a cached LSP response.
Sourcepub fn upsert_workspace(&self, path: &str, language: &str) -> Result<()>
pub fn upsert_workspace(&self, path: &str, language: &str) -> Result<()>
Insert or update a workspace entry.
Sourcepub fn set_workspace_attached(&self, path: &str) -> Result<()>
pub fn set_workspace_attached(&self, path: &str) -> Result<()>
Mark a workspace as attached (LSP folder added to server).
Sourcepub fn set_workspace_detached(&self, path: &str) -> Result<()>
pub fn set_workspace_detached(&self, path: &str) -> Result<()>
Mark a workspace as detached (LSP folder removed from server).
Sourcepub fn touch_workspace(&self, path: &str) -> Result<()>
pub fn touch_workspace(&self, path: &str) -> Result<()>
Update last_used_at for a workspace (called on every query).
Sourcepub fn list_workspaces(&self) -> Result<Vec<WorkspaceInfo>>
pub fn list_workspaces(&self) -> Result<Vec<WorkspaceInfo>>
List all workspaces.
Sourcepub fn get_lru_attached(&self, language: &str) -> Result<Option<String>>
pub fn get_lru_attached(&self, language: &str) -> Result<Option<String>>
Get the oldest attached workspace for a language (for LRU eviction).
Sourcepub fn workspace_counts(&self) -> Result<(usize, usize)>
pub fn workspace_counts(&self) -> Result<(usize, usize)>
Count workspaces by status.
Sourcepub fn clear_workspaces(&self) -> Result<()>
pub fn clear_workspaces(&self) -> Result<()>
Remove all workspaces (used before re-populating on init).
Sourcepub fn count_all_symbols(&self) -> Result<u64>
pub fn count_all_symbols(&self) -> Result<u64>
Run post-index optimization pragmas (call after krait init completes). Count the total number of symbols in the database.
pub fn optimize(&self) -> Result<()>
Sourcepub fn get_file_hashes_batch(
&self,
paths: &[&str],
) -> Result<HashMap<String, String>>
pub fn get_file_hashes_batch( &self, paths: &[&str], ) -> Result<HashMap<String, String>>
Get file hashes for multiple paths in a single query.
Sourcepub fn upsert_server_capabilities(
&self,
server_name: &str,
workspace_folders_supported: bool,
work_done_progress: bool,
) -> Result<()>
pub fn upsert_server_capabilities( &self, server_name: &str, workspace_folders_supported: bool, work_done_progress: bool, ) -> Result<()>
Persist server capability flags (survives daemon restarts).
Sourcepub fn get_server_capabilities(
&self,
server_name: &str,
) -> Result<Option<(bool, bool)>>
pub fn get_server_capabilities( &self, server_name: &str, ) -> Result<Option<(bool, bool)>>
Read persisted capability flags for a server. Returns None if not found.
Sourcepub fn delete_file(&self, path: &str) -> Result<()>
pub fn delete_file(&self, path: &str) -> Result<()>
Delete a file and all its symbols (via CASCADE).
Auto Trait Implementations§
impl !Freeze for IndexStore
impl !RefUnwindSafe for IndexStore
impl Send for IndexStore
impl !Sync for IndexStore
impl Unpin for IndexStore
impl UnsafeUnpin for IndexStore
impl !UnwindSafe for IndexStore
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more