vines

0.0.4 • Public • Published

Node Vines

Motivation

A distributed system has many discrete processes that run on a multitude of arbitrary devices and networks yet to the user it appears to be a single coherent program. Distributed systems can help to provide availability and fault tolerance.

Synopsis

Fault-tolerance and strong consistency are not exactly compatable. Vines attempts to facilitate data replication and coordinated decision making through a combination of eventual consistency and quorum-based concensus.

Vines is targeted toward applications that require intelegence distribution such as application monitoring.

Features

  • Automatic reconnect
  • Quorum based consensus protocol
  • Gossip based data replication

Examples

Data replication

A computer at 192.168.0.2 can generate some information.

  var vine = Vine()
 
  vine
    .listen(8000)
    .gossip('foo', 'hello, world')

A computer at 192.168.0.3 can discover that information regardless of when then peers were connected or when the data was entered.

  var vine = Vine()
 
  vine
    .listen(8000)
    .join(8000, '192.168.0.2')
    .on('gossip', 'foo', function(value) {
      console.log(value);
    })

Concensus

A computer at 192.168.0.2 can call an election and cast a vote.

 
  var electionCriteria = {
    topic: 'email',
    expire: String(new Date(now.setMinutes(now.getMinutes() + 5))),
    min: 2,
    total: 2
  }
 
  var vine = Vine()
 
  vine
    .listen(8000)
    .on('quorum', onQuorum)
    .on('expire', onExpire)
    .election(electionCriteria)
    .vote('email', true)

A computer at 192.168.0.3 can also call an election however only one of the peers will be able to execute the callback for the quorum event.

  var vine = Vine()
 
  vine
    .listen(8000)
    .join(8000, '192.168.0.2')
    .on('quorum', onQuorum)
    .on('expire', onExpire)
    .election(electionCriteria)
    .vote('email', true)

Readme

Keywords

none

Package Sidebar

Install

npm i vines

Weekly Downloads

0

Version

0.0.4

License

MIT

Last publish

Collaborators

  • hij1nx