sos_audit/
lib.rs

1#![deny(missing_docs)]
2#![forbid(unsafe_code)]
3//! Core types and traits for audit trail logging.
4mod encoding;
5mod event;
6
7pub use event::*;
8
9use futures::stream::BoxStream;
10
11/// Trait for types that read and write audit logs.
12#[async_trait::async_trait]
13pub trait AuditStreamSink {
14    /// Error type for this implementation.
15    type Error: std::error::Error + std::fmt::Debug;
16
17    /// Append audit log records to a destination.
18    async fn append_audit_events(
19        &self,
20        events: &[AuditEvent],
21    ) -> std::result::Result<(), Self::Error>;
22
23    /// Stream of audit log records.
24    async fn audit_stream(
25        &self,
26        reverse: bool,
27    ) -> Result<
28        BoxStream<'static, Result<AuditEvent, Self::Error>>,
29        Self::Error,
30    >;
31}