README
skiff-client
Client for Skiff (Node.js implementation of the Raft algorithm).
- Persistence: LevelDB
- Protocol: Msgpack over TCP
Install
$ npm install skiff-client
Create
var SkiffClient = require('skiff-client');
var node = SkiffClient('tcp+msgpack://localhost:8081');
or, with options:
var options {
// ...
};
var node = SkiffClient('tcp+msgpack://localhost:8081', options);
Options
autoListen
: start listening on bootup. defaults totrue
.transport
: transport type. Supported values:tcp-msgpack
: Msgpack over TCP (default)tcp-nlsjson
: New-line separated JSON over TCP
dbPath
: database pathwaitLeaderTimeout
: the time to wait to become a leader. defaults to 3000 (ms).
Use
A skiff client object implements the level-up API.
You can also extend the client with level-* plugins, including sublevel.
Other than that, you can:
.listen(cb)
Listen for nodes connecting to us.
.join(url, cb)
Joins a node given its URL.
.leave(url, cb)
Leaves a node given its URL.
License
ISC