proxygen
|
#include <RendezvousHash.h>
Public Member Functions | |
double | getMaxErrorRate () const override |
void | build (std::vector< std::pair< std::string, uint64_t >> &) override |
size_t | get (const uint64_t key, const size_t rank=0) const override |
std::vector< size_t > | selectNUnweighted (const uint64_t key, const size_t rank) const |
Public Member Functions inherited from proxygen::ConsistentHash | |
virtual | ~ConsistentHash () |
virtual void | build (std::vector< std::pair< std::string, uint64_t > > &)=0 |
Private Member Functions | |
size_t | getNthByWeightedHash (const uint64_t key, const size_t modRank, std::vector< size_t > *returnRankIds) const |
uint64_t | computeHash (const char *data, size_t len) const |
uint64_t | computeHash (uint64_t i) const |
Private Attributes | |
std::vector< std::pair< uint64_t, uint64_t > > | weights_ |
Definition at line 24 of file RendezvousHash.h.
|
override |
Definition at line 20 of file RendezvousHash.cpp.
References computeHash(), string, uint64_t, and weights_.
Referenced by TEST().
|
private |
Definition at line 214 of file RendezvousHash.cpp.
References folly::hash::fnv64_buf().
Referenced by build(), and getNthByWeightedHash().
|
overridevirtual |
get(key, N) finds the node ranked N in the consistent hashing space for the given key.
The returning value is the node's index in the input vector of build().
Implements proxygen::ConsistentHash.
Definition at line 127 of file RendezvousHash.cpp.
References getNthByWeightedHash().
Referenced by TEST().
|
overridevirtual |
get max error rate the current hashing space
Implements proxygen::ConsistentHash.
Definition at line 222 of file RendezvousHash.cpp.
|
private |
Definition at line 134 of file RendezvousHash.cpp.
References computeHash(), FOR_EACH_ENUMERATE, i, max, and weights_.
Referenced by get(), and selectNUnweighted().
std::vector< size_t > proxygen::RendezvousHash::selectNUnweighted | ( | const uint64_t | key, |
const size_t | rank | ||
) | const |
Definition at line 199 of file RendezvousHash.cpp.
References getNthByWeightedHash(), and weights_.
Referenced by TEST().
Definition at line 43 of file RendezvousHash.h.
Referenced by build(), getNthByWeightedHash(), and selectNUnweighted().