modo/audit/backend.rs
1use std::pin::Pin;
2
3use crate::error::Result;
4
5use super::entry::AuditEntry;
6
7/// Object-safe backend trait for audit log storage.
8///
9/// Implement this trait to use a custom storage backend (e.g., remote
10/// logging service, file-based). The built-in SQLite backend is used
11/// by [`AuditLog::new()`](super::AuditLog::new).
12pub trait AuditLogBackend: Send + Sync {
13 /// Persist an audit entry.
14 ///
15 /// # Errors
16 ///
17 /// Returns an error if the backend fails to persist the entry.
18 fn record<'a>(
19 &'a self,
20 entry: &'a AuditEntry,
21 ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'a>>;
22}