PMDK C++ bindings
1.10.1
This is the C++ bindings documentation for PMDK's libpmemobj.
|
Persistent memory aware implementation of the concurrent skip list. More...
#include <libpmemobj++/container/detail/concurrent_skip_list_impl.hpp>
Public Member Functions | |
concurrent_skip_list () | |
Default constructor. More... | |
concurrent_skip_list (const key_compare &comp, const allocator_type &alloc=allocator_type()) | |
Constructs an empty container. More... | |
template<class InputIt > | |
concurrent_skip_list (InputIt first, InputIt last, const key_compare &comp=key_compare(), const allocator_type &alloc=allocator_type()) | |
Constructs the container with the contents of the range [first, last). More... | |
concurrent_skip_list (const concurrent_skip_list &other) | |
Copy constructor. More... | |
concurrent_skip_list (const concurrent_skip_list &other, const allocator_type &alloc) | |
Copy constructor. More... | |
concurrent_skip_list (concurrent_skip_list &&other) | |
Move constructor. More... | |
concurrent_skip_list (concurrent_skip_list &&other, const allocator_type &alloc) | |
Move constructor. More... | |
void | runtime_initialize () |
Intialize concurrent_skip_list after process restart. More... | |
void | free_data () |
Should be called before concurrent_skip_list destructor is called. More... | |
~concurrent_skip_list () | |
Destructor. More... | |
concurrent_skip_list & | operator= (const concurrent_skip_list &other) |
Copy assignment operator. More... | |
concurrent_skip_list & | operator= (concurrent_skip_list &&other) |
Move assignment operator. More... | |
concurrent_skip_list & | operator= (std::initializer_list< value_type > il) |
Replaces the contents with those identified by initializer list il. More... | |
std::pair< iterator, bool > | insert (const value_type &value) |
Inserts value in a thread-safe way. More... | |
template<typename P , typename std::enable_if< std::is_constructible< value_type, P && >::value >::type > | |
std::pair< iterator, bool > | insert (P &&value) |
Inserts value. More... | |
std::pair< iterator, bool > | insert (value_type &&value) |
Inserts value using move semantic. More... | |
iterator | insert (const_iterator hint, const_reference value) |
Inserts value in the position as close as possible, just prior to hint. More... | |
template<typename P , typename std::enable_if< std::is_constructible< value_type, P && >::value >::type > | |
iterator | insert (const_iterator hint, P &&value) |
Inserts value in the position as close as possible, just prior to hint. More... | |
template<typename InputIterator > | |
void | insert (InputIterator first, InputIterator last) |
Inserts elements from range [first, last). More... | |
void | insert (std::initializer_list< value_type > ilist) |
Inserts elements from initializer list ilist. More... | |
template<typename... Args> | |
std::pair< iterator, bool > | emplace (Args &&... args) |
Inserts a new element into the container constructed in-place with the given args if there is no element with the key in the container. More... | |
template<typename... Args> | |
iterator | emplace_hint (const_iterator hint, Args &&... args) |
Inserts a new element to the container as close as possible to the position just before hint. More... | |
template<typename... Args> | |
std::pair< iterator, bool > | try_emplace (const key_type &k, Args &&... args) |
If a key equivalent to k already exists in the container, does nothing. More... | |
template<typename... Args> | |
std::pair< iterator, bool > | try_emplace (key_type &&k, Args &&... args) |
If a key equivalent to k already exists in the container, does nothing. More... | |
template<typename K , typename... Args> | |
std::enable_if< has_is_transparent< key_compare >::value &&std::is_constructible< key_type, K && >::value, std::pair< iterator, bool > >::type | try_emplace (K &&k, Args &&... args) |
If a key equivalent to k already exists in the container, does nothing. More... | |
iterator | unsafe_erase (iterator pos) |
Removes the element at pos from the container. More... | |
iterator | unsafe_erase (const_iterator pos) |
Removes the element at pos from the container. More... | |
iterator | unsafe_erase (const_iterator first, const_iterator last) |
Removes the elements in the range [first; last), which must be a valid range in *this. More... | |
size_type | unsafe_erase (const key_type &key) |
Removes the element (if one exists) with the key equivalent to key. More... | |
template<typename K , typename = typename std::enable_if< has_is_transparent<key_compare>::value && !std::is_convertible<K, iterator>::value && !std::is_convertible<K, const_iterator>::value, K>::type> | |
size_type | unsafe_erase (const K &key) |
Removes the element (if one exists) with the key equivalent to key. More... | |
iterator | lower_bound (const key_type &key) |
Returns an iterator pointing to the first element that is not less than (i.e. More... | |
const_iterator | lower_bound (const key_type &key) const |
Returns an iterator pointing to the first element that is not less than (i.e. More... | |
template<typename K , typename = typename std::enable_if< has_is_transparent<key_compare>::value, K>::type> | |
iterator | lower_bound (const K &x) |
Returns an iterator pointing to the first element that compares not less (i.e. More... | |
template<typename K , typename = typename std::enable_if< has_is_transparent<key_compare>::value, K>::type> | |
const_iterator | lower_bound (const K &x) const |
Returns an iterator pointing to the first element that compares not less (i.e. More... | |
iterator | upper_bound (const key_type &key) |
Returns an iterator pointing to the first element that is greater than key. More... | |
const_iterator | upper_bound (const key_type &key) const |
Returns an iterator pointing to the first element that is greater than key. More... | |
template<typename K , typename = typename std::enable_if< has_is_transparent<key_compare>::value, K>::type> | |
iterator | upper_bound (const K &x) |
Returns an iterator pointing to the first element that compares greater to the value x. More... | |
template<typename K , typename = typename std::enable_if< has_is_transparent<key_compare>::value, K>::type> | |
const_iterator | upper_bound (const K &x) const |
Returns an iterator pointing to the first element that compares greater to the value x. More... | |
iterator | find (const key_type &key) |
Finds an element with key equivalent to key. More... | |
const_iterator | find (const key_type &key) const |
Finds an element with key equivalent to key. More... | |
template<typename K , typename = typename std::enable_if< has_is_transparent<key_compare>::value, K>::type> | |
iterator | find (const K &x) |
Finds an element with key that compares equivalent to the value x. More... | |
template<typename K , typename = typename std::enable_if< has_is_transparent<key_compare>::value, K>::type> | |
const_iterator | find (const K &x) const |
Finds an element with key that compares equivalent to the value x. More... | |
size_type | count (const key_type &key) const |
Returns the number of elements with key that compares equivalent to the specified argument. More... | |
template<typename K , typename = typename std::enable_if< has_is_transparent<key_compare>::value, K>::type> | |
size_type | count (const K &key) const |
Returns the number of elements with key that compares equivalent to the specified argument. More... | |
bool | contains (const key_type &key) const |
Checks if there is an element with key equivalent to key in the container. More... | |
template<typename K , typename = typename std::enable_if< has_is_transparent<key_compare>::value, K>::type> | |
bool | contains (const K &x) const |
Checks if there is an element with key that compares equivalent to the value x. More... | |
void | clear () |
Erases all elements from the container transactionally. More... | |
iterator | begin () |
Returns an iterator to the first element of the container. More... | |
const_iterator | begin () const |
Returns an iterator to the first element of the container. More... | |
const_iterator | cbegin () const |
Returns an iterator to the first element of the container. More... | |
iterator | end () |
Returns an iterator to the element following the last element of the map. More... | |
const_iterator | end () const |
Returns an iterator to the element following the last element of the map. More... | |
const_iterator | cend () const |
Returns an iterator to the element following the last element of the map. More... | |
size_type | size () const |
Returns the number of elements in the container, i.e. More... | |
size_type | max_size () const |
Returns the maximum number of elements the container is able to hold due to system or library implementation limitations, i.e. More... | |
bool | empty () const |
Checks if the container has no elements, i.e. More... | |
const allocator_type & | get_allocator () const |
Returns a const reference to the allocator associated with the container. More... | |
allocator_type & | get_allocator () |
Returns a reference to the allocator associated with the container. More... | |
void | swap (concurrent_skip_list &other) |
Exchanges the contents of the container with those of other transactionally. More... | |
std::pair< iterator, iterator > | equal_range (const key_type &key) |
Returns a range containing all elements with the given key in the container. More... | |
std::pair< const_iterator, const_iterator > | equal_range (const key_type &key) const |
Returns a range containing all elements with the given key in the container. More... | |
template<typename K , typename = typename std::enable_if< has_is_transparent<key_compare>::value, K>::type> | |
std::pair< iterator, iterator > | equal_range (const K &x) |
Returns a range containing all elements with the given key in the container. More... | |
template<typename K , typename = typename std::enable_if< has_is_transparent<key_compare>::value, K>::type> | |
std::pair< const_iterator, const_iterator > | equal_range (const K &key) const |
Returns a range containing all elements with the given key in the container. More... | |
const key_compare & | key_comp () const |
Returns a const reference to the object that compares the keys. More... | |
key_compare & | key_comp () |
Returns a reference to the object that compares the keys. More... | |
Private Member Functions | |
void | check_tx_stage_work () const |
Private helper function. More... | |
template<typename K , typename pointer_type , typename comparator > | |
persistent_node_ptr | internal_find_position (size_type level, pointer_type &prev, const K &key, const comparator &cmp) const |
Finds position on the. More... | |
template<typename K > | |
void | find_insert_pos (prev_array_type &prev_nodes, next_array_type &next_nodes, const K &key) |
The method finds insert position for the given. More... | |
template<typename K , typename comparator > | |
void | fill_prev_next_arrays (prev_array_type &prev_nodes, next_array_type &next_nodes, const K &key, const comparator &cmp) |
The method finds successor and predecessr nodes on each level of the skip list for the given. More... | |
template<typename... Args> | |
std::pair< iterator, bool > | internal_unsafe_emplace (Args &&... args) |
Not thread-safe but can be called within a transaction. More... | |
template<typename K , typename... Args> | |
std::pair< iterator, bool > | internal_insert (const K &key, Args &&... args) |
Construct and insert new node to the skip list in a thread-safe way. | |
template<typename K , typename PrepareNode > | |
std::pair< iterator, bool > | internal_insert_node (const K &key, size_type height, PrepareNode &&prepare_new_node) |
Try to insert new node to the skip list in a thread-safe way. | |
template<typename PrepareNode > | |
node_ptr | try_insert_node (prev_array_type &prev_nodes, const next_array_type &next_nodes, size_type height, PrepareNode &&prepare_new_node) |
Try to insert new node to the skip list. More... | |
bool | check_prev_array (const prev_array_type &prevs, size_type height) |
Used only inside asserts. More... | |
template<typename K , typename comparator > | |
const_iterator | internal_get_bound (const K &key, const comparator &cmp) const |
Returns an iterator pointing to the first element from the list for which cmp(element, key) is false. More... | |
template<typename K , typename comparator > | |
iterator | internal_get_bound (const K &key, const comparator &cmp) |
Returns an iterator pointing to the first element from the list for which cmp(element, key) is false. More... | |
std::pair< persistent_node_ptr, persistent_node_ptr > | internal_extract (const_iterator it) |
obj::pool_base | get_pool_base () const |
Get the persistent memory pool where hashmap resides. More... | |
size_type | random_level () |
Generate random level. | |
template<typename... Args> | |
persistent_node_ptr | create_node (Args &&... args) |
Creates new node. | |
void | create_dummy_head () |
Creates dummy head. More... | |
template<typename... Args> | |
persistent_node_ptr | creates_dummy_node (size_type height, Args &&... args) |
Creates new node, value_type should be constructed separately. More... | |
void | tls_restore () |
Process any information which was saved to tls and clears tls. | |
Private Attributes | |
obj::p< size_type > | on_init_size |
This variable holds real size after the skip list is initialized. More... | |
Persistent memory aware implementation of the concurrent skip list.
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_skip_list is being opened, the concurrent_skip_list requires runtime_initialize() to be called in order to restore the state after process restart.
Traits template parameter allows to specify properties of the concurrent_ski_list. The Traits type should has the following member types:
|
inline |
Default constructor.
Construct empty skip list.
pmem::pool_error | if an object is not in persistent memory. |
pmem::transaction_scope_error | if constructor wasn't called in transaction. |
|
inlineexplicit |
Constructs an empty container.
[in] | comp | comparison function object to use for all comparisons of keys. |
[in] | alloc | allocator to use for all memory allocations of this container. |
pmem::pool_error | if an object is not in persistent memory. |
pmem::transaction_scope_error | if constructor wasn't called in transaction. |
pmem::transaction_alloc_error | when allocating memory for inserted elements in transaction failed. |
|
inline |
Constructs the container with the contents of the range [first, last).
If multiple elements in the range have keys that compare equivalent, the first element is inserted.
[in] | first | first iterator of inserted range. |
[in] | last | last iterator of inserted range. |
[in] | comp | comparison function object to use for all comparisons of keys. |
[in] | alloc | allocator to use for all memory allocations of this container. |
InputIt must meet the requirements of LegacyInputIterator.
pmem::pool_error | if an object is not in persistent memory. |
pmem::transaction_scope_error | if constructor wasn't called in transaction. |
pmem::transaction_alloc_error | when allocating memory for inserted elements in transaction failed. |
rethrows | element constructor exception. |
|
inline |
Copy constructor.
Constructs the container with the copy of the contents of other.
[in] | other | reference to the concurrent_skip_list to be copied. |
pmem::pool_error | if an object is not in persistent memory. |
pmem::transaction_alloc_error | when allocating memory for copied elements in transaction failed. |
pmem::transaction_scope_error | if constructor wasn't called in transaction. |
rethrows | element constructor exception. |
|
inline |
Copy constructor.
Constructs the container with the copy of the contents of other.
[in] | other | reference to the concurrent_skip_list to be copied. |
[in] | alloc | allocator to use for all memory allocations of this container. |
pmem::pool_error | if an object is not in persistent memory. |
pmem::transaction_alloc_error | when allocating memory for copied elements in transaction failed. |
pmem::transaction_scope_error | if constructor wasn't called in transaction. |
rethrows | element constructor exception. |
|
inline |
Move constructor.
Constructs the container with the contents of other using move semantics. Allocator is obtained by move-construction from the allocator belonging to other
[in] | other | reference to the concurrent_skip_list to be copied. |
pmem::pool_error | if an object is not in persistent memory. |
pmem::transaction_alloc_error | when allocating memory for copied elements in transaction failed. |
pmem::transaction_scope_error | if constructor wasn't called in transaction. |
rethrows | element constructor exception. |
|
inline |
Move constructor.
Constructs the container with the contents of other using move semantics.
[in] | other | reference to the concurrent_skip_list to be copied. |
[in] | alloc | allocator to use for all memory allocations of this container. |
pmem::pool_error | if an object is not in persistent memory. |
pmem::transaction_alloc_error | when allocating memory for copied elements in transaction failed. |
pmem::transaction_scope_error | if constructor wasn't called in transaction. |
rethrows | element constructor exception. |
|
inline |
Destructor.
free_data should be called before concurrent_skip_list destructor is called. Otherwise, program can terminate if an exception occurs while freeing memory inside dtor.
The skip list map can NOT be used after free_data() was called (unless it was called in a transaction and that transaction aborted).
|
inline |
Returns an iterator to the first element of the container.
If the map is empty, the returned iterator will be equal to end().
|
inline |
Returns an iterator to the first element of the container.
If the map is empty, the returned iterator will be equal to end().
|
inline |
Returns an iterator to the first element of the container.
If the map is empty, the returned iterator will be equal to end().
|
inline |
Returns an iterator to the element following the last element of the map.
This element acts as a placeholder; attempting to access it results in undefined behavior.
|
inlineprivate |
Used only inside asserts.
Checks that prev_array is filled with correct values.
|
inlineprivate |
Private helper function.
Checks if current transaction stage is equal to TX_STAGE_WORK and throws an exception otherwise.
pmem::transaction_scope_error | if current transaction stage is not equal to TX_STAGE_WORK. |
|
inline |
Erases all elements from the container transactionally.
pmem::transaction_error | when snapshotting failed. |
rethrows | destructor exception. |
|
inline |
Checks if there is an element with key that compares equivalent to the value x.
This overload only participates in overload resolution if the qualified-id Compare::is_transparent is valid and denotes a type. It allows calling this function without constructing an instance of Key.
[in] | x | a value of any type that can be transparently compared with a key. |
|
inline |
Checks if there is an element with key equivalent to key in the container.
[in] | key | key value of the element to search for. |
|
inline |
Returns the number of elements with key that compares equivalent to the specified argument.
This overload only participates in overload resolution if the qualified-id Compare::is_transparent is valid and denotes a type. They allow calling this function without constructing an instance of Key.
[in] | key | alternative value to compare to the keys. |
|
inline |
Returns the number of elements with key that compares equivalent to the specified argument.
[in] | key | key value of the element to count. |
|
inlineprivate |
Creates dummy head.
|
inlineprivate |
Creates new node, value_type should be constructed separately.
Each node object has different size which depends on number of layers the node is linked. In this method we calculate the size of the new node based on the node height. Then required amount of bytes are allcoated and casted to the persistent_node_ptr.
|
inline |
Inserts a new element into the container constructed in-place with the given args if there is no element with the key in the container.
Careful use of emplace allows the new element to be constructed while avoiding unnecessary copy or move operations. The constructor of the new element (i.e. std::pair<const Key, T>) is called with exactly the same arguments as supplied to emplace, forwarded via std::forward<Args>(args).... The element may be constructed even if there already is an element with the key in the container, in which case the newly constructed element will be destroyed immediately.
No iterators or references are invalidated.
[in] | args | arguments to forward to the constructor of the element |
pmem::transaction_error | when snapshotting failed. |
pmem::transaction_alloc_error | when allocating new memory failed. |
pmem::transaction_scope_error | if called inside transaction. |
rethrows | constructor exception. |
|
inline |
Inserts a new element to the container as close as possible to the position just before hint.
The element is constructed in-place, i.e. no copy or move operations are performed.
The constructor of the element type (value_type, that is, std::pair<const Key, T>) is called with exactly the same arguments as supplied to the function, forwarded with std::forward<Args>(args)...
No iterators or references are invalidated.
[in] | hint | iterator to the position before which the new element will be inserted. |
[in] | args | arguments to forward to the constructor of the element. |
If the insertion failed because the element already exists, returns an iterator to the already existing element with the equivalent key.
pmem::transaction_error | when snapshotting failed. |
pmem::transaction_alloc_error | when allocating new memory failed. |
pmem::transaction_scope_error | if called inside transaction. |
rethrows | constructor exception. |
|
inline |
|
inline |
Returns an iterator to the element following the last element of the map.
This element acts as a placeholder; attempting to access it results in undefined behavior.
|
inline |
Returns an iterator to the element following the last element of the map.
This element acts as a placeholder; attempting to access it results in undefined behavior.
|
inline |
Returns a range containing all elements with the given key in the container.
The range is defined by two iterators, one pointing to the first element that is not less than key and another pointing to the first element greater than key. Alternatively, the first iterator may be obtained with lower_bound(), and the second with upper_bound().
Compares the keys to the value x. This overload only participates in overload resolution if the qualified-id Compare::is_transparent is valid and denotes a type. They allow calling this function without constructing an instance of Key.
[in] | key | alternative value that can be compared to Key. |
|
inline |
Returns a range containing all elements with the given key in the container.
The range is defined by two iterators, one pointing to the first element that is not less than key and another pointing to the first element greater than key. Alternatively, the first iterator may be obtained with lower_bound(), and the second with upper_bound().
Compares the keys to the value x. This overload only participates in overload resolution if the qualified-id Compare::is_transparent is valid and denotes a type. They allow calling this function without constructing an instance of Key.
[in] | x | alternative value that can be compared to Key. |
|
inline |
Returns a range containing all elements with the given key in the container.
The range is defined by two iterators, one pointing to the first element that is not less than key and another pointing to the first element greater than key. Alternatively, the first iterator may be obtained with lower_bound(), and the second with upper_bound().
Compares the keys to key.
[in] | key | key value to compare the elements to. |
|
inline |
Returns a range containing all elements with the given key in the container.
The range is defined by two iterators, one pointing to the first element that is not less than key and another pointing to the first element greater than key. Alternatively, the first iterator may be obtained with lower_bound(), and the second with upper_bound().
Compares the keys to key.
[in] | key | key value to compare the elements to. |
|
inlineprivate |
The method finds successor and predecessr nodes on each level of the skip list for the given.
[out] | prev_nodes | array of pointers to predecessor nodes on each level. |
[out] | next_nodes | array of pointers to successor nodes on each level. |
[in] | key | inserted key. |
[in] | cmp | comparator functor used for the search. |
|
inline |
Finds an element with key that compares equivalent to the value x.
This overload only participates in overload resolution if the qualified-id Compare::is_transparent is valid and denotes a type. It allows calling this function without constructing an instance of Key.
[in] | x | a value of any type that can be transparently compared with a key. |
|
inline |
Finds an element with key that compares equivalent to the value x.
This overload only participates in overload resolution if the qualified-id Compare::is_transparent is valid and denotes a type. It allows calling this function without constructing an instance of Key.
[in] | x | a value of any type that can be transparently compared with a key. |
|
inline |
Finds an element with key equivalent to key.
[in] | key | key value of the element to search for. |
|
inline |
Finds an element with key equivalent to key.
[in] | key | key value of the element to search for. |
|
inlineprivate |
The method finds insert position for the given.
[out] | prev_nodes | array of pointers to predecessor nodes on each level. |
[out] | next_nodes | array of pointers to successor nodes on each level. |
[in] | key | inserted key. |
|
inline |
Should be called before concurrent_skip_list destructor is called.
Otherwise, program can terminate if an exception occurs while freeing memory inside dtor.
The skip list map can NOT be used after free_data() was called (unless it was called in a transaction and that transaction aborted).
std::transaction_error | in case of PMDK transaction failure |
pmem::transaction_free_error | when freeing underlying memory failed. |
|
inline |
Returns a reference to the allocator associated with the container.
|
inline |
Returns a const reference to the allocator associated with the container.
|
inlineprivate |
Get the persistent memory pool where hashmap resides.
|
inline |
Inserts value in a thread-safe way.
No iterators or references are invalidated.
[in] | value | element value to insert. |
pmem::transaction_error | when snapshotting failed. |
pmem::transaction_alloc_error | when allocating new memory failed. |
pmem::transaction_scope_error | if called inside transaction. |
rethrows | constructor exception. |
|
inline |
Inserts value in the position as close as possible, just prior to hint.
No iterators or references are invalidated.
[in] | hint | iterator to the position before which the new element will be inserted. |
[in] | value | element value to insert. |
pmem::transaction_error | when snapshotting failed. |
pmem::transaction_alloc_error | when allocating new memory failed. |
pmem::transaction_scope_error | if called inside transaction. |
rethrows | constructor exception. |
|
inline |
Inserts value in the position as close as possible, just prior to hint.
No iterators or references are invalidated. This overload is equivalent to emplace_hint(hint, std::forward<P>(value)) and only participates in overload resolution if std::is_constructible<value_type, P&&>::value == true.
[in] | hint | iterator to the position before which the new element will be inserted. |
[in] | value | element value to insert. |
pmem::transaction_error | when snapshotting failed. |
pmem::transaction_alloc_error | when allocating new memory failed. |
pmem::transaction_scope_error | if called inside transaction. |
rethrows | constructor exception. |
|
inline |
Inserts elements from range [first, last).
If multiple elements in the range have keys that compare equivalent, the first one is inserted.
[in] | first | first iterator of inserted range. |
[in] | last | last iterator of inserted range. |
pmem::transaction_error | when snapshotting failed. |
pmem::transaction_alloc_error | when allocating new memory failed. |
pmem::transaction_scope_error | if called inside transaction. |
rethrows | constructor exception. |
|
inline |
Inserts value.
No iterators or references are invalidated. This overload is equivalent to emplace(std::forward<P>(value)) and only participates in overload resolution if std::is_constructible<value_type, P&&>::value == true.
[in] | value | element value to insert. |
pmem::transaction_error | when snapshotting failed. |
pmem::transaction_alloc_error | when allocating new memory failed. |
pmem::transaction_scope_error | if called inside transaction. |
rethrows | constructor exception. |
|
inline |
Inserts elements from initializer list ilist.
If multiple elements in the range have keys that compare equivalent, the first one is inserted.
[in] | ilist | first initializer list to insert the values from. |
pmem::transaction_error | when snapshotting failed. |
pmem::transaction_alloc_error | when allocating new memory failed. |
pmem::transaction_scope_error | if called inside transaction. |
rethrows | constructor exception. |
|
inline |
Inserts value using move semantic.
No iterators or references are invalidated.
[in] | value | element value to insert. |
pmem::transaction_error | when snapshotting failed. |
pmem::transaction_alloc_error | when allocating new memory failed. |
pmem::transaction_scope_error | if called inside transaction. |
rethrows | constructor exception. |
|
inlineprivate |
|
inlineprivate |
Finds position on the.
level | using |
cmp | |
level | - on which level search prev node |
prev | - pointer to the start node to search |
key | - key to search |
cmp | - callable object to compare two objects (_compare member is default comparator) |
key |
|
inlineprivate |
Returns an iterator pointing to the first element from the list for which cmp(element, key) is false.
[in] | key | key value to compare the elements to. |
[in] | cmp | comparator functor used for the search. |
|
inlineprivate |
Returns an iterator pointing to the first element from the list for which cmp(element, key) is false.
[in] | key | key value to compare the elements to. |
[in] | cmp | comparator functor used for the search. |
|
inlineprivate |
Not thread-safe but can be called within a transaction.
XXX: Need to optimize for single-threaded case.
|
inline |
Returns a reference to the object that compares the keys.
|
inline |
Returns a const reference to the object that compares the keys.
|
inline |
Returns an iterator pointing to the first element that compares not less (i.e.
greater or equal) to the value x. This overload only participates in overload resolution if the qualified-id Compare::is_transparent is valid and denotes a type. They allow calling this function without constructing an instance of Key.
[in] | x | alternative value that can be compared to Key. |
|
inline |
Returns an iterator pointing to the first element that compares not less (i.e.
greater or equal) to the value x. This overload only participates in overload resolution if the qualified-id Compare::is_transparent is valid and denotes a type. They allow calling this function without constructing an instance of Key.
[in] | x | alternative value that can be compared to Key. |
|
inline |
Returns an iterator pointing to the first element that is not less than (i.e.
greater or equal to) key.
[in] | key | key value to compare the elements to. |
|
inline |
Returns an iterator pointing to the first element that is not less than (i.e.
greater or equal to) key.
[in] | key | key value to compare the elements to. |
|
inline |
|
inline |
Move assignment operator.
Replaces the contents with those of other using move semantics (i.e. the data in other is moved from other into this container). other is in a valid but unspecified state afterwards. If std::allocator_traits<allocator_type>::propagate_on_container_move_assignment::value is true, the target allocator is replaced by a copy of the source allocator. If it is false and the source and the target allocators do not compare equal, the target cannot take ownership of the source memory and must move-assign each element individually, allocating additional memory using its own allocator as needed. In any case, all elements originally present in *this are either destroyed or replaced by elementwise move-assignment.
pmem::transaction_alloc_error | when allocating new memory failed. |
pmem::transaction_free_error | when freeing old existing elements failed. |
rethrows | constructor exception. |
|
inline |
Copy assignment operator.
Replaces the contents with a copy of the contents of other transactionally. If std::allocator_traits<allocator_type>::propagate_on_container_copy_assignment::value is true, the target allocator is replaced by a copy of the source allocator.
pmem::transaction_alloc_error | when allocating new memory failed. |
pmem::transaction_free_error | when freeing old existing elements failed. |
rethrows | constructor exception. |
|
inline |
Replaces the contents with those identified by initializer list il.
[in] | il | initializer list to use as data source |
pmem::transaction_alloc_error | when allocating new memory failed. |
pmem::transaction_free_error | when freeing old existing elements failed. |
rethrows | constructor exception. |
|
inline |
Intialize concurrent_skip_list after process restart.
MUST be called everytime after process restart. Not thread safe.
|
inline |
|
inline |
Exchanges the contents of the container with those of other transactionally.
Does not invoke any move, copy, or swap operations on individual elements.
pmem::transaction_error | when snapshotting failed. |
|
inline |
If a key equivalent to k already exists in the container, does nothing.
Otherwise, behaves like emplace except that the element is constructed as value_type(std::piecewise_construct, std::forward_as_tuple(k), std::forward_as_tuple(std::forward<Args>(args)...))
No iterators or references are invalidated.
[in] | k | the key used both to look up and to insert if not found. |
[in] | args | arguments to forward to the constructor of the element. |
pmem::transaction_error | when snapshotting failed. |
pmem::transaction_alloc_error | when allocating new memory failed. |
pmem::transaction_scope_error | if called inside transaction. |
rethrows | constructor exception. |
|
inline |
If a key equivalent to k already exists in the container, does nothing.
Otherwise, behaves like emplace except that the element is constructed as value_type(std::piecewise_construct, std::forward_as_tuple(std::move(k)), std::forward_as_tuple(std::forward<Args>(args)...)). This overload only participates in overload resolution if the qualified-id Compare::is_transparent is valid and denotes a type and std::is_constructible<Key, K &&>::value == true . It allows calling this function without constructing an instance of Key.
No iterators or references are invalidated.
[in] | k | the key used both to look up and to insert if not found. |
[in] | args | arguments to forward to the constructor of the element. |
pmem::transaction_error | when snapshotting failed. |
pmem::transaction_alloc_error | when allocating new memory failed. |
rethrows | constructor exception. |
|
inline |
If a key equivalent to k already exists in the container, does nothing.
Otherwise, behaves like emplace except that the element is constructed as value_type(std::piecewise_construct, std::forward_as_tuple(std::move(k)), std::forward_as_tuple(std::forward<Args>(args)...)).
No iterators or references are invalidated.
[in] | k | the key used both to look up and to insert if not found. |
[in] | args | arguments to forward to the constructor of the element. |
pmem::transaction_error | when snapshotting failed. |
pmem::transaction_alloc_error | when allocating new memory failed. |
pmem::transaction_scope_error | if called inside transaction. |
rethrows | constructor exception. |
|
inlineprivate |
Try to insert new node to the skip list.
|
inline |
Removes the element (if one exists) with the key equivalent to key.
References and iterators to the erased elements are invalidated. Other references and iterators are not affected. This overload only participates in overload resolution if the qualified-id Compare::is_transparent is valid and denotes a type and std::is_convertible<K, iterator>::value != true && std::is_convertible<K, const_iterator>::value != true. It allows calling this function without constructing an instance of Key.
[in] | key | key value of the elements to remove. |
pmem::transaction_error | when snapshotting failed. |
rethrows | destructor exception. |
|
inline |
Removes the element (if one exists) with the key equivalent to key.
References and iterators to the erased elements are invalidated. Other references and iterators are not affected.
[in] | key | key value of the elements to remove. |
pmem::transaction_error | when snapshotting failed. |
rethrows | destructor exception. |
|
inline |
Removes the elements in the range [first; last), which must be a valid range in *this.
References and iterators to the erased elements are invalidated. Other references and iterators are not affected.
[in] | first | first iterator in the range of elements to remove. |
[in] | last | last iterator in the range of elements to remove. |
pmem::transaction_error | when snapshotting failed. |
rethrows | destructor exception. |
|
inline |
Removes the element at pos from the container.
References and iterators to the erased elements are invalidated. Other references and iterators are not affected.
[in] | pos | iterator to the element to remove. |
pmem::transaction_error | when snapshotting failed. |
rethrows | destructor exception. |
|
inline |
Removes the element at pos from the container.
References and iterators to the erased elements are invalidated. Other references and iterators are not affected.
[in] | pos | iterator to the element to remove. |
pmem::transaction_error | when snapshotting failed. |
rethrows | destructor exception. |
|
inline |
Returns an iterator pointing to the first element that compares greater to the value x.
This overload only participates in overload resolution if the qualified-id Compare::is_transparent is valid and denotes a type. They allow calling this function without constructing an instance of Key.
[in] | x | alternative value that can be compared to Key. |
|
inline |
Returns an iterator pointing to the first element that compares greater to the value x.
This overload only participates in overload resolution if the qualified-id Compare::is_transparent is valid and denotes a type. They allow calling this function without constructing an instance of Key.
[in] | x | alternative value that can be compared to Key. |
|
inline |
Returns an iterator pointing to the first element that is greater than key.
[in] | key | key value to compare the elements to. |
|
inline |
Returns an iterator pointing to the first element that is greater than key.
[in] | key | key value to compare the elements to. |
|
private |
This variable holds real size after the skip list is initialized.
It holds real value of size only after initialization (before any insert/remove).