IndexStore

Struct IndexStore 

Source
pub struct IndexStore { /* private fields */ }

Implementations§

Source§

impl IndexStore

Source

pub fn open(path: &Path) -> Result<Self>

Open a database, creating it if it doesn’t exist. This method always succeeds if the file can be created/opened. Use try_open() for version-aware opening with migration support.

Source

pub fn try_open(path: &Path) -> Result<DbOpenResult>

Try to open a database with version checking. Returns DbOpenResult::Ready if the database is compatible. Returns DbOpenResult::NeedsRegeneration if the database needs to be rebuilt.

Source

pub fn remove_file<P: AsRef<Path>>(&self, path: P) -> Result<()>

Source

pub fn list_paths(&self) -> Result<HashSet<String>>

Source

pub fn save_file_index( &self, file_record: &FileRecord, symbols: &[SymbolRecord], edges: &[EdgeRecord], references: &[ReferenceRecord], ) -> Result<()>

Source

pub fn save_file_index_without_refs( &self, file_record: &FileRecord, symbols: &[SymbolRecord], edges: &[EdgeRecord], ) -> Result<()>

Save file index without references (used in two-phase indexing first pass)

Source

pub fn save_references( &self, file_path: &str, references: &[ReferenceRecord], ) -> Result<()>

Save resolved references for a file (used in two-phase indexing second pass)

Source

pub fn db_path(&self) -> &Path

Source

pub fn analyze(&self) -> Result<()>

Update query optimizer statistics for better index usage. Should be called after bulk indexing operations.

Source

pub fn get_file_stats(&self, file: &str) -> Result<Option<FileStats>>

Get pre-computed statistics for a file (O(1) lookup).

Source

pub fn get_total_stats(&self) -> Result<FileStats>

Get total symbol counts across all indexed files (O(1) aggregate).

Source

pub fn save_file_dependencies( &self, from_file: &str, dependencies: &[FileDependency], ) -> Result<()>

Save file dependencies for a source file, replacing any existing dependencies.

Source

pub fn get_file_dependencies(&self, file: &str) -> Result<Vec<FileDependency>>

Get files that a given file depends on (imports/uses).

Source

pub fn get_dependents(&self, file: &str) -> Result<Vec<String>>

Get files that depend on a given file (reverse dependencies for invalidation).

Source

pub fn get_all_dependencies(&self) -> Result<Vec<FileDependency>>

Get all file dependencies in the workspace.

Source

pub fn topological_sort(&self, files: &[String]) -> Result<Vec<String>>

Topologically sort files for rebuild ordering. Returns files in an order where dependencies come before dependents. Uses Kahn’s algorithm with O(V + E) complexity. Files with cycles are appended at the end in arbitrary order.

Source

pub fn get_invalidation_set(&self, changed_file: &str) -> Result<Vec<String>>

Get all files that need to be invalidated when a file changes. Returns the transitive closure of reverse dependencies. Useful for incremental rebuilds when a source file is modified.

Source

pub fn get_batch_invalidation_set( &self, changed_files: &[String], ) -> Result<Vec<String>>

Get files that need invalidation for multiple changed files. Returns the union of invalidation sets, topologically sorted.

Source

pub fn load_dependency_cache(&self) -> Result<DependencyCache>

Load all dependencies into a DependencyCache for O(1) lookups. Call this once at startup for long-running processes.

Source

pub fn list_symbols( &self, file: Option<&str>, kind: Option<&str>, name: Option<&str>, limit: Option<usize>, ) -> Result<Vec<SymbolRecord>>

Source

pub fn edges_to(&self, dst: &str) -> Result<Vec<EdgeRecord>>

Query edges by destination with cached prepared statement.

Source

pub fn edges_from(&self, src: &str) -> Result<Vec<EdgeRecord>>

Query edges by source with cached prepared statement.

Source

pub fn symbols_by_ids(&self, ids: &[String]) -> Result<Vec<SymbolRecord>>

Source

pub fn references_for_symbol( &self, symbol_id: &str, ) -> Result<Vec<ReferenceRecord>>

Query references by symbol ID with cached prepared statement.

Source

pub fn reference_at_position( &self, file: &str, offset: i64, ) -> Result<Option<ReferenceRecord>>

Find a reference at a specific file and byte offset. Returns the reference record if the offset falls within a recorded reference span.

Source

pub fn find_duplicate_groups( &self, min_count: usize, kind_filter: Option<&str>, file_filter: Option<&[String]>, ) -> Result<Vec<DuplicateGroup>>

Find all groups of duplicate symbols (symbols with the same content_hash). Returns groups sorted by count (most duplicates first). Only includes groups with 2+ symbols and content_hash is not null.

Source

pub fn symbols_by_content_hash(&self, hash: &str) -> Result<Vec<SymbolRecord>>

Find all symbols with a specific content hash.

Source

pub fn content_hashes_in_files( &self, files: &[String], ) -> Result<HashSet<String>>

Get content hashes for symbols in specific files. Used for –uncommitted flag to find duplicates involving changed files.

Source

pub fn search_symbols_fts(&self, query: &str) -> Result<Vec<SymbolRecord>>

Search symbols using FTS5 full-text search. Supports prefix queries (e.g., “getUser*”) and substring matching via trigram tokenization. Uses cached prepared statement for repeated searches.

Source

pub fn list_symbols_paginated( &self, file: Option<&str>, kind: Option<&str>, name: Option<&str>, cursor: Option<&str>, page_size: usize, ) -> Result<(Vec<SymbolRecord>, Option<String>)>

Query symbols with cursor-based pagination for streaming large result sets. Returns (results, next_cursor) where next_cursor can be used to fetch the next page.

Trait Implementations§

Source§

impl Debug for IndexStore

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

§

impl<T> Any for T
where T: 'static + ?Sized,

§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
§

impl<T> Borrow<T> for T
where T: ?Sized,

§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
§

impl<T> BorrowMut<T> for T
where T: ?Sized,

§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
§

impl<T> From<T> for T

§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T, U> Into<U> for T
where U: From<T>,

§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.