pub struct DeferredAuditQueue { /* private fields */ }Expand description
Producer-side handle. Cloneable so multiple callsites (HTTP handler, MCP handler, internal substrate writer) all share one queue.
Implementations§
Source§impl DeferredAuditQueue
impl DeferredAuditQueue
Sourcepub fn new() -> (Self, UnboundedReceiver<DeferredAuditEvent>)
pub fn new() -> (Self, UnboundedReceiver<DeferredAuditEvent>)
Create a fresh queue + uninstalled receiver. The receiver
MUST be passed to spawn_drainer_task (or
spawn_supervised_drainer) for events to land — submits
against an unspawned receiver accumulate in the channel
buffer indefinitely until the receiver is consumed or
dropped.
Sourcepub fn submit(&self, event: DeferredAuditEvent) -> bool
pub fn submit(&self, event: DeferredAuditEvent) -> bool
Submit a refusal event. Non-blocking. Never panics — if the
receiver is closed the metric counter is bumped and a
tracing::warn is emitted, but the caller path is unaffected.
Returns true when the event was queued, false when the
receiver was already closed.
Sourcepub fn submit_refusal(
&self,
agent_id: &str,
action: &AgentAction,
decision: &Decision,
) -> bool
pub fn submit_refusal( &self, agent_id: &str, action: &AgentAction, decision: &Decision, ) -> bool
Convenience: build + submit a refusal from the three hook
inputs. Returns true when an event was actually enqueued
(i.e. the verdict was a refusal AND the receiver was open).
Sourcepub fn metrics(&self) -> DeferredAuditMetrics
pub fn metrics(&self) -> DeferredAuditMetrics
Observability handle. Clone-cheap; safe to expose to readers
(Prometheus scrape, MCP governance_state tool, etc.).
Trait Implementations§
Source§impl Clone for DeferredAuditQueue
impl Clone for DeferredAuditQueue
Source§fn clone(&self) -> DeferredAuditQueue
fn clone(&self) -> DeferredAuditQueue
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl Freeze for DeferredAuditQueue
impl RefUnwindSafe for DeferredAuditQueue
impl Send for DeferredAuditQueue
impl Sync for DeferredAuditQueue
impl Unpin for DeferredAuditQueue
impl UnsafeUnpin for DeferredAuditQueue
impl UnwindSafe for DeferredAuditQueue
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,
impl<T> ErasedDestructor for Twhere
T: 'static,
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