|
Aleph-w 3.0
A C++ Library for Data Structures and Algorithms
|
Persistent ordered map backed by a paged File_B_Tree. More...
#include <tpl_file_b_map.H>
Classes | |
| 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_B_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_B_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_B_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_B_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_B_Map (const Gen_File_B_Map &)=delete | |
| Copying is disabled. | |
| Gen_File_B_Map & | operator= (const Gen_File_B_Map &)=delete |
| Assignment is disabled. | |
| Gen_File_B_Map (Gen_File_B_Map &&)=delete | |
| Moving is disabled. | |
| Gen_File_B_Map & | operator= (Gen_File_B_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< 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. | |
| 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_B_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) |
| static const char * | validated_path (const char *p) |
Private Attributes | |
| tree_impl_type | tree_ |
Persistent ordered map backed by a paged File_B_Tree.
Gen_File_B_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_B_Tree.
| 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_B_Tree. The default codecs cover fixed-size arithmetic types and std::array; bounded strings can be supported with Aleph::detail::Paged_Bounded_String_Codec.find, contains, at, min_item, max_item, bounds, and materialization methods) are safe for concurrent access from multiple readers when the map is opened in Read_Only mode. Mutating methods (insert, insert_or_assign, remove, clear, sync, checkpoint, reload, set_auto_sync) require external synchronization. No method is individually atomic with respect to the backing file unless auto_sync is enabled or sync() is called explicitly after mutation. Definition at line 96 of file tpl_file_b_map.H.
|
private |
Definition at line 98 of file tpl_file_b_map.H.
| using Aleph::Gen_File_B_Map< Key, Value, Compare, MinDegree, KeyCodec, ValueCodec >::key_type = Key |
Definition at line 228 of file tpl_file_b_map.H.
| using Aleph::Gen_File_B_Map< Key, Value, Compare, MinDegree, KeyCodec, ValueCodec >::mapped_type = Value |
Definition at line 229 of file tpl_file_b_map.H.
| using Aleph::Gen_File_B_Map< Key, Value, Compare, MinDegree, KeyCodec, ValueCodec >::open_mode_type = typename tree_type::open_mode_type |
Definition at line 232 of file tpl_file_b_map.H.
|
private |
Definition at line 162 of file tpl_file_b_map.H.
| using Aleph::Gen_File_B_Map< Key, Value, Compare, MinDegree, KeyCodec, ValueCodec >::tree_type = tree_impl_type |
Definition at line 231 of file tpl_file_b_map.H.
|
private |
Definition at line 99 of file tpl_file_b_map.H.
| using Aleph::Gen_File_B_Map< Key, Value, Compare, MinDegree, KeyCodec, ValueCodec >::value_type = std::pair<Key, Value> |
Definition at line 230 of file tpl_file_b_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 246 of file tpl_file_b_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 260 of file tpl_file_b_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::invalid_argument | If file_path is null or otherwise invalid (propagated from validated_path()) |
| std::runtime_error | If the backing file cannot be used. |
| std::bad_alloc | If the page cache cannot be allocated. |
Definition at line 276 of file tpl_file_b_map.H.
References ah_invalid_argument_if, and Aleph::Gen_File_B_Map< Key, Value, Compare, MinDegree, KeyCodec, ValueCodec >::file_path().
|
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::invalid_argument | If file_path is null or otherwise invalid (propagated from validated_path()) |
| std::runtime_error | If the backing file cannot be used. |
| std::bad_alloc | If the page cache cannot be allocated. |
Definition at line 295 of file tpl_file_b_map.H.
References ah_invalid_argument_if, and Aleph::Gen_File_B_Map< Key, Value, Compare, MinDegree, KeyCodec, ValueCodec >::file_path().
|
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 508 of file tpl_file_b_map.H.
References ah_domain_error_if, Aleph::divide_and_conquer_partition_dp(), and Aleph::Gen_File_B_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 351 of file tpl_file_b_map.H.
References Aleph::Gen_File_B_Tree< Key, Compare, MinDegree, Codec >::auto_sync_enabled(), and Aleph::Gen_File_B_Map< Key, Value, Compare, MinDegree, KeyCodec, ValueCodec >::tree_.
Referenced by Aleph::Gen_File_B_Map< Key, Value, Compare, MinDegree, KeyCodec, ValueCodec >::insert_or_assign().
|
inline |
Synonym for sync().
| std::runtime_error | If the file cannot be synchronized. |
Definition at line 441 of file tpl_file_b_map.H.
References Aleph::Gen_File_B_Tree< Key, Compare, MinDegree, Codec >::checkpoint(), and Aleph::Gen_File_B_Map< Key, Value, Compare, MinDegree, KeyCodec, ValueCodec >::tree_.
|
inlinenoexcept |
Return the latest durable checkpoint sequence.
| Nothing. |
Definition at line 422 of file tpl_file_b_map.H.
References Aleph::Gen_File_B_Tree< Key, Compare, MinDegree, Codec >::checkpoint_sequence(), and Aleph::Gen_File_B_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 460 of file tpl_file_b_map.H.
References Aleph::Gen_File_B_Tree< Key, Compare, MinDegree, Codec >::clear(), and Aleph::Gen_File_B_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 copies. |
Definition at line 471 of file tpl_file_b_map.H.
References Aleph::Gen_File_B_Map< Key, Value, Compare, MinDegree, KeyCodec, ValueCodec >::find_record().
Referenced by Aleph::Gen_File_B_Map< Key, Value, Compare, MinDegree, KeyCodec, ValueCodec >::search().
|
inlinenoexcept |
Return whether the map is empty.
true if empty, otherwise false. | Nothing. |
Definition at line 381 of file tpl_file_b_map.H.
References Aleph::Gen_File_B_Tree< Key, Compare, MinDegree, Codec >::empty(), and Aleph::Gen_File_B_Map< Key, Value, Compare, MinDegree, KeyCodec, ValueCodec >::tree_.
|
inlineprivate |
Definition at line 206 of file tpl_file_b_map.H.
References Aleph::and, cmp(), Aleph::divide_and_conquer_partition_dp(), Aleph::Gen_File_B_Tree< Key, Compare, MinDegree, Codec >::key_comp(), and Aleph::Gen_File_B_Map< Key, Value, Compare, MinDegree, KeyCodec, ValueCodec >::tree_.
Referenced by Aleph::Gen_File_B_Map< Key, Value, Compare, MinDegree, KeyCodec, ValueCodec >::find_record(), and Aleph::Gen_File_B_Map< Key, Value, Compare, MinDegree, KeyCodec, ValueCodec >::insert_or_assign().
|
inlinenoexcept |
Return the file path.
| Nothing. |
Definition at line 321 of file tpl_file_b_map.H.
References Aleph::Gen_File_B_Tree< Key, Compare, MinDegree, Codec >::file_path(), and Aleph::Gen_File_B_Map< Key, Value, Compare, MinDegree, KeyCodec, ValueCodec >::tree_.
Referenced by Aleph::Gen_File_B_Map< Key, Value, Compare, MinDegree, KeyCodec, ValueCodec >::Gen_File_B_Map(), and Aleph::Gen_File_B_Map< Key, Value, Compare, MinDegree, KeyCodec, ValueCodec >::Gen_File_B_Map().
|
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 493 of file tpl_file_b_map.H.
References Aleph::divide_and_conquer_partition_dp(), and Aleph::Gen_File_B_Map< Key, Value, Compare, MinDegree, KeyCodec, ValueCodec >::find_record().
Referenced by Aleph::Gen_File_B_Map< Key, Value, Compare, MinDegree, KeyCodec, ValueCodec >::at(), and TEST().
|
inlineprivate |
Definition at line 212 of file tpl_file_b_map.H.
References Aleph::and, Aleph::divide_and_conquer_partition_dp(), Aleph::Gen_File_B_Map< Key, Value, Compare, MinDegree, KeyCodec, ValueCodec >::equals_key(), Aleph::Gen_File_B_Tree< Key, Compare, MinDegree, Codec >::lower_bound(), Aleph::Gen_File_B_Map< Key, Value, Compare, MinDegree, KeyCodec, ValueCodec >::make_probe(), and Aleph::Gen_File_B_Map< Key, Value, Compare, MinDegree, KeyCodec, ValueCodec >::tree_.
Referenced by Aleph::Gen_File_B_Map< Key, Value, Compare, MinDegree, KeyCodec, ValueCodec >::contains(), and Aleph::Gen_File_B_Map< Key, Value, Compare, MinDegree, KeyCodec, ValueCodec >::find().
|
inlinenoexcept |
Return the current tree height.
0 for an empty file, otherwise the number of page levels. | Nothing. |
Definition at line 395 of file tpl_file_b_map.H.
References Aleph::Gen_File_B_Tree< Key, Compare, MinDegree, Codec >::height(), and Aleph::Gen_File_B_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 525 of file tpl_file_b_map.H.
References Aleph::Gen_File_B_Tree< Key, Compare, MinDegree, Codec >::insert(), Aleph::Gen_File_B_Map< Key, Value, Compare, MinDegree, KeyCodec, ValueCodec >::make_record(), and Aleph::Gen_File_B_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. |
auto_sync for the tree_.remove(probe) + tree_.insert(record) pair so both operations are batched into a single WAL write; the pair is either both present or both absent after recovery. A crash before the final sync() call leaves the key with its old value (WAL replay re-applies the last complete transaction). Callers that require strict all-or-nothing durability should call sync() explicitly after insert_or_assign returns. Definition at line 547 of file tpl_file_b_map.H.
References ah_runtime_error_unless, Aleph::and, Aleph::Gen_File_B_Map< Key, Value, Compare, MinDegree, KeyCodec, ValueCodec >::auto_sync_enabled(), Aleph::divide_and_conquer_partition_dp(), Aleph::Gen_File_B_Map< Key, Value, Compare, MinDegree, KeyCodec, ValueCodec >::equals_key(), Aleph::Gen_File_B_Tree< Key, Compare, MinDegree, Codec >::insert(), Aleph::Gen_File_B_Tree< Key, Compare, MinDegree, Codec >::lower_bound(), Aleph::Gen_File_B_Map< Key, Value, Compare, MinDegree, KeyCodec, ValueCodec >::make_probe(), Aleph::Gen_File_B_Map< Key, Value, Compare, MinDegree, KeyCodec, ValueCodec >::make_record(), Aleph::Gen_File_B_Tree< Key, Compare, MinDegree, Codec >::remove(), Aleph::Gen_File_B_Map< Key, Value, Compare, MinDegree, KeyCodec, ValueCodec >::set_auto_sync(), Aleph::Gen_File_B_Map< Key, Value, Compare, MinDegree, KeyCodec, ValueCodec >::sync(), and Aleph::Gen_File_B_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 341 of file tpl_file_b_map.H.
References Aleph::Gen_File_B_Tree< Key, Compare, MinDegree, Codec >::is_read_only(), and Aleph::Gen_File_B_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 691 of file tpl_file_b_map.H.
References Aleph::Gen_File_B_Tree< Key, Compare, MinDegree, Codec >::keys(), Aleph::Gen_File_B_Map< Key, Value, Compare, MinDegree, KeyCodec, ValueCodec >::to_pairs(), and Aleph::Gen_File_B_Map< Key, Value, Compare, MinDegree, KeyCodec, ValueCodec >::tree_.
|
inlinenoexcept |
Return the key comparator.
| Nothing. |
Definition at line 371 of file tpl_file_b_map.H.
References Aleph::Gen_File_B_Tree< Key, Compare, MinDegree, Codec >::key_comp(), and Aleph::Gen_File_B_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 661 of file tpl_file_b_map.H.
References Aleph::divide_and_conquer_partition_dp(), Aleph::Gen_File_B_Tree< Key, Compare, MinDegree, Codec >::keys(), Aleph::Array< T >::reserve(), and Aleph::Gen_File_B_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 634 of file tpl_file_b_map.H.
References Aleph::divide_and_conquer_partition_dp(), Aleph::Gen_File_B_Tree< Key, Compare, MinDegree, Codec >::lower_bound(), Aleph::Gen_File_B_Map< Key, Value, Compare, MinDegree, KeyCodec, ValueCodec >::make_probe(), Aleph::Gen_File_B_Map< Key, Value, Compare, MinDegree, KeyCodec, ValueCodec >::to_pair(), and Aleph::Gen_File_B_Map< Key, Value, Compare, MinDegree, KeyCodec, ValueCodec >::tree_.
Referenced by TEST().
|
inlinestaticprivate |
Definition at line 174 of file tpl_file_b_map.H.
References Aleph::Gen_File_B_Map< Key, Value, Compare, MinDegree, KeyCodec, ValueCodec >::Record::bytes.
Referenced by Aleph::Gen_File_B_Map< Key, Value, Compare, MinDegree, KeyCodec, ValueCodec >::find_record(), Aleph::Gen_File_B_Map< Key, Value, Compare, MinDegree, KeyCodec, ValueCodec >::insert_or_assign(), Aleph::Gen_File_B_Map< Key, Value, Compare, MinDegree, KeyCodec, ValueCodec >::lower_bound(), Aleph::Gen_File_B_Map< Key, Value, Compare, MinDegree, KeyCodec, ValueCodec >::remove(), and Aleph::Gen_File_B_Map< Key, Value, Compare, MinDegree, KeyCodec, ValueCodec >::upper_bound().
|
inlinestaticprivate |
Definition at line 181 of file tpl_file_b_map.H.
References Aleph::Gen_File_B_Map< Key, Value, Compare, MinDegree, KeyCodec, ValueCodec >::Record::bytes.
Referenced by Aleph::Gen_File_B_Map< Key, Value, Compare, MinDegree, KeyCodec, ValueCodec >::insert(), and Aleph::Gen_File_B_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 620 of file tpl_file_b_map.H.
References Aleph::divide_and_conquer_partition_dp(), Aleph::Gen_File_B_Tree< Key, Compare, MinDegree, Codec >::max_key(), Aleph::Gen_File_B_Map< Key, Value, Compare, MinDegree, KeyCodec, ValueCodec >::to_pair(), and Aleph::Gen_File_B_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 607 of file tpl_file_b_map.H.
References Aleph::divide_and_conquer_partition_dp(), Aleph::Gen_File_B_Tree< Key, Compare, MinDegree, Codec >::min_key(), Aleph::Gen_File_B_Map< Key, Value, Compare, MinDegree, KeyCodec, ValueCodec >::to_pair(), and Aleph::Gen_File_B_Map< Key, Value, Compare, MinDegree, KeyCodec, ValueCodec >::tree_.
Referenced by TEST().
|
inlinenoexcept |
Return the open mode.
Read_Write or Read_Only. | Nothing. |
Definition at line 331 of file tpl_file_b_map.H.
References Aleph::Gen_File_B_Tree< Key, Compare, MinDegree, Codec >::open_mode(), and Aleph::Gen_File_B_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 412 of file tpl_file_b_map.H.
References Aleph::Gen_File_B_Tree< Key, Compare, MinDegree, Codec >::page_count(), and Aleph::Gen_File_B_Map< Key, Value, Compare, MinDegree, KeyCodec, ValueCodec >::tree_.
|
inlinenoexcept |
Return the serialized page size of the backing tree.
| Nothing. |
Definition at line 402 of file tpl_file_b_map.H.
References Aleph::Gen_File_B_Tree< Key, Compare, MinDegree, Codec >::page_size_bytes(), and Aleph::Gen_File_B_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 450 of file tpl_file_b_map.H.
References Aleph::Gen_File_B_Tree< Key, Compare, MinDegree, Codec >::reload(), and Aleph::Gen_File_B_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 597 of file tpl_file_b_map.H.
References Aleph::Gen_File_B_Map< Key, Value, Compare, MinDegree, KeyCodec, ValueCodec >::make_probe(), Aleph::Gen_File_B_Tree< Key, Compare, MinDegree, Codec >::remove(), and Aleph::Gen_File_B_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 copies. |
Definition at line 482 of file tpl_file_b_map.H.
References Aleph::Gen_File_B_Map< Key, Value, Compare, MinDegree, KeyCodec, ValueCodec >::contains().
|
inlinenoexcept |
Enable or disable automatic synchronization.
| enabled | New auto-sync mode. |
| Nothing. |
Definition at line 361 of file tpl_file_b_map.H.
References Aleph::Gen_File_B_Tree< Key, Compare, MinDegree, Codec >::set_auto_sync(), and Aleph::Gen_File_B_Map< Key, Value, Compare, MinDegree, KeyCodec, ValueCodec >::tree_.
Referenced by Aleph::Gen_File_B_Map< Key, Value, Compare, MinDegree, KeyCodec, ValueCodec >::insert_or_assign().
|
inlinenoexcept |
Return the number of stored key/value pairs.
| Nothing. |
Definition at line 388 of file tpl_file_b_map.H.
References Aleph::Gen_File_B_Tree< Key, Compare, MinDegree, Codec >::size(), and Aleph::Gen_File_B_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 432 of file tpl_file_b_map.H.
References Aleph::Gen_File_B_Tree< Key, Compare, MinDegree, Codec >::sync(), and Aleph::Gen_File_B_Map< Key, Value, Compare, MinDegree, KeyCodec, ValueCodec >::tree_.
Referenced by Aleph::Gen_File_B_Map< Key, Value, Compare, MinDegree, KeyCodec, ValueCodec >::insert_or_assign(), and TEST().
|
inlinestaticprivate |
Definition at line 191 of file tpl_file_b_map.H.
References Aleph::Gen_File_B_Map< Key, Value, Compare, MinDegree, KeyCodec, ValueCodec >::Record::get_key(), and Aleph::Gen_File_B_Map< Key, Value, Compare, MinDegree, KeyCodec, ValueCodec >::Record::get_value().
Referenced by Aleph::Gen_File_B_Map< Key, Value, Compare, MinDegree, KeyCodec, ValueCodec >::lower_bound(), Aleph::Gen_File_B_Map< Key, Value, Compare, MinDegree, KeyCodec, ValueCodec >::max_item(), Aleph::Gen_File_B_Map< Key, Value, Compare, MinDegree, KeyCodec, ValueCodec >::min_item(), Aleph::Gen_File_B_Map< Key, Value, Compare, MinDegree, KeyCodec, ValueCodec >::to_pairs(), and Aleph::Gen_File_B_Map< Key, Value, Compare, MinDegree, KeyCodec, ValueCodec >::upper_bound().
|
inlinestaticprivate |
Definition at line 197 of file tpl_file_b_map.H.
References Aleph::divide_and_conquer_partition_dp(), Aleph::Array< T >::reserve(), and Aleph::Gen_File_B_Map< Key, Value, Compare, MinDegree, KeyCodec, ValueCodec >::to_pair().
Referenced by Aleph::Gen_File_B_Map< Key, Value, Compare, MinDegree, KeyCodec, ValueCodec >::items().
|
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 648 of file tpl_file_b_map.H.
References Aleph::divide_and_conquer_partition_dp(), Aleph::Gen_File_B_Map< Key, Value, Compare, MinDegree, KeyCodec, ValueCodec >::make_probe(), Aleph::Gen_File_B_Map< Key, Value, Compare, MinDegree, KeyCodec, ValueCodec >::to_pair(), Aleph::Gen_File_B_Map< Key, Value, Compare, MinDegree, KeyCodec, ValueCodec >::tree_, and Aleph::Gen_File_B_Tree< Key, Compare, MinDegree, Codec >::upper_bound().
|
inlinestaticprivate |
Definition at line 221 of file tpl_file_b_map.H.
References ah_invalid_argument_if.
|
inline |
Materialize all mapped values in key order.
| std::bad_alloc | If the result array cannot grow. |
Definition at line 676 of file tpl_file_b_map.H.
References Aleph::divide_and_conquer_partition_dp(), Aleph::Gen_File_B_Tree< Key, Compare, MinDegree, Codec >::keys(), Aleph::Array< T >::reserve(), and Aleph::Gen_File_B_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 702 of file tpl_file_b_map.H.
References Aleph::Gen_File_B_Map< Key, Value, Compare, MinDegree, KeyCodec, ValueCodec >::tree_, and Aleph::Gen_File_B_Tree< Key, Compare, MinDegree, Codec >::verify().
Referenced by TEST().
|
staticconstexpr |
Definition at line 235 of file tpl_file_b_map.H.
|
staticconstexpr |
Definition at line 234 of file tpl_file_b_map.H.
|
private |
Definition at line 172 of file tpl_file_b_map.H.
Referenced by Aleph::Gen_File_B_Map< Key, Value, Compare, MinDegree, KeyCodec, ValueCodec >::auto_sync_enabled(), Aleph::Gen_File_B_Map< Key, Value, Compare, MinDegree, KeyCodec, ValueCodec >::checkpoint(), Aleph::Gen_File_B_Map< Key, Value, Compare, MinDegree, KeyCodec, ValueCodec >::checkpoint_sequence(), Aleph::Gen_File_B_Map< Key, Value, Compare, MinDegree, KeyCodec, ValueCodec >::clear(), Aleph::Gen_File_B_Map< Key, Value, Compare, MinDegree, KeyCodec, ValueCodec >::empty(), Aleph::Gen_File_B_Map< Key, Value, Compare, MinDegree, KeyCodec, ValueCodec >::equals_key(), Aleph::Gen_File_B_Map< Key, Value, Compare, MinDegree, KeyCodec, ValueCodec >::file_path(), Aleph::Gen_File_B_Map< Key, Value, Compare, MinDegree, KeyCodec, ValueCodec >::find_record(), Aleph::Gen_File_B_Map< Key, Value, Compare, MinDegree, KeyCodec, ValueCodec >::height(), Aleph::Gen_File_B_Map< Key, Value, Compare, MinDegree, KeyCodec, ValueCodec >::insert(), Aleph::Gen_File_B_Map< Key, Value, Compare, MinDegree, KeyCodec, ValueCodec >::insert_or_assign(), Aleph::Gen_File_B_Map< Key, Value, Compare, MinDegree, KeyCodec, ValueCodec >::is_read_only(), Aleph::Gen_File_B_Map< Key, Value, Compare, MinDegree, KeyCodec, ValueCodec >::items(), Aleph::Gen_File_B_Map< Key, Value, Compare, MinDegree, KeyCodec, ValueCodec >::key_comp(), Aleph::Gen_File_B_Map< Key, Value, Compare, MinDegree, KeyCodec, ValueCodec >::keys(), Aleph::Gen_File_B_Map< Key, Value, Compare, MinDegree, KeyCodec, ValueCodec >::lower_bound(), Aleph::Gen_File_B_Map< Key, Value, Compare, MinDegree, KeyCodec, ValueCodec >::max_item(), Aleph::Gen_File_B_Map< Key, Value, Compare, MinDegree, KeyCodec, ValueCodec >::min_item(), Aleph::Gen_File_B_Map< Key, Value, Compare, MinDegree, KeyCodec, ValueCodec >::open_mode(), Aleph::Gen_File_B_Map< Key, Value, Compare, MinDegree, KeyCodec, ValueCodec >::page_count(), Aleph::Gen_File_B_Map< Key, Value, Compare, MinDegree, KeyCodec, ValueCodec >::page_size_bytes(), Aleph::Gen_File_B_Map< Key, Value, Compare, MinDegree, KeyCodec, ValueCodec >::reload(), Aleph::Gen_File_B_Map< Key, Value, Compare, MinDegree, KeyCodec, ValueCodec >::remove(), Aleph::Gen_File_B_Map< Key, Value, Compare, MinDegree, KeyCodec, ValueCodec >::set_auto_sync(), Aleph::Gen_File_B_Map< Key, Value, Compare, MinDegree, KeyCodec, ValueCodec >::size(), Aleph::Gen_File_B_Map< Key, Value, Compare, MinDegree, KeyCodec, ValueCodec >::sync(), Aleph::Gen_File_B_Map< Key, Value, Compare, MinDegree, KeyCodec, ValueCodec >::upper_bound(), Aleph::Gen_File_B_Map< Key, Value, Compare, MinDegree, KeyCodec, ValueCodec >::values(), and Aleph::Gen_File_B_Map< Key, Value, Compare, MinDegree, KeyCodec, ValueCodec >::verify().