pub trait PackRuntime: Send + Sync {
// Required methods
fn name(&self) -> &str;
fn note_kinds(&self) -> &'static [&'static str];
fn entity_kinds(&self) -> &'static [&'static str];
fn verbs(&self) -> &'static [VerbDef];
fn dispatch<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
verb: &'life1 str,
params: Value,
registry: &'life2 VerbRegistry,
) -> Pin<Box<dyn Future<Output = Result<Value, RuntimeError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait;
// Provided methods
fn edge_rules(&self) -> &'static [EdgeEndpointRule] { ... }
fn requires(&self) -> &'static [&'static str] { ... }
fn kind_hook(&self, _kind: &str) -> Option<Arc<dyn KindHook>> { ... }
}Expand description
Async dispatch trait for packs (ADR-025).
This is the object-safe behavioral counterpart to khive_types::Pack.
Pack uses const associated items (not object-safe in Rust); this trait
mirrors that metadata as methods and adds async dispatch.
Registration requires P: Pack + PackRuntime — the compiler enforces
that every runtime pack also declares its vocabulary via Pack.
Required Methods§
Sourcefn note_kinds(&self) -> &'static [&'static str]
fn note_kinds(&self) -> &'static [&'static str]
Note kinds this pack owns — must equal <Self as Pack>::NOTE_KINDS.
Sourcefn entity_kinds(&self) -> &'static [&'static str]
fn entity_kinds(&self) -> &'static [&'static str]
Entity kinds this pack owns — must equal <Self as Pack>::ENTITY_KINDS.
Sourcefn verbs(&self) -> &'static [VerbDef]
fn verbs(&self) -> &'static [VerbDef]
Verbs this pack handles — must equal <Self as Pack>::VERBS.
Sourcefn dispatch<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
verb: &'life1 str,
params: Value,
registry: &'life2 VerbRegistry,
) -> Pin<Box<dyn Future<Output = Result<Value, RuntimeError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn dispatch<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
verb: &'life1 str,
params: Value,
registry: &'life2 VerbRegistry,
) -> Pin<Box<dyn Future<Output = Result<Value, RuntimeError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Dispatch a verb call. Returns serialized JSON response.
The registry parameter gives the handler access to the merged
vocabulary and kind hooks across all loaded packs (ADR-030).
Provided Methods§
Sourcefn edge_rules(&self) -> &'static [EdgeEndpointRule]
fn edge_rules(&self) -> &'static [EdgeEndpointRule]
Pack-extensible edge endpoint rules — must equal <Self as Pack>::EDGE_RULES.
Defaults to empty so existing packs that don’t extend the edge contract
can ignore it (ADR-031).
Sourcefn requires(&self) -> &'static [&'static str]
fn requires(&self) -> &'static [&'static str]
Pack names whose vocabulary this pack references (ADR-037). Defaults to empty so existing packs compile without changes.
Sourcefn kind_hook(&self, _kind: &str) -> Option<Arc<dyn KindHook>>
fn kind_hook(&self, _kind: &str) -> Option<Arc<dyn KindHook>>
Optional per-kind hook for shared CRUD specialization (ADR-030).
When a kind is owned by this pack (declared in note_kinds() or
entity_kinds()), returning Some(hook) opts that kind into
pack-specific behavior — defaults, derived properties, side-effect
edges — through the shared create path. Returning None keeps
the kind as plain storage with no specialization.