pub trait Auditor: Send + Sync {
// Required method
fn record<'life0, 'async_trait>(
&'life0 self,
entry: AuditEntry,
) -> Pin<Box<dyn Future<Output = Result<(), StorageError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
// Provided methods
fn history<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
_item_type: &'life1 str,
_item_id: &'life2 str,
_limit: u64,
) -> Pin<Box<dyn Future<Output = Result<Vec<Value>, StorageError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait { ... }
fn strict(&self) -> bool { ... }
}Expand description
A pluggable audit sink. Unlike Authorizer this
is async and does I/O — it runs once per mutation, not several times per
request.
Required Methods§
fn record<'life0, 'async_trait>(
&'life0 self,
entry: AuditEntry,
) -> Pin<Box<dyn Future<Output = Result<(), StorageError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Provided Methods§
Sourcefn history<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
_item_type: &'life1 str,
_item_id: &'life2 str,
_limit: u64,
) -> Pin<Box<dyn Future<Output = Result<Vec<Value>, StorageError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn history<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
_item_type: &'life1 str,
_item_id: &'life2 str,
_limit: u64,
) -> Pin<Box<dyn Future<Output = Result<Vec<Value>, StorageError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Recorded entries for one record, newest first, capped at limit.
Rows come back in whatever shape the backend stored them; the history
page reads the event / whodunnit_email / changes / created_at
keys and tolerates their absence. The default returns nothing, so a
write-only sink (shipping to syslog, say) needn’t implement reading —
the history page then simply shows an empty log.
Sourcefn strict(&self) -> bool
fn strict(&self) -> bool
Whether a failed audit write should fail the operation that triggered it.
The default is best-effort: the error is logged and the write stands, so
a sick audit table cannot take the panel down. Returning true surfaces
the failure to the caller as a 500 instead — see emit for exactly
what that does and does not guarantee.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".