pub struct VerbRegistryBuilder { /* private fields */ }Expand description
Builder for constructing a VerbRegistry.
Packs are registered here; once .build() is called the registry is
immutable and cheaply cloneable.
Implementations§
Source§impl VerbRegistryBuilder
impl VerbRegistryBuilder
pub fn new() -> Self
Sourcepub fn register<P: Pack + PackRuntime + 'static>(
&mut self,
pack: P,
) -> &mut Self
pub fn register<P: Pack + PackRuntime + 'static>( &mut self, pack: P, ) -> &mut Self
Register a pack. The bound P: Pack + PackRuntime ensures the pack
declares vocabulary via Pack consts alongside runtime dispatch.
Sourcepub fn with_gate(&mut self, gate: GateRef) -> &mut Self
pub fn with_gate(&mut self, gate: GateRef) -> &mut Self
Set the authorization gate consulted on every dispatch (ADR-029).
Defaults to AllowAllGate if not set. In v0.2 the gate is advisory —
deny decisions are logged via tracing::warn! but do not block dispatch.
Sourcepub fn with_default_namespace(&mut self, ns: impl Into<String>) -> &mut Self
pub fn with_default_namespace(&mut self, ns: impl Into<String>) -> &mut Self
Set the namespace surfaced to the gate when a verb does not carry an
explicit namespace argument. Transports should plumb the runtime’s
default_namespace so the gate’s input.namespace always reflects
the operation’s true tenant (ADR-029 + ADR-007).
Sourcepub fn with_event_store(&mut self, store: Arc<dyn EventStore>) -> &mut Self
pub fn with_event_store(&mut self, store: Arc<dyn EventStore>) -> &mut Self
Set the EventStore used to persist audit events (ADR-035).
When configured, every gate check appends one Event (substrate =
Event, outcome = Success on allow, Denied on deny) in addition to
the tracing::info! emission that was already present in v0.2.
Callers that do not set this field continue to use tracing-only emission (the v0.2 default). There is no behavior change for them.
Sourcepub fn build(self) -> Result<VerbRegistry, RuntimeError>
pub fn build(self) -> Result<VerbRegistry, RuntimeError>
Consume the builder and produce an immutable, cloneable registry.
Performs a topological sort of packs using Kahn’s algorithm (ADR-037). Returns an error if any declared dependency is missing from the loaded pack set, or if a circular dependency is detected.