pub struct DiscoveryIndex { /* private fields */ }Expand description
Bounded searchable snapshot of catalog compact descriptors (spec §7.1).
Building and searching are local and pure: no implementation acquisition,
no execution, no process start, no network, no full-schema read beyond
the digest already computed at catalog time, and no registry exposure
change. The snapshot pins the catalog generation; callers detect drift
with DiscoveryIndex::is_stale and rebuild instead of silently serving
stale records.
Implementations§
Source§impl DiscoveryIndex
impl DiscoveryIndex
Sourcepub fn build(catalog: &ToolCatalog) -> Result<Self, DiscoveryIndexError>
pub fn build(catalog: &ToolCatalog) -> Result<Self, DiscoveryIndexError>
Build the index from catalog compact descriptors only. Reads id, source class, bounded summary/tags, and schema digest — never the schema locator or the factory.
Sourcepub fn generation(&self) -> CatalogGeneration
pub fn generation(&self) -> CatalogGeneration
The catalog generation this snapshot was built from.
Sourcepub fn is_stale(&self, catalog: &ToolCatalog) -> bool
pub fn is_stale(&self, catalog: &ToolCatalog) -> bool
True when the catalog has mutated since this snapshot was built. A stale index must be rebuilt, not silently served.
Sourcepub fn search(
&self,
query: &DiscoveryQuery,
limits: &SearchLimits,
) -> SearchResults<'_>
pub fn search( &self, query: &DiscoveryQuery, limits: &SearchLimits, ) -> SearchResults<'_>
Deterministic, bounded, pure substring search over compact
descriptors. Entries are visited in ToolId order; a matching entry is
returned only if it fits both the remaining count budget and the
remaining serialized byte budget. The byte budget accounts the exact
compact-JSON array serialization of the returned hits — container
brackets (2 bytes even when empty) plus one comma per additional
entry — so serde_json::to_vec of the hit collection can never
exceed it. The first match that does not fit stops the scan
(documented bounded behavior; truncated reports it).
Trait Implementations§
Source§impl Clone for DiscoveryIndex
impl Clone for DiscoveryIndex
Auto Trait Implementations§
impl Freeze for DiscoveryIndex
impl RefUnwindSafe for DiscoveryIndex
impl Send for DiscoveryIndex
impl Sync for DiscoveryIndex
impl Unpin for DiscoveryIndex
impl UnsafeUnpin for DiscoveryIndex
impl UnwindSafe for DiscoveryIndex
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.