/craft

a raft implementation for crystal

Primary LanguageCrystalMIT LicenseMIT

craft

TODO: An early (and pre-alpha) implementation of the raft consensus protocol in crystal, no deps.

Why ? Because I want to learn crystal and love distributed systems

Installation

  1. Add the dependency to your shard.yml:
dependencies:
  craft:
    github: tclain/craft
  1. Run shards install

Usage

require "craft"

cluster = Craft::Cluster.new(current: Craft::Node.new 'addr1', peers: [Craft::Node.new 'addr2', Craft::Node.new 'addr3'])

if cluster.current.leader?
  cluster.propagate_state "hello"
end

Development

git clone github.com/tclain/

Contributing

  1. Fork it (https://github.com/tclain/craft/fork)
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create a new Pull Request

Contributors