Skip to main content

AsgIndexStore

Struct AsgIndexStore 

Source
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 Repository

Implementations§

Source§

impl<'a> AsgIndexStore<'a>

Source

pub fn new(repo: &'a Repository) -> Self

Construct without SQLite caching (tests, one-off internal calls).

Source

pub fn from_engine(engine: &'a Engine) -> Self

Convenience: borrow the FTS connection already open in engine.

Source

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.

Source

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>

Source§

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:

  1. Try the primary qname index. If its language matches the hint (or no hint was given), return it — no extra reads.
  2. Otherwise walk /asd/v1/code/{lang_hint}/ for a symbol whose qname equals qname. Return the first match.
  3. 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 inspect Symbol.language and decide.
Source§

fn put_symbol( &self, ref_name: &str, symbol: &Symbol, agent_id: &str, ) -> Result<()>

Source§

fn get_symbol_by_qname( &self, ref_name: &str, qname: &str, ) -> Result<Option<Symbol>>

Source§

fn get_callees(&self, ref_name: &str, symbol_id: &str) -> Result<Vec<String>>

Read the callees list previously written for symbol_id. Returns an empty Vec if no edges have been recorded.
Source§

fn get_callers(&self, ref_name: &str, symbol_id: &str) -> Result<Vec<String>>

Read the callers list previously written for symbol_id. Returns an empty Vec if no edges have been recorded.

Auto Trait Implementations§

§

impl<'a> !RefUnwindSafe for AsgIndexStore<'a>

§

impl<'a> !Send for AsgIndexStore<'a>

§

impl<'a> !Sync for AsgIndexStore<'a>

§

impl<'a> !UnwindSafe for AsgIndexStore<'a>

§

impl<'a> Freeze for AsgIndexStore<'a>

§

impl<'a> Unpin for AsgIndexStore<'a>

§

impl<'a> UnsafeUnpin for AsgIndexStore<'a>

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, 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, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

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.