About
cr-sqlite
allows merging of databases by using conflit-free replicated data types.
The big idea is that you define a table then say which CRDTs should be used to model it.
Notional example (as a custom syntax for crdts):
CREATE CLSet post (
id INTEGER PRIMARY KEY NOT NULL,
views COUNTER,
content PERITEXT,
owner_id LWW INTEGER
);
Table CRDTs
Tables can be thought of as a set of rows where the identity of each row is its primary key. When converting a table to a crr, you can specify the semantics of how that set of rows should be merged.
cr-sqlite supports modeling tables as:
- Delete Wins Sets
- Causal Length Sets (sets where deleted items can later be re-inserted)
- Grow Only Sets (sets that can never be removed from)
See Table CRDTs.
Row & Column CRDTs
A row can be thought of as a map. The keys of that map are the column names. The values are the column values for that row.
When defining a table, each column can be assigned a CRDT type. The following CRDTs are supported:
- Last Write Wins Register
- Distributed Fractional Index
- Counter
See Column CRDTs.
Sequence, Tree & Recursive CRDTs
These more exotic types are useful for collaborative text documents and don't have simple mapping to rows and tables.
- RGA
- Non-interleaved fractional index
See Sequence CRDTs.