4 releases
0.1.7 | Jan 13, 2022 |
---|---|
0.1.6 | Oct 16, 2020 |
0.1.5 | Apr 18, 2020 |
0.1.4 | Oct 16, 2020 |
#2303 in Database interfaces
2MB
645 lines
ssb-db
The most basic sqlite backed db that you need to do replication on ssb
Docs
lib.rs
:
ssb-db
The most basic db that you need to do (legacy) replication on ssb.
Legacy Replication
"Legacy Replication" is how ssb used to do replication before ebt
It's simpler than ebt, but uses more bandwidth.
To do legacy replication a client calls createHistoryStream for each feed it wants to replicate, passing the largest sequence number it knows about.
SsbDb
ssb-db
defines a trait [SsbDb] that provides all the functionality you should need
to make and handle legacy replication requests.
Architecture
[SqliteSsbDb] implements the [SsbDb] trait.
The underlying architecture is based on flume-db.
ssb-db
stores data in an append only log. It maintains indexes for querying the log in sqlite.
The append only log is the source of truth and the indexes are derived from the log. If the
indexes break or need to be migrated, the sqlite db can be deleted and rebuilt from the log.
Validation
ssb-db
does not validate any messages before appending them. The caller must validate them first.
See ssb-validate and ssb-verify-signatures.
Dependencies
~29–39MB
~634K SLoC