Skip to main content

Module index_db

Module index_db 

Source

Structs§

EmbeddingDiagnostics
Result of a side-band embedding-lane health probe.
IndexedRuleChunk
QueryFilter
Metadata pre-filter for query_rule_chunks / fts_search. Each field is optional and acts as an AND clause: when set, rows must match the given value. repo_scope is exact when present; callers that inject rules into agents should pass the current repo/project and avoid unscoped fallback.
RuleChunksUpsertOutcome

Functions§

effective_embedding_profile_for_freshness
The embedding profile the index-freshness check should expect for the active embedder, accounting for a remote provider that is currently failing.
fts_search
FTS5 keyword search. Returns (chunk_id, rank) pairs ordered by BM25 rank (smaller = better in SQLite FTS5). top_k caps the result size BEFORE the metadata filter is applied — we fetch top_k * 4 raw candidates from FTS then post-filter in Rust so rules that fail the metadata check don’t eat into the keyword budget.
gather_embedding_diagnostics
Gather a side-band embedding-lane diagnostic for one project.
gather_embedding_diagnostics_with_activity
Variant of gather_embedding_diagnostics that additionally consults the activity stream: if the static profile comparison did not already flag degradation but a recent embed call fell back to local SHA1, the lane is reported as provider_fallback (a query-time regression the persisted profile cannot see). Best-effort — a missing activity log is simply ignored.
get_pool_for_cwd
Resolve the per-project pool for the current working directory. Convenience wrapper that determines the project root, hashes it, and calls get_pool_for_project. Callers that already hold a hash should call get_pool_for_project directly.
get_pool_for_project
Get or lazily create the index_db pool for a project. Pool creation is serialised on the cache mutex so two tool calls racing on the same project produce exactly one pool.
index_db_path_for_project
Per-project path: ~/.difflore/projects/{hash}/context-index.db. Public so supporting tools can target the same file the runtime opens.
mark_rule_index_current
open_index_pool_at
Open a standalone, fully-migrated index-DB pool at an explicit path.
query_rule_chunks
Load chunks from the index DB applying the metadata pre-filter at the SQL layer. filter.language matches exact equality when set; filter.repo_scope matches exact equality when set. NULL repo scope is unattributed metadata and must not be widened into another repo at runtime.
rule_index_is_current
upsert_rule_chunks
upsert_rule_chunks_isolated
Build a fully self-contained rule index in pool for an ephemeral, throwaway corpus (the difflore try demo). Assumes a fresh pool.
upsert_rule_chunks_with_profile
upsert_rule_chunks_with_profile_and_timeout