Skip to main content

IndexStore

Struct IndexStore 

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

SQLite-backed symbol index store.

Implementations§

Source§

impl IndexStore

Source

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.

Source

pub fn upsert_file(&self, path: &str, hash: &str) -> Result<()>

Insert or update a file entry.

Source

pub fn insert_symbols(&self, path: &str, symbols: &[CachedSymbol]) -> Result<()>

Insert symbols for a file, replacing any existing ones.

Source

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.

Source

pub fn find_symbols_by_name(&self, name: &str) -> Result<Vec<CachedSymbol>>

Find symbols by name (exact match).

Source

pub fn find_symbols_by_path(&self, path: &str) -> Result<Vec<CachedSymbol>>

Find symbols by file path.

Source

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

Get the stored BLAKE3 hash for a file.

Source

pub fn cache_get(&self, request_hash: &str) -> Result<Option<String>>

Get a cached LSP response by request hash.

Source

pub fn cache_put(&self, request_hash: &str, response_json: &str) -> Result<()>

Store a cached LSP response.

Source

pub fn upsert_workspace(&self, path: &str, language: &str) -> Result<()>

Insert or update a workspace entry.

Source

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

Mark a workspace as attached (LSP folder added to server).

Source

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

Mark a workspace as detached (LSP folder removed from server).

Source

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

Update last_used_at for a workspace (called on every query).

Source

pub fn list_workspaces(&self) -> Result<Vec<WorkspaceInfo>>

List all workspaces.

Source

pub fn get_lru_attached(&self, language: &str) -> Result<Option<String>>

Get the oldest attached workspace for a language (for LRU eviction).

Source

pub fn workspace_counts(&self) -> Result<(usize, usize)>

Count workspaces by status.

Source

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

Remove all workspaces (used before re-populating on init).

Source

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.

Source

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

Source

pub fn get_file_hashes_batch( &self, paths: &[&str], ) -> Result<HashMap<String, String>>

Get file hashes for multiple paths in a single query.

Source

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).

Source

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.

Source

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

Delete a file and all its symbols (via CASCADE).

Auto Trait Implementations§

Blanket Implementations§

Source§

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

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

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

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

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

Source§

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

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

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

Source§

fn into(self) -> U

Calls U::from(self).

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

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

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

Source§

type Error = Infallible

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

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

Performs the conversion.
Source§

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

Source§

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

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

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

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more