Skip to main content

IndexStore

Trait IndexStore 

Source
pub trait IndexStore {
    // Required methods
    fn put_symbol(
        &self,
        ref_name: &str,
        symbol: &Symbol,
        agent_id: &str,
    ) -> Result<()>;
    fn get_symbol_by_qname(
        &self,
        ref_name: &str,
        qname: &str,
    ) -> Result<Option<Symbol>>;

    // Provided methods
    fn get_symbol_by_qname_lang(
        &self,
        ref_name: &str,
        qname: &str,
        _language_hint: Option<&str>,
    ) -> Result<Option<Symbol>> { ... }
    fn get_callees(
        &self,
        _ref_name: &str,
        _symbol_id: &str,
    ) -> Result<Vec<String>> { ... }
    fn get_callers(
        &self,
        _ref_name: &str,
        _symbol_id: &str,
    ) -> Result<Vec<String>> { ... }
}

Required Methods§

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

Provided Methods§

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.

When two adapters produce the same qname (e.g. auth.User from a Python module and a Swift struct with the same fully qualified name), the primary qname index at /asd/v1/index/by-qname/{qname} holds whichever was written last — every prior language’s symbol at that qname is overwritten in that secondary index. The authoritative per-language code tree at /asd/v1/code/{lang}/{file}/... still has both, but lookups by qname alone silently pick the winner of an arbitrary write order.

This method takes an explicit language hint. If the primary qname-index entry’s language matches the hint, return it (fast path). Otherwise walk the code/{hint}/ tree for a symbol with the requested qname; return it if found, else fall back to the primary entry (better to return something matching the qname than nothing — the caller can still see the language mismatch on the returned Symbol).

Default impl forwards to the language-agnostic get_symbol_by_qname. Adapters that can resolve polyglot collisions override this.

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.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§