#ssb #db #sqlite #replication

ssb-db

The most basic sqlite backed db that you need to do replication on ssb

3 releases

0.1.6 Oct 16, 2020
0.1.5 Apr 18, 2020
0.1.4 Oct 16, 2020

21 downloads per month

AGPL-3.0

2.5MB
641 lines

Build Status

ssb-db

The most basic sqlite backed db that you need to do replication on ssb

Docs

Rustdocs


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

~26MB
~523K SLoC

__