Expand description
SQLite store for agent-effects.
For CLI agents, desktop apps and single-node services. Several processes may share one database file.
let store = agent_effects_sqlite::SqliteStore::open("effects.db").await?;§Durability and concurrency
SqliteStore::open configures:
- WAL journal, so readers do not block the writer.
synchronous = FULL: a commit is on disk before it returns. The runtime persists an attempt before calling the remote system. Losing that write in a power cut would leave aPendingrecord for an effect that may have run, and the next call would run it again.NORMALwould allow exactly that.busy_timeoutof 5 seconds, so concurrent writers wait instead of failing.
Every change runs as “load, apply the pure EffectRecord operation, save”
inside a BEGIN IMMEDIATE transaction. That takes the write lock up
front, so two writers, even in different processes, cannot both read a
record and then both write it. The record update also checks the version
it read, as a second guard.
Times are stored as Unix milliseconds; sub-millisecond precision is
dropped, as the EffectStore contract allows.
Structs§
- Sqlite
Store - An
EffectStorein a SQLite database.