SQLite storage backend for durable agent session events.
Summary
Functions
Closes the database connection.
Returns the total number of agent events.
Deletes events older than the given wall-clock time.
Returns all events for a session with id greater than the cursor, ordered by id.
Inserts an append-only event record.
Runs a SQLite integrity check.
Returns the latest event id for a session, or 0 when it has no events.
Opens or creates the agent event database.
Opens an in-memory database for tests.
Types
@type db() :: Exqlite.Sqlite3.db()
Functions
Closes the database connection.
@spec count(db()) :: {:ok, non_neg_integer()} | {:error, term()}
Returns the total number of agent events.
@spec delete_before(db(), DateTime.t()) :: {:ok, non_neg_integer()} | {:error, term()}
Deletes events older than the given wall-clock time.
@spec events_after(db(), String.t(), non_neg_integer(), pos_integer()) :: {:ok, [MingaAgent.EventLog.EventRecord.t()]} | {:error, term()}
Returns all events for a session with id greater than the cursor, ordered by id.
@spec insert(db(), MingaAgent.EventLog.EventRecord.t()) :: {:ok, pos_integer()} | {:error, term()}
Inserts an append-only event record.
Runs a SQLite integrity check.
@spec latest_id(db(), String.t()) :: {:ok, non_neg_integer()} | {:error, term()}
Returns the latest event id for a session, or 0 when it has no events.
Opens or creates the agent event database.
Opens an in-memory database for tests.