pub struct PackRegistry;Expand description
Registry of pack factories discovered via inventory at link time.
No instance is needed — all methods are associated functions that walk the
globally-collected PackRegistration slice.
Implementations§
Source§impl PackRegistry
impl PackRegistry
Sourcepub fn discovered_names() -> Vec<&'static str>
pub fn discovered_names() -> Vec<&'static str>
Names of all pack factories discovered via inventory.
Sourcepub fn validate_pack_selection(names: &[String]) -> Result<(), PackLoadError>
pub fn validate_pack_selection(names: &[String]) -> Result<(), PackLoadError>
Validate linked pack names and explicit dependencies without creating runtimes, opening stores, or constructing pack instances.
Launchers can use this before publishing ownership. Registration uses the same validation, including when extra factories are supplied.
Sourcepub fn register_packs(
names: &[String],
runtime: KhiveRuntime,
builder: &mut VerbRegistryBuilder,
) -> Result<(), PackLoadError>
pub fn register_packs( names: &[String], runtime: KhiveRuntime, builder: &mut VerbRegistryBuilder, ) -> Result<(), PackLoadError>
Register the named packs into builder using the supplied runtime.
Validates the explicit pack list against PackFactory::requires() —
if any requested pack declares a dependency that is absent from names,
registration fails (missing dependency is a boot error, not silently
auto-added). Callers must include all required packs explicitly.
The VerbRegistryBuilder::build topo-sort enforces correct load order.
Returns Ok(()) when all names are recognised and all declared
dependencies are satisfied; returns Err(PackLoadError) with a
distinct variants for unknown or duplicate packs and missing dependencies.
Sourcepub fn build_ingest_registry(
runtime: &KhiveRuntime,
audit_store: IngestAuditStore,
) -> Result<VerbRegistry, RuntimeError>
pub fn build_ingest_registry( runtime: &KhiveRuntime, audit_store: IngestAuditStore, ) -> Result<VerbRegistry, RuntimeError>
Build a VerbRegistry from runtime’s own configuration: gate,
default namespace, visible namespaces, actor id, and the configured
pack set, then install the registry’s aggregated edge rules back onto
runtime. This is the wiring shared by every one-shot CLI ingest path
(kkernel code-ingest, kkernel git-ingest) that needs a real
registry to dispatch through outside of a live MCP server.
audit_store selects whether the registry gets the runtime’s event
store; see IngestAuditStore for what each variant does.
This helper carries only the subset every ingest path duplicated
verbatim. The MCP server’s own registry construction additionally
wires channel-loop admission, config_id, embedder/entity-type/
note-mutation-hook registration, schema-plan application, and the WAL
checkpoint pool handle — all server-only concerns a one-shot CLI pass
has no use for, so KhiveMcpServer::with_packs keeps its own
construction rather than calling this helper.
Sourcepub fn register_packs_with_runtimes(
names: &[String],
runtimes: &HashMap<String, KhiveRuntime>,
default_runtime: &KhiveRuntime,
builder: &mut VerbRegistryBuilder,
) -> Result<(), PackLoadError>
pub fn register_packs_with_runtimes( names: &[String], runtimes: &HashMap<String, KhiveRuntime>, default_runtime: &KhiveRuntime, builder: &mut VerbRegistryBuilder, ) -> Result<(), PackLoadError>
Register the named packs into builder, routing each pack to its own runtime.
runtimes maps pack name → KhiveRuntime (one per backend assignment).
default_runtime is used for any pack whose name is not in runtimes.
The validation logic (unknown pack, missing dependency) is identical to
PackRegistry::register_packs.
This is the multi-backend boot path (ADR-028). Single-backend callers
should continue using PackRegistry::register_packs.
Sourcepub fn register_packs_with_runtimes_with_extra_factories(
extra_factories: &[&'static dyn PackFactory],
names: &[String],
runtimes: &HashMap<String, KhiveRuntime>,
default_runtime: &KhiveRuntime,
builder: &mut VerbRegistryBuilder,
) -> Result<(), PackLoadError>
pub fn register_packs_with_runtimes_with_extra_factories( extra_factories: &[&'static dyn PackFactory], names: &[String], runtimes: &HashMap<String, KhiveRuntime>, default_runtime: &KhiveRuntime, builder: &mut VerbRegistryBuilder, ) -> Result<(), PackLoadError>
Like Self::register_packs_with_runtimes, but resolves pack names
against the link-time inventory registry plus extra_factories —
pack factories the composition root supplies directly rather than
discovers through inventory::iter::<PackRegistration> (ADR-191 D6,
ADR-192 S4: “a pack compiled outside this repository … extends the
web ontology without any change here” — a host binary that depends on
a pinned khive revision plus an out-of-tree pack crate, or a
composition root registering a credential-provider/request-hook
consumer pack, has no inventory presence in this binary short of
its own force-link anchor). An inventory-discovered factory always
wins a name collision with an extra_factories entry — the linked set
is the trusted default; an extra factory only fills a name inventory
does not already answer.
This is the seam D6 describes as “kkernel exposes its server
construction as a library entry point that accepts additional pack
factories” — the kkernel library entry point itself lives in
kkernel::compose, built on this function exactly as
khive-mcp/src/serve.rs builds on Self::register_packs_with_runtimes.
Auto Trait Implementations§
impl Freeze for PackRegistry
impl RefUnwindSafe for PackRegistry
impl Send for PackRegistry
impl Sync for PackRegistry
impl Unpin for PackRegistry
impl UnsafeUnpin for PackRegistry
impl UnwindSafe for PackRegistry
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
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