PMDK C++ bindings  1.13.0-git107.g7e59f08f
This is the C++ bindings documentation for PMDK's libpmemobj.
pmem::obj::experimental::concurrent_map< Key, Value, Comp, Allocator > Class Template Reference

Persistent memory aware implementation of Intel TBB concurrent_map with API partially compatible to std::map. More...

#include <libpmemobj++/experimental/concurrent_map.hpp>

Inherits detail::concurrent_skip_list< detail::map_traits< Key, Value, std::less< Key >, detail::default_random_generator, pmem::obj::allocator< detail::pair< const Key, Value >>, false, 64 > >.

Public Types

using key_type = typename base_type::key_type
 
using mapped_type = typename base_type::mapped_type
 
using value_type = typename base_type::value_type
 
using size_type = typename base_type::size_type
 
using difference_type = typename base_type::difference_type
 
using key_compare = Comp
 
using allocator_type = Allocator
 
using reference = typename base_type::reference
 
using const_reference = typename base_type::const_reference
 
using pointer = typename base_type::pointer
 
using const_pointer = typename base_type::const_pointer
 
using iterator = typename base_type::iterator
 
using const_iterator = typename base_type::const_iterator
 

Public Member Functions

 concurrent_map ()=default
 Default constructor.
 
 concurrent_map (const concurrent_map &table)
 Copy constructor.
 
 concurrent_map (concurrent_map &&table)
 Move constructor.
 
 concurrent_map (const key_compare &comp, const allocator_type &alloc=allocator_type())
 Construct the empty map.
 
template<class InputIt >
 concurrent_map (InputIt first, InputIt last, const key_compare &comp=Comp(), const allocator_type &alloc=allocator_type())
 Constructs the map with the contents of the range [first, last).
 
 concurrent_map (std::initializer_list< value_type > ilist)
 Constructs the map with initializer list.
 
concurrent_mapoperator= (const concurrent_map &other)
 Assignment operator.
 
concurrent_mapoperator= (concurrent_map &&other)
 Move-assignment operator.
 
concurrent_mapoperator= (std::initializer_list< value_type > ilist)
 

Related Functions

(Note that these are not member functions.)

template<typename Key , typename Value , typename Comp , typename Allocator >
void swap (concurrent_map< Key, Value, Comp, Allocator > &lhs, concurrent_map< Key, Value, Comp, Allocator > &rhs)
 Non-member swap.
 

Detailed Description

template<typename Key, typename Value, typename Comp = std::less<Key>, typename Allocator = pmem::obj::allocator<detail::pair<const Key, Value>>>
class pmem::obj::experimental::concurrent_map< Key, Value, Comp, Allocator >

Persistent memory aware implementation of Intel TBB concurrent_map with API partially compatible to std::map.

A sorted associative container that contains key-value pairs with unique keys. Keys are sorted by using the comparison function Compare. Search, removal, and insertion operations have average logarithmic complexity. Everywhere the concurrent_map uses the Compare requirements, uniqueness is determined by using the equivalence relation. In imprecise terms, two objects a and b are considered equivalent (not unique) if neither compares less than the other: !comp(a, b) && !comp(b, a).

The implementation is based on the lock-based concurrent skip list algorithm described in https://www.cs.tau.ac.il/~shanir/nir-pubs-web/Papers/OPODIS2006-BA.pdf. Our concurrent skip list implementation supports concurrent insertion and traversal, but not concurrent erasure. The erase method is prefixed with unsafe_, to indicate that there is no concurrency safety.

Each time, the pool with concurrent_map is being opened, the concurrent_map requires runtime_initialize() to be called in order to restore the map state after process restart.

Key, Value, Comp and Allocator types should be persistent memory aware types. Allocator type should satisfy the named requirements (https://en.cppreference.com/w/cpp/named_req/Allocator). The allocate() and deallocate() methods are called inside transactions.


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