Esempio n. 1
0
Aplomb.prototype.getDelegates = function (connection) {
    var key = this.extract(connection)
    var hash = fnv(0, new Buffer(key), 0, Buffer.byteLength(key))
    var index = hash % this.bucketCount
    var delegates = []
    this.delegations.reach(function (delegation) {
        if (delegation.delegates.length != 0) {
            delegates.push(delegation.buckets[index])
        }
    })
    return delegates.filter(function (del, i, set) {
        return (set.indexOf(del) == i)
    })
}
Esempio n. 2
0
Aplomb.prototype.getIndex = function (connection) {
    var key = this.extract(connection)
    var hash = fnv(0, new Buffer(key), 0, Buffer.byteLength(key))
    return hash % this.bucketCount
}