Expand description
truefix-store — pluggable persistence of sequence numbers and sent messages.
The MessageStore trait abstracts the storage needed for resend (FR-G2): the next inbound
and outbound sequence numbers, and the bytes of each sent message keyed by sequence number.
Implementations: MemoryStore, FileStore, CachedFileStore, NoopStore, and a
SQL-backed store behind the sql feature.
Audit 006 additions: MessageStore::contains exposes duplicate-sequence detection without
changing save()’s existing overwrite-on-conflict contract (NEW-137);
FileStoreOptions::max_body_records bounds a file-backed store’s body-log index while
preserving resend/recovery semantics (NEW-108); Mongo/SQL/MSSQL reset() is atomic across
messages and sequence numbers (NEW-116); and NoopStore tracks sequence numbers in memory for
the session lifetime (NEW-118).
Feature 012 (audit 007) additions / migration note: StoreConfig gained a Custom(Arc<dyn MessageStore>) variant (NEW-158), letting a caller supply a backend not on the built-in list
through the same config surface Engine::start resolves (see truefix::Engine::start_with_overrides).
This is additive to the variant set, but StoreConfig can no longer derive Debug (dyn MessageStore isn’t Debug) – it now has a hand-written Debug impl with the same output for
every pre-existing variant, so this only breaks code that exhaustively matches StoreConfig
without a _ => arm.
Design: specs/001-fix-engine-parity/, specs/012-audit-007-remediation/.
Structs§
- Cached
File Store - A file-backed store that also maintains a bounded in-memory cache of message bodies
(
FileStoreMaxCachedMsgs;0= unbounded), avoiding a disk read for cached resends. - File
Store - A durable, file-backed message store with no in-memory message-body cache (bodies are read
from disk on every
get()). - File
Store Options - Options shared by
FileStoreandCachedFileStore(FR-025). - Memory
Store - An in-memory store (does not survive process restart).
- Noop
Store - A no-op store: sequence numbers are tracked in memory for the session’s lifetime (matching
QFJ’s own
NoopStore, NEW-118/audit 006 – previously always reported1regardless ofset_next_*_seqcalls) but nothing else is persisted;save/getare no-ops.
Enums§
- Store
Config - Which store backend to construct.
- Store
Error - An error from a message store.
Traits§
- Message
Store - Persistence for sequence numbers and outbound messages, sufficient to satisfy resend across restarts (FR-G2, SC-006).
Functions§
- build_
store - Build a boxed
MessageStorefrom aStoreConfig.