pub struct SqliteAdminAuditWriter { /* private fields */ }Expand description
SQLite-backed AdminAuditWriter. Production daemons construct
one at boot and feed it to
AdminRpcDispatcher::with_audit_writer.
Implementations§
Source§impl SqliteAdminAuditWriter
impl SqliteAdminAuditWriter
Sourcepub async fn open(path: &Path) -> Result<Self>
pub async fn open(path: &Path) -> Result<Self>
Open or create the audit DB at path. Idempotent — the
inline DDL runs on every boot. Pool kept small (2 conns)
since audit writes are infrequent and append-only.
Sourcepub async fn open_memory() -> Result<Self>
pub async fn open_memory() -> Result<Self>
In-memory variant for tests. No filesystem path; pool drops
content on Self::Drop.
Sourcepub async fn sweep_retention(
&self,
retention_days: u64,
max_rows: usize,
) -> Result<usize>
pub async fn sweep_retention( &self, retention_days: u64, max_rows: usize, ) -> Result<usize>
Boot-time retention sweep. Deletes rows older than
retention_days AND drops the oldest beyond max_rows.
Returns total rows deleted. Errors propagate — caller
(boot supervisor) logs them; admin dispatch never depends
on this fn.
Sourcepub async fn tail(&self, filter: &AuditTailFilter) -> Result<AuditTailPage>
pub async fn tail(&self, filter: &AuditTailFilter) -> Result<AuditTailPage>
Tail recent audit rows
with filter + pagination support. Returns an
AuditTailPage with entries, total, has_more, and
next_offset so callers (CLI tail formatter + the
nexo/admin/microapp_audit/tail admin RPC) can render
“showing N of M” UI labels and offer “load more” controls.
Filter combinator → SQL: every Some-field appends an AND
clause. Result is ordered newest-first by started_at_ms.
limit = 0 defaults to 50; clamped to [1, 500].
Sourcepub async fn tail_for_tenant(
&self,
tenant_id: &str,
since_ms: Option<u64>,
limit: usize,
) -> Result<Vec<AdminAuditRow>>
pub async fn tail_for_tenant( &self, tenant_id: &str, since_ms: Option<u64>, limit: usize, ) -> Result<Vec<AdminAuditRow>>
Convenience tail bound to a single tenant.
Equivalent to tail() with tenant_id = Some(tenant),
since_ms, and limit set; other filters left empty.
Used by the nexo/admin/audit/tail_for_tenant CLI/RPC
subcommand and by SaaS billing pipelines.
Trait Implementations§
Source§impl AdminAuditReader for SqliteAdminAuditWriter
impl AdminAuditReader for SqliteAdminAuditWriter
Source§fn tail<'life0, 'life1, 'async_trait>(
&'life0 self,
filter: &'life1 AuditTailFilter,
) -> Pin<Box<dyn Future<Output = Result<AuditTailPage>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn tail<'life0, 'life1, 'async_trait>(
&'life0 self,
filter: &'life1 AuditTailFilter,
) -> Pin<Box<dyn Future<Output = Result<AuditTailPage>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
filter.
Newest-first order.Source§impl Clone for SqliteAdminAuditWriter
impl Clone for SqliteAdminAuditWriter
Source§fn clone(&self) -> SqliteAdminAuditWriter
fn clone(&self) -> SqliteAdminAuditWriter
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl !RefUnwindSafe for SqliteAdminAuditWriter
impl !UnwindSafe for SqliteAdminAuditWriter
impl Freeze for SqliteAdminAuditWriter
impl Send for SqliteAdminAuditWriter
impl Sync for SqliteAdminAuditWriter
impl Unpin for SqliteAdminAuditWriter
impl UnsafeUnpin for SqliteAdminAuditWriter
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more