Skip to content
/ ssb-ebt Public

secure scuttlebutt replication with epidemic-broadcast-trees

License

Notifications You must be signed in to change notification settings

ssbc/ssb-ebt

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Build Status

ssb-ebt

Adapter for epidemic-broadcast-trees to secure-scuttlebutt

testing/debugging

There are several scripts in ./debug which I used for testing ebt replicaiton.

use ./debug/remote.js <address> to connect to an sbot running ebt and replicate. Running this won't store anything locally, it will just download everything drop it on the floor. This is used to test performance of ebt on a server.

I normally see values between 2k and 3k messages per second, that replicates 100k messages in under a minute.

api

ebt.replicate (opts)

creates a duplex replication stream to the remote peer. when two peers connect, the peer who initiated the call (the client) should call this. It is not intended to be called by the user.

ebt.request (feedId, enableReplication, [priority])

request that feedId be replicated. enableReplication is a boolean, replicate feed if true. If set to false, replication is immediately stopped.

priority (defaults to 0) is an optional number that sets the preferred priority of replication relative to other peers. ssb-ebt may restrict the number of simultaneous connections and this enables a way to select which peers will be connected to first.

ebt.peerStatus (id)

query the status of replication for id. returns a small data structure showing the replication state for all peers we are currently connected to.

output looks like this:

{
  "id": "@EMovhfIrFk4NihAKnRNhrfRaqIhBv1Wj8pTxJNgvCCY=.ed25519",
  "seq": 13293, //the sequence we have locally.
  "peers": {
    //where each of these peers are up to:
    "@TRE4lNNXrtx3KK9Tgks2so2PjCP6w9tRvsy7wyqiyo4=.ed25519": {
      "seq": 13293, //the sequence this peer has acknowledged, we definitely know they have this number.
      "replicating": {
        "tx": true,
        "rx": true,
        "sent": 13293, //the sequence we have sent to this peer. They _probably_ have this, but not gauranteed.
        "requested": 13293 //the sequence we requested from this peer
      }
    },
    "@h1fDsZgwBtZndnRDHCFV84TMZYl16m3zhyTTQsE/V94=.ed25519": {
      "seq": 13293,
      "replicating": {
        "tx": true,
        "rx": false,
        "sent": 13293,
        "requested": 13293
      }
    }
  }
}

ebt.setModeChangeThreshold

Sets the threshold at which the limiter will begin limiting replication. See ssb-replication-limiter for more.

ebt.setMaxNumConnections

Sets the maximum number of connections allowed when in limited mode. See ssb-replication-limiter for more.

Config

You can use ebt.maxNumConnections and ebt.modeChangeThreshold in your config file to configure the replication limiter.

License

MIT

About

secure scuttlebutt replication with epidemic-broadcast-trees

Resources

License

Code of conduct

Stars

Watchers

Forks

Packages

No packages published