Skip to main content

Crate aa_storage_sqlite_buffer

Crate aa_storage_sqlite_buffer 

Source
Expand description

Local in-process SQLite event buffer for Agent Assembly.

When the upstream NATS/gateway is briefly unreachable, Assembly keeps emitting governance AuditEntry records into this buffer instead of dropping them. Once the connection recovers, the buffer flushes its backlog — in insertion order — through the upstream AuditSink. This gives Assembly partial autonomy so a transient outage never silently loses audit-trail data.

The buffer is a single SQLite file opened in WAL mode, so a buffered event survives a process restart and is replayed on the next reconnect.

use aa_storage_sqlite_buffer::EventBuffer;

// Open (or create) a buffer holding at most 10_000 events.
let buffer = EventBuffer::new("/var/lib/agent-assembly/buffer.db", 10_000)?;

Structs§

AuditEntry
An immutable, hash-chained record of a single governance event.
EventBuffer
A restart-safe, FIFO event buffer backed by a single SQLite file.
SqliteBufferConfig
Operator configuration for the SQLite event buffer.

Enums§

StorageError
Failure modes common to all storage backends.

Constants§

DEFAULT_CAP
Default maximum number of events retained before the oldest are evicted.
METRIC_EVENTS_BUFFERED
Counter incremented once per event accepted into the buffer.
METRIC_EVENTS_DROPPED
Counter incremented when the cap is exceeded and an oldest event is evicted.
METRIC_EVENTS_FLUSHED
Counter incremented once per event successfully flushed to the sink.

Traits§

AuditSink
Append-only sink for governance AuditEntry records.

Functions§

default_path
Resolve the default buffer database path.

Type Aliases§

Result
Convenience alias for results returned by storage trait methods.