Skip to main content

Module replica

Module replica 

Source
Expand description

The engine’s offline replica of a place (Cloud v4 V4, SPEC-ENGINE §3.4): an encrypted SQLite store per place, the cursor into the server log, the queue of own events not yet in that log. Folding events and the sync routes follow the C0 2.0 wire shapes.

Re-exports§

pub use store::Opened;
pub use store::Replica;

Modules§

crypt
Replica encryption at rest (SPEC-ENGINE §3.4.2).
fold
Materialisation of a place’s log into its graph (SPEC-ENGINE §3.4.5).
history
Place epoch and failover repair state of a replica (SPEC-ENGINE §3.4.4, RESOLUTIONS R48): the own batches pushed in the last 24 h, kept to re-push them after a failover, and when each seq was received, to know where a re-tail starts. Both live in the encrypted replica (the spec’s outbox/history/ files hold the same batches; keeping them here keeps signed bodies of sealed places off disk in the clear).
log
The place’s event log in the replica (SPEC-ENGINE §3.4.1 events): verified events from the server log, stored with their plaintext ids and server fields and their envelope, worker id and body encrypted. The graph is rebuilt from this log (super::fold), so the log is the only state that has to be right.
store
The local replica of one place (SPEC-ENGINE §3.4.1): <data>/cloud/replica/<place_id>/replica.db, SQLite in WAL mode with secure_delete, every text column encrypted under the place’s replica key rk (super::crypt). Ids, node types and edge structure stay plaintext so folding and graph queries never decrypt.