PMDK C++ bindings
1.7
This is the C++ bindings documentation for PMDK's libpmemobj.
|
Persistent memory aware implementation of Intel TBB concurrent_hash_map. More...
#include <libpmemobj++/experimental/concurrent_hash_map.hpp>
Classes | |
class | accessor |
Allows write access to elements and combines data access, locking, and garbage collection. More... | |
class | bucket_accessor |
Bucket accessor is to find, rehash, acquire a lock, and access a bucket. More... | |
class | const_accessor |
Combines data access, locking, and garbage collection. More... | |
struct | node |
Node structure to store Key/Value pair. More... | |
class | serial_bucket_accessor |
Serial bucket accessor used to access bucket in a serial operations. More... | |
Public Member Functions | |
concurrent_hash_map () | |
Construct empty table. | |
concurrent_hash_map (size_type n) | |
Construct empty table with n preallocated buckets. More... | |
concurrent_hash_map (const concurrent_hash_map &table) | |
Copy constructor. | |
concurrent_hash_map (concurrent_hash_map &&table) | |
Move constructor. | |
template<typename I > | |
concurrent_hash_map (I first, I last) | |
Construction table with copying iteration range. | |
concurrent_hash_map (std::initializer_list< value_type > il) | |
Construct table with initializer list. | |
void | initialize (bool graceful_shutdown=false) |
Intialize persistent concurrent hash map after process restart. More... | |
concurrent_hash_map & | operator= (const concurrent_hash_map &table) |
Assignment. More... | |
concurrent_hash_map & | operator= (std::initializer_list< value_type > il) |
Assignment. More... | |
void | rehash (size_type n=0) |
Rehashes and optionally resizes the whole table. More... | |
void | clear () |
Clear hash map content. More... | |
~concurrent_hash_map () | |
Clear table and destroy it. | |
iterator | begin () |
iterator | end () |
const_iterator | begin () const |
const_iterator | end () const |
size_type | size () const |
bool | empty () const |
size_type | max_size () const |
Upper bound on size. | |
size_type | bucket_count () const |
void | swap (concurrent_hash_map &table) |
Swap two instances. More... | |
size_type | count (const Key &key) const |
template<typename K , typename = typename std::enable_if< internal::has_transparent_key_equal<hasher>::value, K>::type> | |
size_type | count (const K &key) const |
This overload only participates in overload resolution if the qualified-id Hash::transparent_key_equal is valid and denotes a type. More... | |
bool | find (const_accessor &result, const Key &key) const |
Find item and acquire a read lock on the item. More... | |
template<typename K , typename = typename std::enable_if< internal::has_transparent_key_equal<hasher>::value, K>::type> | |
bool | find (const_accessor &result, const K &key) const |
Find item and acquire a read lock on the item. More... | |
bool | find (accessor &result, const Key &key) |
Find item and acquire a write lock on the item. More... | |
template<typename K , typename = typename std::enable_if< internal::has_transparent_key_equal<hasher>::value, K>::type> | |
bool | find (accessor &result, const K &key) |
Find item and acquire a write lock on the item. More... | |
bool | insert (const_accessor &result, const Key &key) |
Insert item (if not already present) and acquire a read lock on the item. More... | |
bool | insert (accessor &result, const Key &key) |
Insert item (if not already present) and acquire a write lock on the item. More... | |
bool | insert (const_accessor &result, const value_type &value) |
Insert item by copying if there is no such key present already and acquire a read lock on the item. More... | |
bool | insert (accessor &result, const value_type &value) |
Insert item by copying if there is no such key present already and acquire a write lock on the item. More... | |
bool | insert (const value_type &value) |
Insert item by copying if there is no such key present already. More... | |
bool | insert (const_accessor &result, value_type &&value) |
Insert item by copying if there is no such key present already and acquire a read lock on the item. More... | |
bool | insert (accessor &result, value_type &&value) |
Insert item by copying if there is no such key present already and acquire a write lock on the item. More... | |
bool | insert (value_type &&value) |
Insert item by copying if there is no such key present already. More... | |
template<typename I > | |
void | insert (I first, I last) |
Insert range [first, last) More... | |
void | insert (std::initializer_list< value_type > il) |
Insert initializer list. More... | |
bool | erase (const Key &key) |
Remove element with corresponding key. More... | |
template<typename K , typename = typename std::enable_if< internal::has_transparent_key_equal<hasher>::value, K>::type> | |
bool | erase (const K &key) |
Remove element with corresponding key. More... | |
Protected Member Functions | |
template<bool OpInsert, typename K > | |
bool | lookup (const K &key, const void *param, const_accessor *result, bool write, void(*allocate_node)(pool_base &, persistent_ptr< node > &, const void *, const node_base_ptr_t &)) |
Insert or find item and optionally acquire a lock on the item. | |
void | internal_copy (const concurrent_hash_map &source) |
Copy "source" to *this, where *this must start out empty. | |
Persistent memory aware implementation of Intel TBB concurrent_hash_map.
|
inline |
Construct empty table with n preallocated buckets.
This number serves also as initial concurrency level.
|
inline |
|
inline |
|
inline |
void pmem::obj::experimental::concurrent_hash_map< Key, T, Hash, KeyEqual >::clear |
Clear hash map content.
std::runtime_error | in case of PMDK transaction failure Not thread safe. |
|
inline |
This overload only participates in overload resolution if the qualified-id Hash::transparent_key_equal is valid and denotes a type.
This assumes that such Hash is callable with both K and Key type, and that its key_equal is transparent, which, together, allows calling this function without constructing an instance of Key
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
Remove element with corresponding key.
This overload only participates in overload resolution if the qualified-id Hash::transparent_key_equal is valid and denotes a type. This assumes that such Hash is callable with both K and Key type, and that its key_equal is transparent, which, together, allows calling this function without constructing an instance of Key
std::runtime_error | in case of PMDK unable to free the memory |
|
inline |
Remove element with corresponding key.
std::runtime_error | in case of PMDK unable to free the memory |
|
inline |
Find item and acquire a write lock on the item.
This overload only participates in overload resolution if the qualified-id Hash::transparent_key_equal is valid and denotes a type. This assumes that such Hash is callable with both K and Key type, and that its key_equal is transparent, which, together, allows calling this function without constructing an instance of Key
|
inline |
Find item and acquire a write lock on the item.
|
inline |
Find item and acquire a read lock on the item.
This overload only participates in overload resolution if the qualified-id Hash::transparent_key_equal is valid and denotes a type. This assumes that such Hash is callable with both K and Key type, and that its key_equal is transparent, which, together, allows calling this function without constructing an instance of Key
|
inline |
Find item and acquire a read lock on the item.
|
inline |
Intialize persistent concurrent hash map after process restart.
Should be called everytime after process restart. Not thread safe.
|
inline |
Insert item (if not already present) and acquire a write lock on the item.
std::bad_alloc | on allocation failure. |
|
inline |
Insert item by copying if there is no such key present already and acquire a write lock on the item.
|
inline |
Insert item by copying if there is no such key present already and acquire a write lock on the item.
std::bad_alloc | on allocation failure. |
|
inline |
Insert item by copying if there is no such key present already.
|
inline |
Insert item (if not already present) and acquire a read lock on the item.
std::bad_alloc | on allocation failure. |
|
inline |
Insert item by copying if there is no such key present already and acquire a read lock on the item.
std::bad_alloc | on allocation failure. |
|
inline |
Insert item by copying if there is no such key present already and acquire a read lock on the item.
std::bad_alloc | on allocation failure. |
|
inline |
Insert range [first, last)
std::bad_alloc | on allocation failure. |
|
inline |
Insert initializer list.
std::bad_alloc | on allocation failure. |
|
inline |
Insert item by copying if there is no such key present already.
std::bad_alloc | on allocation failure. |
|
inline |
Assignment.
std::runtime_error | in case of PMDK transaction failure Not thread safe. |
|
inline |
Assignment.
std::runtime_error | in case of PMDK transaction failure Not thread safe. |
void pmem::obj::experimental::concurrent_hash_map< Key, T, Hash, KeyEqual >::rehash | ( | size_type | n = 0 | ) |
Rehashes and optionally resizes the whole table.
Useful to optimize performance before or after concurrent operations. Not thread safe.
|
inline |
void pmem::obj::experimental::concurrent_hash_map< Key, T, Hash, KeyEqual >::swap | ( | concurrent_hash_map< Key, T, Hash, KeyEqual > & | table | ) |
Swap two instances.
Iterators are invalidated. Not thread safe.