pub trait AuditStore: Send + Sync {
// Required methods
fn insert_batch<'life0, 'life1, 'async_trait>(
&'life0 self,
records: &'life1 [AuditRecord],
ingested_at: i64,
) -> Pin<Box<dyn Future<Output = Result<Vec<AuditRow>, StoreError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn query_by_on_behalf_of<'life0, 'life1, 'async_trait>(
&'life0 self,
query: &'life1 AuditQuery,
) -> Pin<Box<dyn Future<Output = Result<AuditPage, StoreError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
}Expand description
Append-only persistence for audit records.
Only one mutation method — insert_batch. A batch
is rejected wholesale if any record fails AuditRecord::validate; no
partial commits, so kamaji’s retry-with-backoff sees a clean 4xx.
The read side is query_by_on_behalf_of.
Required Methods§
Sourcefn insert_batch<'life0, 'life1, 'async_trait>(
&'life0 self,
records: &'life1 [AuditRecord],
ingested_at: i64,
) -> Pin<Box<dyn Future<Output = Result<Vec<AuditRow>, StoreError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn insert_batch<'life0, 'life1, 'async_trait>(
&'life0 self,
records: &'life1 [AuditRecord],
ingested_at: i64,
) -> Pin<Box<dyn Future<Output = Result<Vec<AuditRow>, StoreError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Insert a batch of records atomically. The impl assigns each row a
fresh opaque id and stamps ingested_at. Returns the resulting
AuditRows in the same order as the input.
Validation is the caller’s responsibility — pass already-validated
AuditRecords (the HTTP layer runs AuditRecord::validate over
the batch before calling here). The trait does not re-validate; it
just durably appends.
Sourcefn query_by_on_behalf_of<'life0, 'life1, 'async_trait>(
&'life0 self,
query: &'life1 AuditQuery,
) -> Pin<Box<dyn Future<Output = Result<AuditPage, StoreError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn query_by_on_behalf_of<'life0, 'life1, 'async_trait>(
&'life0 self,
query: &'life1 AuditQuery,
) -> Pin<Box<dyn Future<Output = Result<AuditPage, StoreError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
One page of rows attributable to query.on_behalf_of, newest first
(at DESC, id DESC), honouring the since / method_prefix filters
and resuming from query.cursor.
Impls must over-fetch one row beyond query.limit and hand the result
to AuditPage::from_overfetch, so next_cursor is Some only when
a further row genuinely exists.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".