pub trait AuditSink: Send + Sync {
// Required method
fn emit<'life0, 'async_trait>(
&'life0 self,
event: AuditEntry,
) -> Pin<Box<dyn Future<Output = Result<(), StorageError>> + Send + 'async_trait>>
where 'life0: 'async_trait,
Self: 'async_trait;
}Expand description
Append-only sink for governance AuditEntry records.
Every governance decision produces one entry. The sink is write-only from the
runtime’s perspective: it persists entries in order so the hash-chained audit
log stays verifiable. Backends may batch or buffer internally, but
emit must not reorder entries relative to the calls.
§Example
use aa_core::storage::{AuditEntry, AuditSink, Result};
use async_trait::async_trait;
/// A sink that discards every entry (useful as a test double).
struct NullAuditSink;
#[async_trait]
impl AuditSink for NullAuditSink {
async fn emit(&self, _event: AuditEntry) -> Result<()> {
Ok(())
}
}Required Methods§
Sourcefn emit<'life0, 'async_trait>(
&'life0 self,
event: AuditEntry,
) -> Pin<Box<dyn Future<Output = Result<(), StorageError>> + Send + 'async_trait>>where
'life0: 'async_trait,
Self: 'async_trait,
fn emit<'life0, 'async_trait>(
&'life0 self,
event: AuditEntry,
) -> Pin<Box<dyn Future<Output = Result<(), StorageError>> + Send + 'async_trait>>where
'life0: 'async_trait,
Self: 'async_trait,
Persist a single audit entry.
Takes ownership of event because the sink is the entry’s final
destination. Returns StorageError::Backend
when the entry could not be durably recorded.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".