sql_crdt 0.0.8+1 copy "sql_crdt: ^0.0.8+1" to clipboard
sql_crdt: ^0.0.8+1 copied to clipboard

Base package for Conflict-free Replicated Data Types (CRDTs) using SQL databases

Dart implementation of Conflict-free Replicated Data Types (CRDTs) using SQL databases.
This project is a continuation of the crdt package and may depend on it in the future.

sql_crdt is based on the learnings from Libra, StoryArk and tudo.
Check tudo for a real world implementation.

⚠ The packages in this repository are still under development and may not be stable. The API may break at any time.

Notes #

sql_crdt is not an ORM. The API is essentially that of a plain old SQL database with a few behavioural changes:

  • Every table gets 3 columns automatically added: is_deleted, hlc, and modified
  • Deleted records aren't actually removed but rather flagged in the is_deleted column
  • Features a reactive watch method to subscribe to database queries
  • Adds convenience methods getChangeset, watchChangeset and merge to simplify syncing with remote nodes

⚠ Because deleted records are only flagged as deleted, they may need to be sanitized in order to be compliant with GDPR and similar legislation.

API #

The API is intentionally kept simple with a few methods:

  • execute to run non-select SQL queries, e.g. inserts, updates, etc.
  • query to perform a one-time query
  • watch to receive query results whenever the database changes
  • getChangeset to generate a serializable changeset of the local database
  • watchChangeset a reactive alternative to get the changeset
  • merge to apply a remote changeset to the local database
  • transaction a blocking mechanism that avoids running simultaneous transactions in async code

Check the examples in sqlite_crdt and postgres_crdt for more details.

Features and bugs #

Please file feature requests and bugs in the issue tracker.

10
likes
0
pub points
41%
popularity

Publisher

verified publishercachapa.net

Base package for Conflict-free Replicated Data Types (CRDTs) using SQL databases

Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

sqlparser, uuid

More

Packages that depend on sql_crdt