pub struct EmbedderRegistry { /* private fields */ }Expand description
Registry of named EmbedderProvider instances.
Built during KhiveRuntime construction and optionally extended by packs
via [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, the new provider replaces the existing one (last-writer wins).
The previously cached service instance (if any) is discarded — the
replacement provider’s build will be
called lazily on the next access.
Last-wins is chosen over rejection because pack registration order
is not guaranteed and packs may legitimately override a default model
with a custom implementation of the same logical name. Operators who
need strict collision detection should inspect
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 [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