Skip to main content

VerbRegistry

Struct VerbRegistry 

Source
pub struct VerbRegistry { /* private fields */ }
Expand description

Immutable registry that dispatches verb calls to registered packs.

Clone is cheap (Arc-wrapped). Constructed via VerbRegistryBuilder.

Implementations§

Source§

impl VerbRegistry

Source

pub async fn dispatch( &self, verb: &str, params: Value, ) -> Result<Value, RuntimeError>

Dispatch a verb to the first pack that handles it.

When multiple packs declare the same verb, the first registered pack wins.

The configured Gate is consulted before dispatch (ADR-029, ADR-035). Deny decisions return RuntimeError::PermissionDenied immediately — the pack is never invoked. Allow decisions proceed to pack dispatch as before.

Every gate consultation emits one tracing::info!(... "gate.check") event with a structured audit_event field (ADR-033). When a EventStore is configured via VerbRegistryBuilder::with_event_store, an Event is also persisted to the substrate (ADR-035). Storage errors are logged via tracing::warn! and never propagated.

When gate.check itself returns an error (gate infrastructure failure), the error is logged via tracing::warn! and dispatch proceeds (fail-open, consistent with ADR-029 §Rationale “Why advisory in v0.2”). No audit event is persisted for an errored gate check — no decision was produced.

The synthesized GateRequest carries ActorRef::anonymous() and the operation’s namespace — pulled from params["namespace"] when present (including an explicit empty string, which KhiveRuntime::ns also preserves), otherwise the registry’s default namespace (configured via VerbRegistryBuilder::with_default_namespace). Gate-visible namespace and runtime-visible namespace MUST stay aligned; coercing an empty string here while the runtime keeps "" would create an authorization/audit blind spot on the field ADR-029 declares public. Transports that have richer caller context (auth headers, session info) will gain a sibling dispatch path in a follow-up.

Source

pub fn find_kind_hook(&self, kind: &str) -> Option<Arc<dyn KindHook>>

Find a kind hook (ADR-030) among the registered packs.

Walks packs in registration order; the first pack that both owns the kind (declares it in note_kinds() or entity_kinds()) and returns a hook from kind_hook(kind) wins. Returns None if the kind is unknown to all packs or no owning pack registered a hook.

Source

pub fn all_verbs(&self) -> Vec<&'static VerbDef>

All verb definitions across all registered packs.

Returned with 'static lifetime since pack verbs are &'static [VerbDef] constants — callers can keep the slice references beyond the registry’s borrow.

Source

pub fn all_note_kinds(&self) -> Vec<&'static str>

Merged set of note kinds across all registered packs (deduplicated, first-seen order preserved).

Source

pub fn all_entity_kinds(&self) -> Vec<&'static str>

Merged set of entity kinds across all registered packs (deduplicated, first-seen order preserved).

Source

pub fn pack_names(&self) -> Vec<&str>

Names of packs in topological load order.

Source

pub fn pack_requires(&self, name: &str) -> Option<&'static [&'static str]>

Declared dependencies for a registered pack (ADR-037).

Source

pub fn all_edge_rules(&self) -> Vec<EdgeEndpointRule>

All pack-declared edge endpoint rules across registered packs (ADR-031).

Order follows topological pack registration; duplicates are not deduplicated — validation only checks membership, and an exact-duplicate rule is a harmless restatement.

Trait Implementations§

Source§

impl Clone for VerbRegistry

Source§

fn clone(&self) -> VerbRegistry

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more