proxygen
proxygen::ConsistentHash Class Referenceabstract

#include <ConsistentHash.h>

Inheritance diagram for proxygen::ConsistentHash:
proxygen::RendezvousHash

Public Member Functions

virtual ~ConsistentHash ()
 
virtual void build (std::vector< std::pair< std::string, uint64_t > > &)=0
 
virtual size_t get (const uint64_t key, const size_t rank=0) const =0
 
virtual double getMaxErrorRate () const =0
 

Detailed Description

Definition at line 18 of file ConsistentHash.h.

Constructor & Destructor Documentation

virtual proxygen::ConsistentHash::~ConsistentHash ( )
inlinevirtual

Definition at line 20 of file ConsistentHash.h.

References build(), getMaxErrorRate(), and uint64_t.

20 {}

Member Function Documentation

virtual void proxygen::ConsistentHash::build ( std::vector< std::pair< std::string, uint64_t > > &  )
pure virtual

build() builds the hashing pool based on a vector of nodes with their keys and weights.

The bevahior of calling build multiple times is undefined.

build() is not thread safe with get(), documented below.

Referenced by ~ConsistentHash().

virtual size_t proxygen::ConsistentHash::get ( const uint64_t  key,
const size_t  rank = 0 
) const
pure virtual

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().

Implemented in proxygen::RendezvousHash.

virtual double proxygen::ConsistentHash::getMaxErrorRate ( ) const
pure virtual

get max error rate the current hashing space

Implemented in proxygen::RendezvousHash.

Referenced by ~ConsistentHash().


The documentation for this class was generated from the following file: