CernVM-FS  2.9.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
MultiHash< Key, Value > Class Template Reference

#include <smallhash.h>

Public Member Functions

 MultiHash ()
 
void Init (const uint8_t num_hashmaps, const Key &empty_key, uint32_t(*hasher)(const Key &key))
 
 ~MultiHash ()
 
bool Lookup (const Key &key, Value *value)
 
void Insert (const Key &key, const Value &value)
 
void Erase (const Key &key)
 
void Clear ()
 
uint8_t num_hashmaps () const
 
void GetSizes (uint32_t *sizes)
 
void GetCollisionStats (uint64_t *num_collisions, uint32_t *max_collisions)
 

Private Member Functions

uint8_t SelectHashmap (const Key &key)
 
void Lock (const uint8_t target)
 
void Unlock (const uint8_t target)
 

Private Attributes

uint8_t num_hashmaps_
 
SmallHashDynamic< Key, Value > * hashmaps_
 
pthread_mutex_t * locks_
 

Detailed Description

template<class Key, class Value>
class MultiHash< Key, Value >

Distributes the key-value pairs over $n$ dynamic hash maps with individual mutexes. Hence low mutex contention, and benefits from multiple processors.

Definition at line 380 of file smallhash.h.

Constructor & Destructor Documentation

template<class Key , class Value >
MultiHash< Key, Value >::MultiHash ( )
inline

Definition at line 382 of file smallhash.h.

template<class Key , class Value >
MultiHash< Key, Value >::~MultiHash ( )
inline

Definition at line 404 of file smallhash.h.

Member Function Documentation

template<class Key , class Value >
void MultiHash< Key, Value >::Clear ( )
inline

Definition at line 434 of file smallhash.h.

Here is the call graph for this function:

template<class Key , class Value >
void MultiHash< Key, Value >::Erase ( const Key &  key)
inline

Definition at line 427 of file smallhash.h.

Here is the call graph for this function:

template<class Key , class Value >
void MultiHash< Key, Value >::GetCollisionStats ( uint64_t *  num_collisions,
uint32_t *  max_collisions 
)
inline

Definition at line 453 of file smallhash.h.

Here is the call graph for this function:

template<class Key , class Value >
void MultiHash< Key, Value >::GetSizes ( uint32_t *  sizes)
inline

Definition at line 445 of file smallhash.h.

Here is the call graph for this function:

template<class Key , class Value >
void MultiHash< Key, Value >::Init ( const uint8_t  num_hashmaps,
const Key &  empty_key,
uint32_t(*)(const Key &key)  hasher 
)
inline

Definition at line 388 of file smallhash.h.

Here is the call graph for this function:

template<class Key , class Value >
void MultiHash< Key, Value >::Insert ( const Key &  key,
const Value &  value 
)
inline

Definition at line 420 of file smallhash.h.

Here is the call graph for this function:

template<class Key , class Value >
void MultiHash< Key, Value >::Lock ( const uint8_t  target)
inlineprivate
template<class Key , class Value >
bool MultiHash< Key, Value >::Lookup ( const Key &  key,
Value *  value 
)
inline

Definition at line 412 of file smallhash.h.

Here is the call graph for this function:

template<class Key , class Value >
uint8_t MultiHash< Key, Value >::num_hashmaps ( ) const
inline

Definition at line 443 of file smallhash.h.

Referenced by MultiHash< Key, Value >::Init().

Here is the caller graph for this function:

template<class Key , class Value >
uint8_t MultiHash< Key, Value >::SelectHashmap ( const Key &  key)
inlineprivate

Definition at line 462 of file smallhash.h.

Referenced by MultiHash< Key, Value >::Erase(), MultiHash< Key, Value >::Insert(), and MultiHash< Key, Value >::Lookup().

Here is the call graph for this function:

Here is the caller graph for this function:

template<class Key , class Value >
void MultiHash< Key, Value >::Unlock ( const uint8_t  target)
inlineprivate

Member Data Documentation

template<class Key , class Value >
pthread_mutex_t* MultiHash< Key, Value >::locks_
private

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