pub struct EmbedderRegistry { /* private fields */ }Expand description
Registry of named EmbedderProvider instances.
Built during KhiveRuntime construction and optionally extended by packs
via crate::KhiveRuntime::register_embedder. The registry is internally
reference-counted so KhiveRuntime::clone() shares the same providers
and cached service instances.
Implementations§
Source§impl EmbedderRegistry
impl EmbedderRegistry
Sourcepub fn register<P: EmbedderProvider + 'static>(&mut self, provider: P)
pub fn register<P: EmbedderProvider + 'static>(&mut self, provider: P)
Register a provider.
If a provider with the same name already
exists, it is replaced (last-writer wins) and any cached service is
discarded, since pack registration order is not guaranteed and packs
may legitimately override a default model under the same name.
Callers needing strict collision detection should check
names before registering.
Sourcepub fn get_provider(&self, name: &str) -> Option<&dyn EmbedderProvider>
pub fn get_provider(&self, name: &str) -> Option<&dyn EmbedderProvider>
Look up a provider by name.
Sourcepub fn contains(&self, name: &str) -> bool
pub fn contains(&self, name: &str) -> bool
Returns true if a provider with this name is registered.
Sourcepub async fn get_service(
&self,
name: &str,
) -> RuntimeResult<Arc<dyn EmbeddingService>>
pub async fn get_service( &self, name: &str, ) -> RuntimeResult<Arc<dyn EmbeddingService>>
Lazily resolve a registered provider to its live EmbeddingService.
Returns RuntimeError::UnknownModel if name is not registered.
The first call for a given name triggers EmbedderProvider::build;
subsequent calls return the cached Arc.
Prefer crate::KhiveRuntime::embedder over calling this directly from pack
handlers — the runtime method handles alias resolution and error mapping.
Trait Implementations§
Source§impl Clone for EmbedderRegistry
impl Clone for EmbedderRegistry
Source§fn clone(&self) -> EmbedderRegistry
fn clone(&self) -> EmbedderRegistry
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more