Skip to content
A pure Elm consistent hashing module
Elm
Branch: master
Clone or download

Latest commit

Fetching latest commit…
Cannot retrieve the latest commit at this time.

Files

Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.circleci
src
tests/Tests
.gitignore
LICENSE
README.md
elm.json
package-lock.json
package.json

README.md

elm-consistent-hashing

CircleCI

A pure Elm consistent hashing module

What is Consistent Hashing?

Consistent Hashing is a distributed hashing scheme that operates independently of the number of servers or objects in a distributed hash table by assigning them a position on an abstract circle, or hash ring. This allows servers and objects to scale without affecting the overall system.

https://www.toptal.com/big-data/consistent-hashing

Example

import ConsistentHashing as ConsistentHashing
import ConsistentHashing.Node as Node
import ConsistentHashing.Replica as Replica



-- model


type alias Model =
    { ch : ConsistentHashing.ConsistentHashing }


-- init


init : Model
init =
    { ch =
        ConsistentHashing.new Replica.default (Node.new "node1")
            |> ConsistentHashing.add (Node.new "node2")
            |> ConsistentHashing.add (Node.new "node3")
            |> ConsistentHashing.add (Node.new "node4")
    }

License

MIT

Contribution

PRs accepted

You can’t perform that action at this time.