|
Aleph-w 3.0
A C++ Library for Data Structures and Algorithms
|
Persistent ordered map backed by a paged File_BPlus_Tree. More...
#include <tpl_file_bplus_map.H>
Classes | |
| class | Iterator |
| Lazy iterator over ordered key/value pairs. More... | |
| struct | Record |
| struct | Record_Codec |
| struct | Record_Compare |
Public Types | |
| using | key_type = Key |
| using | mapped_type = Value |
| using | value_type = std::pair< Key, Value > |
| using | tree_type = tree_impl_type |
| using | open_mode_type = typename tree_type::open_mode_type |
Public Member Functions | |
| Gen_File_BPlus_Map (std::string file_path, const bool auto_sync=true, const Compare &cmp=Compare()) | |
| Open or create a persistent B+ Tree map for read-write access. | |
| Gen_File_BPlus_Map (std::string file_path, const open_mode_type open_mode, const bool auto_sync=true, const Compare &cmp=Compare()) | |
| Open or create a persistent B+ Tree map with an explicit mode. | |
| Gen_File_BPlus_Map (const char *file_path, const bool auto_sync=true, const Compare &cmp=Compare()) | |
| Open or create a persistent B+ Tree map for read-write access. | |
| Gen_File_BPlus_Map (const char *file_path, const open_mode_type open_mode, const bool auto_sync=true, const Compare &cmp=Compare()) | |
| Open or create a persistent B+ Tree map with an explicit mode. | |
| Gen_File_BPlus_Map (const Gen_File_BPlus_Map &)=delete | |
| Copying is disabled. | |
| Gen_File_BPlus_Map & | operator= (const Gen_File_BPlus_Map &)=delete |
| Assignment is disabled. | |
| Gen_File_BPlus_Map (Gen_File_BPlus_Map &&)=delete | |
| Moving is disabled. | |
| Gen_File_BPlus_Map & | operator= (Gen_File_BPlus_Map &&)=delete |
| Move assignment is disabled. | |
| const std::string & | file_path () const noexcept |
| Return the file path. | |
| open_mode_type | open_mode () const noexcept |
| Return the open mode. | |
| bool | is_read_only () const noexcept |
| Return whether the map handle is read-only. | |
| bool | auto_sync_enabled () const noexcept |
| Return whether automatic synchronization is enabled. | |
| void | set_auto_sync (const bool enabled) noexcept |
| Enable or disable automatic synchronization. | |
| const Compare & | key_comp () const noexcept |
| Return the key comparator. | |
| bool | empty () const noexcept |
| Return whether the map is empty. | |
| size_t | size () const noexcept |
| Return the number of stored key/value pairs. | |
| size_t | height () const noexcept |
| Return the current tree height. | |
| size_t | page_size_bytes () const noexcept |
| Return the serialized page size of the backing tree. | |
| size_t | page_count () const noexcept |
| Return the number of allocated pages. | |
| std::uint64_t | checkpoint_sequence () const noexcept |
| Return the latest durable checkpoint sequence. | |
| void | sync () const |
| Flush pending changes to the backing file. | |
| void | checkpoint () const |
| Synonym for sync(). | |
| void | reload () |
| Discard unsynchronized changes and reload the file. | |
| void | clear () |
| Remove every key/value pair from the map. | |
| bool | contains (const Key &key) const |
| Return whether a key exists. | |
| bool | search (const Key &key) const |
| Synonym for contains(). | |
| std::optional< Value > | find (const Key &key) const |
| Return the mapped value associated with a key, if any. | |
| Value | at (const Key &key) const |
| Return the mapped value associated with a key. | |
| bool | insert (const Key &key, const Value &value) |
| Insert a new key/value pair if the key is not present. | |
| bool | insert_or_assign (const Key &key, const Value &value) |
| Insert or overwrite a key/value pair. | |
| bool | remove (const Key &key) |
| Remove a key and its mapped value, if present. | |
| std::optional< value_type > | min_item () const |
| Return the smallest stored key/value pair. | |
| std::optional< value_type > | max_item () const |
| Return the largest stored key/value pair. | |
| std::optional< value_type > | lower_bound (const Key &key) const |
Return the first key/value pair whose key is not less than key. | |
| std::optional< value_type > | upper_bound (const Key &key) const |
Return the first key/value pair whose key is greater than key. | |
| Array< value_type > | range (const Key &first, const Key &last) const |
| Collect all key/value pairs in the inclusive key range. | |
| Array< Key > | keys () const |
| Materialize all keys in sorted order. | |
| Array< Value > | values () const |
| Materialize all mapped values in key order. | |
| Array< value_type > | items () const |
| Materialize all key/value pairs in sorted order. | |
| Iterator | get_it () const noexcept |
| Return a lazy iterator over all items in key order. | |
| Iterator | get_range_it (const Key &first, const Key &last) const |
| Return a lazy iterator over an inclusive key range. | |
| bool | verify () const |
| Verify the structural invariants of the backing tree. | |
Static Public Attributes | |
| static constexpr auto | Read_Write = tree_type::Read_Write |
| static constexpr auto | Read_Only = tree_type::Read_Only |
Private Types | |
| using | key_codec = KeyCodec |
| using | value_codec = ValueCodec |
| using | tree_impl_type = Gen_File_BPlus_Tree< Record, Record_Compare, MinDegree, Record_Codec > |
Private Member Functions | |
| bool | equals_key (const Key &lhs, const Key &rhs) const |
| std::optional< Record > | find_record (const Key &key) const |
Static Private Member Functions | |
| static Record | make_probe (const Key &key) |
| static Record | make_record (const Key &key, const Value &value) |
| static std::pair< Key, Value > | to_pair (const Record &record) |
| static Array< std::pair< Key, Value > > | to_pairs (const Array< Record > &records) |
Private Attributes | |
| tree_impl_type | tree_ |
Persistent ordered map backed by a paged File_BPlus_Tree.
Gen_File_BPlus_Map stores unique keys together with mapped values in a persistent B+ Tree file. It reuses the same format, locking, WAL, recovery, and read-only semantics as Aleph::File_BPlus_Tree, while exposing range scans over key/value pairs.
| Key | Stored key type. |
| Value | Stored mapped-value type. |
| Compare | Strict weak ordering used to sort keys. |
| MinDegree | Minimum degree t of the underlying persistent B+ Tree. |
| KeyCodec | Fixed-size codec used to persist keys. |
| ValueCodec | Fixed-size codec used to persist mapped values. |
Key and Value must admit fixed-size portable codecs because map entries are serialized through the paged storage engine of Aleph::File_BPlus_Tree. The default codecs cover fixed-size arithmetic types and std::array; bounded strings can be supported with Aleph::detail::Paged_Bounded_String_Codec.Generic paged persistent B+ Tree map with fixed-size records.
This class provides a map-like interface (associative keys to values) backed by a persistent Aleph::File_BPlus_Tree. It supports O(log n) access with on-disk persistence and efficient page caching.
| Key | Type of unique keys. |
| Value | Type of mapped values. |
| Compare | Strict weak ordering used to sort keys. |
| MinDegree | Minimum degree t of the underlying persistent B+ Tree. |
| KeyCodec | Fixed-size codec used to persist keys. |
| ValueCodec | Fixed-size codec used to persist mapped values. |
Definition at line 101 of file tpl_file_bplus_map.H.
|
private |
Definition at line 103 of file tpl_file_bplus_map.H.
| using Aleph::Gen_File_BPlus_Map< Key, Value, Compare, MinDegree, KeyCodec, ValueCodec >::key_type = Key |
Definition at line 227 of file tpl_file_bplus_map.H.
| using Aleph::Gen_File_BPlus_Map< Key, Value, Compare, MinDegree, KeyCodec, ValueCodec >::mapped_type = Value |
Definition at line 228 of file tpl_file_bplus_map.H.
| using Aleph::Gen_File_BPlus_Map< Key, Value, Compare, MinDegree, KeyCodec, ValueCodec >::open_mode_type = typename tree_type::open_mode_type |
Definition at line 231 of file tpl_file_bplus_map.H.
|
private |
Definition at line 167 of file tpl_file_bplus_map.H.
| using Aleph::Gen_File_BPlus_Map< Key, Value, Compare, MinDegree, KeyCodec, ValueCodec >::tree_type = tree_impl_type |
Definition at line 230 of file tpl_file_bplus_map.H.
|
private |
Definition at line 104 of file tpl_file_bplus_map.H.
| using Aleph::Gen_File_BPlus_Map< Key, Value, Compare, MinDegree, KeyCodec, ValueCodec >::value_type = std::pair<Key, Value> |
Definition at line 229 of file tpl_file_bplus_map.H.
|
inlineexplicit |
Open or create a persistent B+ Tree map for read-write access.
| file_path | Path to the backing file. |
| auto_sync | If true, successful mutations synchronize the file. |
| cmp | Comparison functor used to order keys. |
| std::runtime_error | If the backing file cannot be used. |
| std::bad_alloc | If the page cache cannot be allocated. |
Definition at line 319 of file tpl_file_bplus_map.H.
|
inlineexplicit |
Open or create a persistent B+ Tree map with an explicit mode.
| file_path | Path to the backing file. |
| open_mode | Read_Write or Read_Only. |
| auto_sync | If true, successful mutations synchronize the file. |
| cmp | Comparison functor used to order keys. |
| std::runtime_error | If the backing file cannot be used. |
| std::bad_alloc | If the page cache cannot be allocated. |
Definition at line 332 of file tpl_file_bplus_map.H.
|
inlineexplicit |
Open or create a persistent B+ Tree map for read-write access.
| file_path | Path to the backing file. |
| auto_sync | If true, successful mutations synchronize the file. |
| cmp | Comparison functor used to order keys. |
| std::runtime_error | If the backing file cannot be used. |
| std::bad_alloc | If the page cache cannot be allocated. |
Definition at line 345 of file tpl_file_bplus_map.H.
|
inlineexplicit |
Open or create a persistent B+ Tree map with an explicit mode.
| file_path | Path to the backing file. |
| open_mode | Read_Write or Read_Only. |
| auto_sync | If true, successful mutations synchronize the file. |
| cmp | Comparison functor used to order keys. |
| std::runtime_error | If the backing file cannot be used. |
| std::bad_alloc | If the page cache cannot be allocated. |
Definition at line 358 of file tpl_file_bplus_map.H.
|
delete |
Copying is disabled.
|
delete |
Moving is disabled.
|
inline |
Return the mapped value associated with a key.
| key | Key to search. |
| std::domain_error | If the key is absent. |
| Any | exception propagated by Compare, Key, or Value. |
Definition at line 546 of file tpl_file_bplus_map.H.
References ah_domain_error_if, Aleph::divide_and_conquer_partition_dp(), and Aleph::Gen_File_BPlus_Map< Key, Value, Compare, MinDegree, KeyCodec, ValueCodec >::find().
|
inlinenoexcept |
Return whether automatic synchronization is enabled.
true if successful mutations call sync(). | Nothing. |
Definition at line 407 of file tpl_file_bplus_map.H.
References Aleph::Gen_File_BPlus_Tree< Key, Compare, MinDegree, Codec >::auto_sync_enabled(), and Aleph::Gen_File_BPlus_Map< Key, Value, Compare, MinDegree, KeyCodec, ValueCodec >::tree_.
|
inline |
Synonym for sync().
| std::runtime_error | If the file cannot be synchronized. |
Definition at line 486 of file tpl_file_bplus_map.H.
References Aleph::Gen_File_BPlus_Tree< Key, Compare, MinDegree, Codec >::checkpoint(), and Aleph::Gen_File_BPlus_Map< Key, Value, Compare, MinDegree, KeyCodec, ValueCodec >::tree_.
|
inlinenoexcept |
Return the latest durable checkpoint sequence.
| Nothing. |
Definition at line 470 of file tpl_file_bplus_map.H.
References Aleph::Gen_File_BPlus_Tree< Key, Compare, MinDegree, Codec >::checkpoint_sequence(), and Aleph::Gen_File_BPlus_Map< Key, Value, Compare, MinDegree, KeyCodec, ValueCodec >::tree_.
|
inline |
Remove every key/value pair from the map.
| std::runtime_error | If the backing tree rejects the mutation. |
Definition at line 502 of file tpl_file_bplus_map.H.
References Aleph::Gen_File_BPlus_Tree< Key, Compare, MinDegree, Codec >::clear(), and Aleph::Gen_File_BPlus_Map< Key, Value, Compare, MinDegree, KeyCodec, ValueCodec >::tree_.
|
inline |
Return whether a key exists.
| key | Key to search. |
true if the key is present. | Any | exception propagated by Compare or Key. |
Definition at line 512 of file tpl_file_bplus_map.H.
References Aleph::Gen_File_BPlus_Map< Key, Value, Compare, MinDegree, KeyCodec, ValueCodec >::find_record().
Referenced by Aleph::Gen_File_BPlus_Map< Key, Value, Compare, MinDegree, KeyCodec, ValueCodec >::search().
|
inlinenoexcept |
Return whether the map is empty.
true if empty, otherwise false. | Nothing. |
Definition at line 434 of file tpl_file_bplus_map.H.
References Aleph::Gen_File_BPlus_Tree< Key, Compare, MinDegree, Codec >::empty(), and Aleph::Gen_File_BPlus_Map< Key, Value, Compare, MinDegree, KeyCodec, ValueCodec >::tree_.
|
inlineprivate |
Definition at line 211 of file tpl_file_bplus_map.H.
References Aleph::and, cmp(), Aleph::divide_and_conquer_partition_dp(), Aleph::Gen_File_BPlus_Tree< Key, Compare, MinDegree, Codec >::key_comp(), and Aleph::Gen_File_BPlus_Map< Key, Value, Compare, MinDegree, KeyCodec, ValueCodec >::tree_.
Referenced by Aleph::Gen_File_BPlus_Map< Key, Value, Compare, MinDegree, KeyCodec, ValueCodec >::find_record().
|
inlinenoexcept |
Return the file path.
| Nothing. |
Definition at line 380 of file tpl_file_bplus_map.H.
References Aleph::Gen_File_BPlus_Tree< Key, Compare, MinDegree, Codec >::file_path(), and Aleph::Gen_File_BPlus_Map< Key, Value, Compare, MinDegree, KeyCodec, ValueCodec >::tree_.
|
inline |
Return the mapped value associated with a key, if any.
| key | Key to search. |
std::nullopt if missing. | Any | exception propagated by Compare, Key, or Value. |
Definition at line 532 of file tpl_file_bplus_map.H.
References Aleph::divide_and_conquer_partition_dp(), and Aleph::Gen_File_BPlus_Map< Key, Value, Compare, MinDegree, KeyCodec, ValueCodec >::find_record().
Referenced by Aleph::Gen_File_BPlus_Map< Key, Value, Compare, MinDegree, KeyCodec, ValueCodec >::at().
|
inlineprivate |
Definition at line 217 of file tpl_file_bplus_map.H.
References Aleph::and, Aleph::divide_and_conquer_partition_dp(), Aleph::Gen_File_BPlus_Map< Key, Value, Compare, MinDegree, KeyCodec, ValueCodec >::equals_key(), Aleph::Gen_File_BPlus_Tree< Key, Compare, MinDegree, Codec >::lower_bound(), Aleph::Gen_File_BPlus_Map< Key, Value, Compare, MinDegree, KeyCodec, ValueCodec >::make_probe(), and Aleph::Gen_File_BPlus_Map< Key, Value, Compare, MinDegree, KeyCodec, ValueCodec >::tree_.
Referenced by Aleph::Gen_File_BPlus_Map< Key, Value, Compare, MinDegree, KeyCodec, ValueCodec >::contains(), and Aleph::Gen_File_BPlus_Map< Key, Value, Compare, MinDegree, KeyCodec, ValueCodec >::find().
|
inlinenoexcept |
Return a lazy iterator over all items in key order.
| Nothing. |
Definition at line 711 of file tpl_file_bplus_map.H.
References Aleph::Gen_File_BPlus_Tree< Key, Compare, MinDegree, Codec >::get_it(), and Aleph::Gen_File_BPlus_Map< Key, Value, Compare, MinDegree, KeyCodec, ValueCodec >::tree_.
Referenced by TEST().
|
inline |
Return a lazy iterator over an inclusive key range.
| first | Lower key endpoint, inclusive. |
| last | Upper key endpoint, inclusive. |
| std::invalid_argument | If the range is invalid. |
Definition at line 722 of file tpl_file_bplus_map.H.
References Aleph::Gen_File_BPlus_Tree< Key, Compare, MinDegree, Codec >::get_range_it(), Aleph::Gen_File_BPlus_Map< Key, Value, Compare, MinDegree, KeyCodec, ValueCodec >::make_probe(), and Aleph::Gen_File_BPlus_Map< Key, Value, Compare, MinDegree, KeyCodec, ValueCodec >::tree_.
Referenced by TEST().
|
inlinenoexcept |
Return the current tree height.
0 for an empty file, otherwise the number of page levels. | Nothing. |
Definition at line 446 of file tpl_file_bplus_map.H.
References Aleph::Gen_File_BPlus_Tree< Key, Compare, MinDegree, Codec >::height(), and Aleph::Gen_File_BPlus_Map< Key, Value, Compare, MinDegree, KeyCodec, ValueCodec >::tree_.
|
inline |
Insert a new key/value pair if the key is not present.
| key | Key to insert. |
| value | Mapped value to associate with the key. |
true if insertion happened, otherwise false. | std::runtime_error | If the backing tree rejects the mutation. |
| std::bad_alloc | If the page cache cannot grow. |
Definition at line 561 of file tpl_file_bplus_map.H.
References Aleph::Gen_File_BPlus_Tree< Key, Compare, MinDegree, Codec >::insert(), Aleph::Gen_File_BPlus_Map< Key, Value, Compare, MinDegree, KeyCodec, ValueCodec >::make_record(), and Aleph::Gen_File_BPlus_Map< Key, Value, Compare, MinDegree, KeyCodec, ValueCodec >::tree_.
|
inline |
Insert or overwrite a key/value pair.
| key | Key to insert or overwrite. |
| value | Mapped value to store. |
true if the key was newly inserted, false if it replaced an existing value. | std::runtime_error | If the backing tree rejects the mutation. |
| std::bad_alloc | If the page cache cannot grow. |
tree_.remove(probe) followed by tree_.insert(record). Each individual operation is crash-safe (the WAL guarantees redo on the next open), but a process crash between the two leaves the key permanently deleted. File_BPlus_Tree does not currently expose a single-WAL- transaction replace primitive, so full atomicity of the pair cannot be guaranteed without adding such a primitive. Callers that require all-or-nothing replace semantics should wrap the two operations in their own application-level recovery logic. Definition at line 585 of file tpl_file_bplus_map.H.
References ah_runtime_error_unless, Aleph::Gen_File_BPlus_Tree< Key, Compare, MinDegree, Codec >::insert(), Aleph::Gen_File_BPlus_Map< Key, Value, Compare, MinDegree, KeyCodec, ValueCodec >::make_probe(), Aleph::Gen_File_BPlus_Map< Key, Value, Compare, MinDegree, KeyCodec, ValueCodec >::make_record(), Aleph::Gen_File_BPlus_Tree< Key, Compare, MinDegree, Codec >::remove(), and Aleph::Gen_File_BPlus_Map< Key, Value, Compare, MinDegree, KeyCodec, ValueCodec >::tree_.
|
inlinenoexcept |
Return whether the map handle is read-only.
true if opened in Read_Only mode. | Nothing. |
Definition at line 398 of file tpl_file_bplus_map.H.
References Aleph::Gen_File_BPlus_Tree< Key, Compare, MinDegree, Codec >::is_read_only(), and Aleph::Gen_File_BPlus_Map< Key, Value, Compare, MinDegree, KeyCodec, ValueCodec >::tree_.
|
inline |
Materialize all key/value pairs in sorted order.
| std::bad_alloc | If the result array cannot grow. |
Definition at line 702 of file tpl_file_bplus_map.H.
References Aleph::Gen_File_BPlus_Tree< Key, Compare, MinDegree, Codec >::keys(), Aleph::Gen_File_BPlus_Map< Key, Value, Compare, MinDegree, KeyCodec, ValueCodec >::to_pairs(), and Aleph::Gen_File_BPlus_Map< Key, Value, Compare, MinDegree, KeyCodec, ValueCodec >::tree_.
|
inlinenoexcept |
Return the key comparator.
| Nothing. |
Definition at line 425 of file tpl_file_bplus_map.H.
References Aleph::Gen_File_BPlus_Tree< Key, Compare, MinDegree, Codec >::key_comp(), and Aleph::Gen_File_BPlus_Map< Key, Value, Compare, MinDegree, KeyCodec, ValueCodec >::tree_.
|
inline |
Materialize all keys in sorted order.
| std::bad_alloc | If the result array cannot grow. |
Definition at line 674 of file tpl_file_bplus_map.H.
References Aleph::divide_and_conquer_partition_dp(), Aleph::Gen_File_BPlus_Tree< Key, Compare, MinDegree, Codec >::keys(), Aleph::Array< T >::reserve(), and Aleph::Gen_File_BPlus_Map< Key, Value, Compare, MinDegree, KeyCodec, ValueCodec >::tree_.
|
inline |
Return the first key/value pair whose key is not less than key.
| key | Probe key. |
std::nullopt if none exists. | Any | exception propagated by Compare, Key, or Value. |
Definition at line 637 of file tpl_file_bplus_map.H.
References Aleph::divide_and_conquer_partition_dp(), Aleph::Gen_File_BPlus_Tree< Key, Compare, MinDegree, Codec >::lower_bound(), Aleph::Gen_File_BPlus_Map< Key, Value, Compare, MinDegree, KeyCodec, ValueCodec >::make_probe(), Aleph::Gen_File_BPlus_Map< Key, Value, Compare, MinDegree, KeyCodec, ValueCodec >::to_pair(), and Aleph::Gen_File_BPlus_Map< Key, Value, Compare, MinDegree, KeyCodec, ValueCodec >::tree_.
Referenced by TEST().
|
inlinestaticprivate |
Definition at line 179 of file tpl_file_bplus_map.H.
References Aleph::Gen_File_BPlus_Map< Key, Value, Compare, MinDegree, KeyCodec, ValueCodec >::Record::bytes.
Referenced by Aleph::Gen_File_BPlus_Map< Key, Value, Compare, MinDegree, KeyCodec, ValueCodec >::find_record(), Aleph::Gen_File_BPlus_Map< Key, Value, Compare, MinDegree, KeyCodec, ValueCodec >::get_range_it(), Aleph::Gen_File_BPlus_Map< Key, Value, Compare, MinDegree, KeyCodec, ValueCodec >::insert_or_assign(), Aleph::Gen_File_BPlus_Map< Key, Value, Compare, MinDegree, KeyCodec, ValueCodec >::lower_bound(), Aleph::Gen_File_BPlus_Map< Key, Value, Compare, MinDegree, KeyCodec, ValueCodec >::range(), Aleph::Gen_File_BPlus_Map< Key, Value, Compare, MinDegree, KeyCodec, ValueCodec >::remove(), and Aleph::Gen_File_BPlus_Map< Key, Value, Compare, MinDegree, KeyCodec, ValueCodec >::upper_bound().
|
inlinestaticprivate |
Definition at line 186 of file tpl_file_bplus_map.H.
References Aleph::Gen_File_BPlus_Map< Key, Value, Compare, MinDegree, KeyCodec, ValueCodec >::Record::bytes.
Referenced by Aleph::Gen_File_BPlus_Map< Key, Value, Compare, MinDegree, KeyCodec, ValueCodec >::insert(), and Aleph::Gen_File_BPlus_Map< Key, Value, Compare, MinDegree, KeyCodec, ValueCodec >::insert_or_assign().
|
inline |
Return the largest stored key/value pair.
std::nullopt if empty. | Any | exception propagated by Key or Value. |
Definition at line 624 of file tpl_file_bplus_map.H.
References Aleph::divide_and_conquer_partition_dp(), Aleph::Gen_File_BPlus_Tree< Key, Compare, MinDegree, Codec >::max_key(), Aleph::Gen_File_BPlus_Map< Key, Value, Compare, MinDegree, KeyCodec, ValueCodec >::to_pair(), and Aleph::Gen_File_BPlus_Map< Key, Value, Compare, MinDegree, KeyCodec, ValueCodec >::tree_.
|
inline |
Return the smallest stored key/value pair.
std::nullopt if empty. | Any | exception propagated by Key or Value. |
Definition at line 612 of file tpl_file_bplus_map.H.
References Aleph::divide_and_conquer_partition_dp(), Aleph::Gen_File_BPlus_Tree< Key, Compare, MinDegree, Codec >::min_key(), Aleph::Gen_File_BPlus_Map< Key, Value, Compare, MinDegree, KeyCodec, ValueCodec >::to_pair(), and Aleph::Gen_File_BPlus_Map< Key, Value, Compare, MinDegree, KeyCodec, ValueCodec >::tree_.
|
inlinenoexcept |
Return the open mode.
Read_Write or Read_Only. | Nothing. |
Definition at line 389 of file tpl_file_bplus_map.H.
References Aleph::Gen_File_BPlus_Tree< Key, Compare, MinDegree, Codec >::open_mode(), and Aleph::Gen_File_BPlus_Map< Key, Value, Compare, MinDegree, KeyCodec, ValueCodec >::tree_.
|
delete |
Assignment is disabled.
|
delete |
Move assignment is disabled.
|
inlinenoexcept |
Return the number of allocated pages.
| Nothing. |
Definition at line 461 of file tpl_file_bplus_map.H.
References Aleph::Gen_File_BPlus_Tree< Key, Compare, MinDegree, Codec >::page_count(), and Aleph::Gen_File_BPlus_Map< Key, Value, Compare, MinDegree, KeyCodec, ValueCodec >::tree_.
|
inlinenoexcept |
Return the serialized page size of the backing tree.
| Nothing. |
Definition at line 452 of file tpl_file_bplus_map.H.
References Aleph::Gen_File_BPlus_Tree< Key, Compare, MinDegree, Codec >::page_size_bytes(), and Aleph::Gen_File_BPlus_Map< Key, Value, Compare, MinDegree, KeyCodec, ValueCodec >::tree_.
|
inline |
Collect all key/value pairs in the inclusive key range.
| first | Lower key endpoint, inclusive. |
| last | Upper key endpoint, inclusive. |
| std::invalid_argument | If the range is invalid. |
| std::bad_alloc | If the result array cannot grow. |
Definition at line 665 of file tpl_file_bplus_map.H.
References Aleph::Gen_File_BPlus_Map< Key, Value, Compare, MinDegree, KeyCodec, ValueCodec >::make_probe(), Aleph::Gen_File_BPlus_Tree< Key, Compare, MinDegree, Codec >::range(), Aleph::Gen_File_BPlus_Map< Key, Value, Compare, MinDegree, KeyCodec, ValueCodec >::to_pairs(), and Aleph::Gen_File_BPlus_Map< Key, Value, Compare, MinDegree, KeyCodec, ValueCodec >::tree_.
|
inline |
Discard unsynchronized changes and reload the file.
| std::runtime_error | If the file cannot be reopened or validated. |
Definition at line 494 of file tpl_file_bplus_map.H.
References Aleph::Gen_File_BPlus_Tree< Key, Compare, MinDegree, Codec >::reload(), and Aleph::Gen_File_BPlus_Map< Key, Value, Compare, MinDegree, KeyCodec, ValueCodec >::tree_.
|
inline |
Remove a key and its mapped value, if present.
| key | Key to erase. |
true if the key existed and was removed. | std::runtime_error | If the backing tree rejects the mutation. |
Definition at line 603 of file tpl_file_bplus_map.H.
References Aleph::Gen_File_BPlus_Map< Key, Value, Compare, MinDegree, KeyCodec, ValueCodec >::make_probe(), Aleph::Gen_File_BPlus_Tree< Key, Compare, MinDegree, Codec >::remove(), and Aleph::Gen_File_BPlus_Map< Key, Value, Compare, MinDegree, KeyCodec, ValueCodec >::tree_.
|
inline |
Synonym for contains().
| key | Key to search. |
true if the key is present. | Any | exception propagated by Compare or Key. |
Definition at line 522 of file tpl_file_bplus_map.H.
References Aleph::Gen_File_BPlus_Map< Key, Value, Compare, MinDegree, KeyCodec, ValueCodec >::contains().
|
inlinenoexcept |
Enable or disable automatic synchronization.
| enabled | New auto-sync mode. |
| Nothing. |
Definition at line 416 of file tpl_file_bplus_map.H.
References Aleph::Gen_File_BPlus_Tree< Key, Compare, MinDegree, Codec >::set_auto_sync(), and Aleph::Gen_File_BPlus_Map< Key, Value, Compare, MinDegree, KeyCodec, ValueCodec >::tree_.
|
inlinenoexcept |
Return the number of stored key/value pairs.
| Nothing. |
Definition at line 440 of file tpl_file_bplus_map.H.
References Aleph::Gen_File_BPlus_Tree< Key, Compare, MinDegree, Codec >::size(), and Aleph::Gen_File_BPlus_Map< Key, Value, Compare, MinDegree, KeyCodec, ValueCodec >::tree_.
|
inline |
Flush pending changes to the backing file.
| std::runtime_error | If the file cannot be synchronized. |
Definition at line 478 of file tpl_file_bplus_map.H.
References Aleph::Gen_File_BPlus_Tree< Key, Compare, MinDegree, Codec >::sync(), and Aleph::Gen_File_BPlus_Map< Key, Value, Compare, MinDegree, KeyCodec, ValueCodec >::tree_.
|
inlinestaticprivate |
Definition at line 196 of file tpl_file_bplus_map.H.
References Aleph::Gen_File_BPlus_Map< Key, Value, Compare, MinDegree, KeyCodec, ValueCodec >::Record::get_key(), and Aleph::Gen_File_BPlus_Map< Key, Value, Compare, MinDegree, KeyCodec, ValueCodec >::Record::get_value().
Referenced by Aleph::Gen_File_BPlus_Map< Key, Value, Compare, MinDegree, KeyCodec, ValueCodec >::Iterator::get_curr(), Aleph::Gen_File_BPlus_Map< Key, Value, Compare, MinDegree, KeyCodec, ValueCodec >::lower_bound(), Aleph::Gen_File_BPlus_Map< Key, Value, Compare, MinDegree, KeyCodec, ValueCodec >::max_item(), Aleph::Gen_File_BPlus_Map< Key, Value, Compare, MinDegree, KeyCodec, ValueCodec >::min_item(), Aleph::Gen_File_BPlus_Map< Key, Value, Compare, MinDegree, KeyCodec, ValueCodec >::to_pairs(), and Aleph::Gen_File_BPlus_Map< Key, Value, Compare, MinDegree, KeyCodec, ValueCodec >::upper_bound().
|
inlinestaticprivate |
Definition at line 202 of file tpl_file_bplus_map.H.
References Aleph::divide_and_conquer_partition_dp(), Aleph::Array< T >::reserve(), and Aleph::Gen_File_BPlus_Map< Key, Value, Compare, MinDegree, KeyCodec, ValueCodec >::to_pair().
Referenced by Aleph::Gen_File_BPlus_Map< Key, Value, Compare, MinDegree, KeyCodec, ValueCodec >::items(), and Aleph::Gen_File_BPlus_Map< Key, Value, Compare, MinDegree, KeyCodec, ValueCodec >::range().
|
inline |
Return the first key/value pair whose key is greater than key.
| key | Probe key. |
std::nullopt if none exists. | Any | exception propagated by Compare, Key, or Value. |
Definition at line 650 of file tpl_file_bplus_map.H.
References Aleph::divide_and_conquer_partition_dp(), Aleph::Gen_File_BPlus_Map< Key, Value, Compare, MinDegree, KeyCodec, ValueCodec >::make_probe(), Aleph::Gen_File_BPlus_Map< Key, Value, Compare, MinDegree, KeyCodec, ValueCodec >::to_pair(), Aleph::Gen_File_BPlus_Map< Key, Value, Compare, MinDegree, KeyCodec, ValueCodec >::tree_, and Aleph::Gen_File_BPlus_Tree< Key, Compare, MinDegree, Codec >::upper_bound().
|
inline |
Materialize all mapped values in key order.
| std::bad_alloc | If the result array cannot grow. |
Definition at line 688 of file tpl_file_bplus_map.H.
References Aleph::divide_and_conquer_partition_dp(), Aleph::Gen_File_BPlus_Tree< Key, Compare, MinDegree, Codec >::keys(), Aleph::Array< T >::reserve(), and Aleph::Gen_File_BPlus_Map< Key, Value, Compare, MinDegree, KeyCodec, ValueCodec >::tree_.
|
inline |
Verify the structural invariants of the backing tree.
true if the underlying persistent tree is valid. | Any | exception propagated by the underlying comparator. |
Definition at line 731 of file tpl_file_bplus_map.H.
References Aleph::Gen_File_BPlus_Map< Key, Value, Compare, MinDegree, KeyCodec, ValueCodec >::tree_, and Aleph::Gen_File_BPlus_Tree< Key, Compare, MinDegree, Codec >::verify().
|
staticconstexpr |
Definition at line 234 of file tpl_file_bplus_map.H.
|
staticconstexpr |
Definition at line 233 of file tpl_file_bplus_map.H.
|
private |
Definition at line 177 of file tpl_file_bplus_map.H.
Referenced by Aleph::Gen_File_BPlus_Map< Key, Value, Compare, MinDegree, KeyCodec, ValueCodec >::auto_sync_enabled(), Aleph::Gen_File_BPlus_Map< Key, Value, Compare, MinDegree, KeyCodec, ValueCodec >::checkpoint(), Aleph::Gen_File_BPlus_Map< Key, Value, Compare, MinDegree, KeyCodec, ValueCodec >::checkpoint_sequence(), Aleph::Gen_File_BPlus_Map< Key, Value, Compare, MinDegree, KeyCodec, ValueCodec >::clear(), Aleph::Gen_File_BPlus_Map< Key, Value, Compare, MinDegree, KeyCodec, ValueCodec >::empty(), Aleph::Gen_File_BPlus_Map< Key, Value, Compare, MinDegree, KeyCodec, ValueCodec >::equals_key(), Aleph::Gen_File_BPlus_Map< Key, Value, Compare, MinDegree, KeyCodec, ValueCodec >::file_path(), Aleph::Gen_File_BPlus_Map< Key, Value, Compare, MinDegree, KeyCodec, ValueCodec >::find_record(), Aleph::Gen_File_BPlus_Map< Key, Value, Compare, MinDegree, KeyCodec, ValueCodec >::get_it(), Aleph::Gen_File_BPlus_Map< Key, Value, Compare, MinDegree, KeyCodec, ValueCodec >::get_range_it(), Aleph::Gen_File_BPlus_Map< Key, Value, Compare, MinDegree, KeyCodec, ValueCodec >::height(), Aleph::Gen_File_BPlus_Map< Key, Value, Compare, MinDegree, KeyCodec, ValueCodec >::insert(), Aleph::Gen_File_BPlus_Map< Key, Value, Compare, MinDegree, KeyCodec, ValueCodec >::insert_or_assign(), Aleph::Gen_File_BPlus_Map< Key, Value, Compare, MinDegree, KeyCodec, ValueCodec >::is_read_only(), Aleph::Gen_File_BPlus_Map< Key, Value, Compare, MinDegree, KeyCodec, ValueCodec >::items(), Aleph::Gen_File_BPlus_Map< Key, Value, Compare, MinDegree, KeyCodec, ValueCodec >::key_comp(), Aleph::Gen_File_BPlus_Map< Key, Value, Compare, MinDegree, KeyCodec, ValueCodec >::keys(), Aleph::Gen_File_BPlus_Map< Key, Value, Compare, MinDegree, KeyCodec, ValueCodec >::lower_bound(), Aleph::Gen_File_BPlus_Map< Key, Value, Compare, MinDegree, KeyCodec, ValueCodec >::max_item(), Aleph::Gen_File_BPlus_Map< Key, Value, Compare, MinDegree, KeyCodec, ValueCodec >::min_item(), Aleph::Gen_File_BPlus_Map< Key, Value, Compare, MinDegree, KeyCodec, ValueCodec >::open_mode(), Aleph::Gen_File_BPlus_Map< Key, Value, Compare, MinDegree, KeyCodec, ValueCodec >::page_count(), Aleph::Gen_File_BPlus_Map< Key, Value, Compare, MinDegree, KeyCodec, ValueCodec >::page_size_bytes(), Aleph::Gen_File_BPlus_Map< Key, Value, Compare, MinDegree, KeyCodec, ValueCodec >::range(), Aleph::Gen_File_BPlus_Map< Key, Value, Compare, MinDegree, KeyCodec, ValueCodec >::reload(), Aleph::Gen_File_BPlus_Map< Key, Value, Compare, MinDegree, KeyCodec, ValueCodec >::remove(), Aleph::Gen_File_BPlus_Map< Key, Value, Compare, MinDegree, KeyCodec, ValueCodec >::set_auto_sync(), Aleph::Gen_File_BPlus_Map< Key, Value, Compare, MinDegree, KeyCodec, ValueCodec >::size(), Aleph::Gen_File_BPlus_Map< Key, Value, Compare, MinDegree, KeyCodec, ValueCodec >::sync(), Aleph::Gen_File_BPlus_Map< Key, Value, Compare, MinDegree, KeyCodec, ValueCodec >::upper_bound(), Aleph::Gen_File_BPlus_Map< Key, Value, Compare, MinDegree, KeyCodec, ValueCodec >::values(), and Aleph::Gen_File_BPlus_Map< Key, Value, Compare, MinDegree, KeyCodec, ValueCodec >::verify().