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 moreSource§impl Default for EmbedderRegistry
impl Default for EmbedderRegistry
Source§fn default() -> EmbedderRegistry
fn default() -> EmbedderRegistry
Auto Trait Implementations§
impl !RefUnwindSafe for EmbedderRegistry
impl !UnwindSafe for EmbedderRegistry
impl Freeze for EmbedderRegistry
impl Send for EmbedderRegistry
impl Sync for EmbedderRegistry
impl Unpin for EmbedderRegistry
impl UnsafeUnpin for EmbedderRegistry
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> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more