|
pstore2
|
A linear node. More...
#include <hamt_map_types.hpp>
Public Types | |
| using | iterator = address * |
| using | const_iterator = address const * |
Public Member Functions | |
| void * | operator new (std::size_t)=delete |
| void | operator delete (void *p) |
| linear_node (linear_node &&rhs) noexcept=delete | |
| linear_node & | operator= (linear_node const &rhs)=delete |
| linear_node & | operator= (linear_node &&rhs) noexcept=delete |
| address | flush (transaction_base &transaction) const |
| Write this linear node to the store. More... | |
| template<typename KeyType , typename OtherKeyType , typename KeyEqual , typename = typename std::enable_if< serialize::is_compatible<KeyType, OtherKeyType>::value>::type> | |
| auto | lookup (database const &db, OtherKeyType const &key, KeyEqual equal) const -> std::pair< index_pointer const, std::size_t > |
| Search the linear node and return the child slot if the key exists. More... | |
Element access | |
| address | operator[] (std::size_t const i) const noexcept |
| address & | operator[] (std::size_t const i) noexcept |
Iterators | |
| iterator | begin () |
| const_iterator | begin () const |
| const_iterator | cbegin () const |
| iterator | end () |
| const_iterator | end () const |
| const_iterator | cend () const |
Capacity | |
| bool | empty () const |
| Checks whether the container is empty. | |
| std::size_t | size () const |
| Returns the number of elements. | |
Static Public Member Functions | |
Construction | |
| static std::unique_ptr< linear_node > | allocate_from (linear_node const &orig_node, std::size_t extra_children) |
| Allocates a new linear node in memory and copy the contents of an existing node into it. More... | |
| static std::unique_ptr< linear_node > | allocate_from (database const &db, index_pointer const node, std::size_t extra_children) |
| Allocates a new in-memory linear node based on the contents of an existing store node. More... | |
| static std::unique_ptr< linear_node > | allocate (address a, address b) |
| Allocates a new linear node in memory with sufficient space for two leaf addresses. More... | |
| static auto | get_node (database const &db, index_pointer const node) -> std::pair< std::shared_ptr< linear_node const >, linear_node const *> |
| Returns a pointer to a linear node which may be in-heap or in-store. More... | |
Storage | |
| std::size_t | size_bytes () const |
| Returns the number of bytes of storage required for the node. | |
| static constexpr std::size_t | size_bytes (std::uint64_t const size) |
| Returns the number of bytes of storage required for a linear node with 'size' children. More... | |
A linear node.
Linear nodes as used as the place of last resort for entries which cannot be distinguished by their hash value.
|
static |
Allocates a new linear node in memory with sufficient space for two leaf addresses.
| a | The first leaf address for the new linear node. |
| b | The second leaf address for the new linear node. |
|
static |
Allocates a new linear node in memory and copy the contents of an existing node into it.
The new node is allocated with sufficient storage for the child of the supplied node plus the number passed in the 'extra_children' parameter.
| orig_node | A node whose contents will be copied into the newly allocated linear node. |
| extra_children | The number of extra child for which space will be allocated. This number is added to the number of children in 'orig_node' in calculating the amount of storage to be allocated. |
|
static |
Allocates a new in-memory linear node based on the contents of an existing store node.
| db | The database from which the source node should be loaded. |
| node | A reference to the source node which may be either in-heap or in-store. |
| extra_children | The number of additional child nodes for which storage should be allocated. |
| address pstore::index::details::linear_node::flush | ( | transaction_base & | transaction | ) | const |
Write this linear node to the store.
| transaction | The transaction to which the linear node will be appended. |
|
static |
Returns a pointer to a linear node which may be in-heap or in-store.
If the supplied index_pointer points to a heap-resident linear node then returns a pair whose first member is nullptr and whose second member contains the node pointer. If the index_pointer references an in-store linear node then the node is fetched and the function returns a pair whose first member is the store's shared_ptr and whose second member is the equivalent raw pointer (i.e. result.first.get () == result.second). In this case, the second pointer is only valid as long as the first pointer is "live".
| db | The database from which the node should be loaded. |
| node | A pointer to the node location: either in the heap or in the store. |
| auto pstore::index::details::linear_node::lookup | ( | database const & | db, |
| OtherKeyType const & | key, | ||
| KeyEqual | equal | ||
| ) | const -> std::pair<index_pointer const, std::size_t> |
Search the linear node and return the child slot if the key exists.
Otherwise, return the {nullptr, not_found} pair.
| KeyType | The type of the keys stored in the linear node. |
| OtherKeyType | A type whose serialized value is compatible with KeyType |
| KeyEqual | The type of the key-comparison function. |
| db | The dataase instance from which child nodes should be loaded. |
| key | The key to be located. |
| equal | A comparison function which will be called to compare child nodes to the supplied key value. It should return true if the keys match and false otherwise. |
index_pointer reference to the child node and the position within the linear node instance of the child record. If not found, returns the pair index_pointer (), details::not_found.
|
inlinestatic |
Returns the number of bytes of storage required for a linear node with 'size' children.
1.8.13