Share your code. npm Orgs help your team discover, share, and reuse code. Create a free org »

    monoid-consistent-hashpublic

    Consistent Hash Monoid

    Fantasy Land Compliant!

    A consistent hash ring implemented as a monoid.

    Example

    var HashRingNode = require("monoid-consistent-hash/node");
     
    var list = ["prod-cache001", "prod-cache002", "prod-cache003", "prod-cache004"];
     
    var hashRing = list.map(function(n) { return new HashRingNode(n, 100); })
                       .reduce(function(m, n) { return m.concat(n); });
     
    console.log(hashRing.get("beep").getOrElse(""));
    console.log(hashRing.get("bop").getOrElse(""));
    console.log(hashRing.get("boop").getOrElse(""));

    Keywords

    none

    install

    npm i monoid-consistent-hash

    Downloadsweekly downloads

    2

    version

    0.1.0

    license

    none

    repository

    github.com

    last publish

    collaborators

    • avatar