whiskers-store
Whiskers' storage on SQLite: one database file per device and one for the service, with the pictures as blobs in
it. Every table, and how each merges, is in SCHEMA.md; the SQL is in migrations/.
It implements the core's ports over one [Store]: SqliteMemory (Memory), SqliteChat (ChatStore),
SqliteLog (Log, and the copy of the other devices' lines), SqliteHousehold (HouseholdStore, which
TimeKeeper keeps its document in) and SqlitePictures for a device; and for the service the three hubs
(SqliteMemoryHub, SqliteHouseholdHub, SqliteChatHub), SqliteJournal, SqlitePictureShelf and
SqliteAllowance, which pass the laws of whiskers-conformance unchanged (tests/conformance.rs).
The merge rules are not here. They are pure functions in whiskers-core, run on a document read from the rows,
and the difference is written back in one transaction. What is here, in the schema, are the rules about what must
not exist: a forgotten memory leaves only a tombstone of its id, when and by whom, and the identities of the turns it was told in, which empty
what was said in them; tests/forgetting.rs and tests/forgetting_turns.rs search the bytes of the database file and of its write-ahead log to show it.
The parents' log is read a day at a time through an index (SqliteLog::read_range, days) and can be cleared by age (expire_before), and what
waits for the memory to think about it is kept (SqliteReflections) so a stop loses none of it.
| File | What |
|---|---|
migrations/ | The numbered SQL migrations. PRAGMA user_version says where a database is. |
src/lib.rs | Store: opening, pragmas, migrations, scrub (empty the write-ahead log) and backup_to (a consistent copy). |
src/memory.rs | SqliteMemory: the memory as a MemoryDoc, written as the difference between two of them. |
src/chat.rs, src/household.rs, src/log.rs, src/pictures.rs | A device's chat, grown-ups' choices and minutes, parents' log (and the copy of the others', read by range and by day, cleared by age), and pictures. |
src/reflections.rs | The exchanges waiting for the memory to think about them. |
src/hubs.rs, src/journal.rs, src/spend.rs | The service's hubs, journal and spending. |
tests/ | The conformance suite on these adapters, the device's own behaviour, and forgetting. |
Builds for Linux and for Android (aarch64-linux-android through cargo-ndk) with SQLite compiled in; it is left
out of the wasm check like the other native-only crates.