Key takeaways
- Every app instance has its own Raft log, held by three attested nodes by default.
- Apps store data in typed collections and tables with indexes, unique constraints and counts, with nothing to merge.
- Every value on disk is sealed with AES-256-GCM, and row keys are hidden, so a copied disk reads nothing.
How is app data replicated?
Every app instance has its own replicated log, a Raft group run on openraft. By default it's held by three attested nodes. Each write follows the same path:
- The leader takes the group's lock and reads the applied state.
- It runs the call on wasmtime and records the outcome: the result, the storage diff, events and anything the call started.
- It appends that outcome to the log, and followers acknowledge it.
- Once committed, every replica applies the same diff and the caller gets its answer.
Followers don't re-run your code. They apply what the leader recorded, so every replica ends up with identical state. A log entry is capped at 1 MiB, so large bytes go to blobs and only a reference goes in state.
What data structures can an app use?
An app's state is the fields of its#[app::state] struct. Because one leader applies every write in order, these are plain data structures. There's nothing to merge.
- Table: rows with a primary key, unique constraints, indexes, maintained counts and optional full-text search.
- UnorderedMap, Set, Vector, Cell and Counter: general-purpose collections. Despite its name, UnorderedMap reads in key order, so it also works as a sorted map.
- Frozen: content-addressed, write-once values.
- PerUser: one value per account, written only by its owner.
- Text and RichText: collaborative documents edited by character id, with marks for formatting, links and comments.
len and count are one read, never a scan. Multi-row reads return pages.
How is the data protected at rest?
Every value a node writes is sealed with AES-256-GCM under the cluster key, with a fresh nonce. Each value is bound to its column, group and key, so it can't be moved somewhere else. The row keys of app state are hidden behind an HMAC, so even the shape of your data isn't readable on disk.
A node gets its storage key from the key service only after it proves, by attestation, that it runs a signed release. A copied disk, or a node running modified code, gets no key and reads nothing. Backups are sealed snapshot files, and a recovery disk is sealed to whoever upgrades each app, so it can be recovered without an operator holding its keys.
How do reads and retries work?
Writes are calls and reads are views. A view is answered by the leader by default. A client can also ask any replica for a view at least as fresh as a given log index, or accept a slightly stale read from the replica that answers.
Calls can carry an idempotency key. Retrying with the same key returns the first answer instead of writing twice, which matters on flaky mobile networks.
Frequently asked questions
Is Calimero Network's database a CRDT?
No. Calimero Network 1.0 orders every write on a Raft log with one leader per app instance, so state is plain collections and tables with nothing to merge. Earlier peer-to-peer versions used CRDTs.
How many copies of my data are there?
By default each app instance is replicated on three attested nodes, which can be placed across zones.
Can the operator read the database files?
No. Every value is sealed with AES-256-GCM under a key released only to attested nodes running a signed release, and row keys are hidden.
