pub struct AsgIndexStore<'a> {
pub repo: &'a Repository,
/* private fields */
}Expand description
ASD index reader/writer.
Hot-path read methods (get_symbol_by_qname, get_callers, get_callees,
build_id_map) hit the SQLite cache populated at asd index time. Git is
only consulted on cache miss.
The FTS connection is borrowed from the owning Engine (opened once in
Engine::open_sqlite) so no Connection::open occurs at store construction
or on any method call.
Fields§
§repo: &'a RepositoryImplementations§
Source§impl<'a> AsgIndexStore<'a>
impl<'a> AsgIndexStore<'a>
Sourcepub fn new(repo: &'a Repository) -> Self
pub fn new(repo: &'a Repository) -> Self
Construct without SQLite caching (tests, one-off internal calls).
Sourcepub fn from_engine(engine: &'a Engine) -> Self
pub fn from_engine(engine: &'a Engine) -> Self
Convenience: borrow the FTS connection already open in engine.
Sourcepub fn build_id_map(&self, engine: &Engine) -> HashMap<String, Symbol>
pub fn build_id_map(&self, engine: &Engine) -> HashMap<String, Symbol>
Build the full symbol_id → Symbol map using the borrowed FTS connection.
Falls back to the git by-qname tree walk on cache miss.
Sourcepub fn build_edge_maps(
&self,
engine: &Engine,
) -> (HashMap<String, Vec<String>>, HashMap<String, Vec<String>>)
pub fn build_edge_maps( &self, engine: &Engine, ) -> (HashMap<String, Vec<String>>, HashMap<String, Vec<String>>)
Build both full edge maps — (callers_of, callees_of), each
symbol_id → [neighbor_id, …] — using the borrowed FTS connection,
falling back to one git tree walk per direction on cache miss.
The bulk analog of get_callers/get_callees: callers that touch
many nodes per request (e.g. the /graph BFS) use this instead of one
per-node git read. Same cache guard as the per-symbol getters
(symbols_cached_for), so cached and per-symbol reads always agree.
Trait Implementations§
Source§impl<'a> IndexStore for AsgIndexStore<'a>
impl<'a> IndexStore for AsgIndexStore<'a>
Source§fn get_symbol_by_qname_lang(
&self,
ref_name: &str,
qname: &str,
language_hint: Option<&str>,
) -> Result<Option<Symbol>>
fn get_symbol_by_qname_lang( &self, ref_name: &str, qname: &str, language_hint: Option<&str>, ) -> Result<Option<Symbol>>
Plan J t-009: cross-language qname resolution. See trait docs. The lookup is two-step:
- Try the primary qname index. If its language matches the hint (or no hint was given), return it — no extra reads.
- Otherwise walk
/asd/v1/code/{lang_hint}/for a symbol whose qname equalsqname. Return the first match. - If the per-language tree has no match, fall back to the
primary entry. Returning the qname-index hit (even
language-mismatched) is more useful than
None— downstream code can inspectSymbol.languageand decide.