CernVM-FS  2.12.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 406 of file smallhash.h.

Constructor & Destructor Documentation

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

Definition at line 408 of file smallhash.h.

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

Definition at line 430 of file smallhash.h.

Member Function Documentation

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

Definition at line 460 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 453 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 479 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 471 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 414 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 446 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 438 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 469 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 488 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: