Aleph-w 3.0
A C++ Library for Data Structures and Algorithms
Loading...
Searching...
No Matches
Aleph::Gen_File_B_Tree< Key, Compare, MinDegree, Codec > Class Template Reference

Persistent page-managed B-Tree stored in a single binary file. More...

#include <tpl_file_b_tree.H>

Inheritance diagram for Aleph::Gen_File_B_Tree< Key, Compare, MinDegree, Codec >:
[legend]
Collaboration diagram for Aleph::Gen_File_B_Tree< Key, Compare, MinDegree, Codec >:
[legend]

Classes

struct  Loaded_Image
 
struct  Page
 
struct  Wal_Record
 

Public Types

using key_type = Key
 Stored key type.
 
using tree_type = Gen_B_Tree< Key, Compare, MinDegree >
 Logical in-memory counterpart.
 
using page_id_type = page_id_t
 Type of on-disk page identifiers.
 
using open_mode_type = Paged_File_Open_Mode
 File opening mode type.
 

Public Member Functions

 Gen_File_B_Tree (std::string file_path, const bool auto_sync=true, const Compare &cmp=Compare())
 Open or create a paged persistent B-Tree file for read-write access.
 
 Gen_File_B_Tree (std::string file_path, const Paged_File_Open_Mode open_mode, const bool auto_sync=true, const Compare &cmp=Compare())
 Open a paged persistent B-Tree file with an explicit access mode.
 
 Gen_File_B_Tree (const char *file_path, const bool auto_sync=true, const Compare &cmp=Compare())
 Open or create a paged persistent B-Tree file for read-write access.
 
 Gen_File_B_Tree (const char *file_path, const Paged_File_Open_Mode open_mode, const bool auto_sync=true, const Compare &cmp=Compare())
 Open a paged persistent B-Tree file with an explicit access mode.
 
 Gen_File_B_Tree (const Gen_File_B_Tree &)=delete
 Copying is disabled.
 
Gen_File_B_Treeoperator= (const Gen_File_B_Tree &)=delete
 Assignment is disabled.
 
 Gen_File_B_Tree (Gen_File_B_Tree &&)=delete
 Moving is disabled.
 
Gen_File_B_Treeoperator= (Gen_File_B_Tree &&)=delete
 Move assignment is disabled.
 
 ~Gen_File_B_Tree () noexcept
 Close the backing file.
 
const Compare & key_comp () const noexcept
 Return the comparison object.
 
const Compare & get_compare () const noexcept
 Return the comparison object.
 
const std::string & file_path () const noexcept
 Return the backing file path.
 
const std::string & get_file_path () const noexcept
 Synonym for file_path().
 
Paged_File_Open_Mode open_mode () const noexcept
 Return the access mode used to open the file.
 
bool is_read_only () const noexcept
 Return whether this 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 flushing of dirty pages.
 
size_t page_size_bytes () const noexcept
 Return the fixed serialized page size.
 
size_t page_count () const noexcept
 Return the number of allocated pages currently tracked.
 
std::uint64_t checkpoint_sequence () const noexcept
 Return the durable checkpoint sequence stored in the backing file.
 
void checkpoint () const
 Synonym for sync().
 
void sync () const
 Flush the current tree image using redo WAL or full-image fallback.
 
void reload ()
 Discard unsynchronized changes and reload pages from disk.
 
bool empty () const noexcept
 Return whether the tree has no keys.
 
bool is_empty () const noexcept
 Synonym for empty().
 
size_t size () const noexcept
 Return the number of stored keys.
 
size_t height () const noexcept
 Return the current height of the paged tree.
 
void clear ()
 Remove every key from the tree.
 
bool contains (const Key &key) const
 Return whether a key is present.
 
bool search (const Key &key) const
 Synonym for contains().
 
bool insert (const Key &key)
 Insert a key if it is not already present.
 
bool insert (Key &&key)
 Insert a key by move if it is not already present.
 
bool remove (const Key &key)
 Remove a key if present.
 
std::optional< Key > min_key () const
 Return the minimum key, if any.
 
std::optional< Key > max_key () const
 Return the maximum key, if any.
 
std::optional< Key > lower_bound (const Key &key) const
 Return the first key not less than key.
 
std::optional< Key > upper_bound (const Key &key) const
 Return the first key strictly greater than key.
 
Array< Key > keys () const
 Materialize the tree contents in sorted order.
 
bool verify () const
 Verify structural B-Tree invariants across cached pages.
 

Static Public Attributes

static constexpr auto Read_Write = Paged_File_Open_Mode::Read_Write
 
static constexpr auto Read_Only = Paged_File_Open_Mode::Read_Only
 

Private Types

enum class  PageKind : std::uint8_t { Free = 0 , Internal = 1 , Leaf = 2 }
 
using page_id_t = std::uint64_t
 

Private Member Functions

detail::Pid_File_Lock_Mode lock_mode () const noexcept
 
bool read_only () const noexcept
 
void ensure_writable (const char *operation) const
 
void init_empty_cache ()
 
void ensure_parent_dir () const
 
void open_storage (const bool truncate=false) const
 
void init_sidecar_paths ()
 
void seekp_to (const std::streamoff offset) const
 
std::streamoff current_page_offset (const page_id_t page_id) const noexcept
 
void write_header_to_storage (const std::uint64_t size, const page_id_t root_page, const std::uint64_t page_count, const page_id_t free_page_head, const std::uint64_t checkpoint_sequence) const
 
void write_current_header_to_storage (const std::uint64_t checkpoint_sequence) const
 
void write_current_page_to_storage (const page_id_t page_id, const Page &page) const
 
size_t dirty_page_count () const noexcept
 
void write_wal_to_path (const std::string &target_path, const std::uint64_t checkpoint_sequence) const
 
void write_full_image (std::ostream &out, const std::string &target_path, const std::uint64_t checkpoint_sequence) const
 
void write_full_image_to_path (const std::string &target_path, const std::uint64_t checkpoint_sequence) const
 
void apply_current_cache_to_storage (const std::uint64_t checkpoint_sequence) const
 
void recover_from_wal ()
 
void recover_if_needed ()
 
Loaded_Image read_image (const std::string &source_path) const
 
void load_from_disk ()
 
void create_empty_file ()
 
bool file_exists () const
 
std::optional< std::uint32_t > storage_format_version_on_disk () const
 
std::optional< Pageread_storage_page_if_current (const page_id_t page_id) const
 
bool has_pending_changes () const noexcept
 
void clear_dirty_state () const noexcept
 
void mark_page_dirty (const page_id_t page_id)
 
void stamp_all_pages_for_checkpoint (const std::uint64_t checkpoint_sequence) noexcept
 
void mark_header_dirty () const noexcept
 
Pagepage (const page_id_t page_id)
 
const Pagepage (const page_id_t page_id) const
 
bool equals (const Key &lhs, const Key &rhs) const
 
bool strictly_sorted (const Page &page) const
 
size_t lower_bound_index (const Page &page, const Key &key) const
 
size_t upper_bound_index (const Page &page, const Key &key) const
 
page_id_t allocate_page (const PageKind kind)
 
void release_page (const page_id_t page_id)
 
std::optional< Key > min_in (page_id_t page_id) const
 
std::optional< Key > max_in (page_id_t page_id) const
 
void split_child (const page_id_t parent_id, const size_t idx)
 
void insert_nonfull (const page_id_t page_id, const Key &key)
 
void borrow_from_prev (const page_id_t parent_id, const size_t idx)
 
void borrow_from_next (const page_id_t parent_id, const size_t idx)
 
void merge_children (const page_id_t parent_id, const size_t idx)
 
size_t ensure_child_has_extra (const page_id_t parent_id, const size_t idx)
 
bool remove_from (const page_id_t page_id, const Key &key)
 
void collect_keys (const page_id_t page_id, Array< Key > &out) const
 
bool verify_node (const page_id_t page_id, const std::optional< Key > &min_key, const std::optional< Key > &max_key, const size_t depth, size_t &leaf_depth, size_t &counted, Array< unsigned char > &visited) const
 
void sync_if_enabled ()
 

Static Private Member Functions

static constexpr const chartree_kind () noexcept
 
static constexpr auto file_magic () noexcept
 
static constexpr auto wal_magic () noexcept
 
static constexpr auto wal_trailer_magic () noexcept
 
static constexpr size_t legacy_header_bytes () noexcept
 
static constexpr size_t checksummed_header_bytes () noexcept
 
static constexpr size_t header_bytes () noexcept
 
static constexpr size_t legacy_page_bytes () noexcept
 
static constexpr size_t checksummed_page_bytes () noexcept
 
static constexpr size_t native_page_bytes () noexcept
 
static constexpr size_t portable_page_bytes () noexcept
 
static constexpr size_t page_bytes () noexcept
 
static constexpr size_t serialized_header_bytes (const std::uint32_t version) noexcept
 
static constexpr size_t serialized_page_bytes (const std::uint32_t version) noexcept
 
static constexpr bool version_uses_portable_codec (const std::uint32_t version) noexcept
 
static constexpr std::uint8_t encoding_marker_for_version (const std::uint32_t version) noexcept
 
static constexpr std::uint32_t key_size_for_version (const std::uint32_t version) noexcept
 
static constexpr std::array< char, 7 > reserved_bytes_for_version (const std::uint32_t version) noexcept
 
static constexpr Page make_page (const PageKind kind) noexcept
 
static void ensure_legacy_native_format_supported (const std::string &source_path, const std::uint32_t version)
 
static void ensure_legacy_native_wal_supported (const std::string &source_path, const std::uint32_t wal_version)
 
static constexpr bool is_leaf (const Page &page) noexcept
 
static constexpr bool is_internal (const Page &page) noexcept
 
static constexpr bool is_free (const Page &page) noexcept
 
template<typename T >
static void write_pod (std::ostream &out, const T &value, const std::string &file_path, const char *what)
 
template<typename T >
static T read_pod (std::istream &in, const std::string &file_path, const char *what)
 
static void write_native_key (std::ostream &out, const Key &key, const std::string &file_path, const char *what)
 
static void write_portable_key (std::ostream &out, const Key &key, const std::string &file_path, const char *what)
 
static void write_key (std::ostream &out, const Key &key, const std::string &file_path, const char *what)
 
static Key read_native_key (std::istream &in, const std::string &file_path, const char *what)
 
static Key read_portable_key (std::istream &in, const std::string &file_path, const char *what)
 
static Key read_key (std::istream &in, const std::string &file_path, const char *what, const std::uint32_t version)
 
static std::uint32_t add_key_to_crc (const std::uint32_t crc, const Key &key)
 
static std::uint32_t add_native_key_to_crc (const std::uint32_t crc, const Key &key)
 
static std::uint32_t header_checksum_v2 (const std::uint32_t version, const std::uint64_t size, const page_id_t root_page, const std::uint64_t page_count, const page_id_t free_page_head) noexcept
 
static std::uint32_t header_checksum (const std::uint32_t version, const std::uint64_t size, const page_id_t root_page, const std::uint64_t page_count, const page_id_t free_page_head, const std::uint64_t checkpoint_sequence) noexcept
 
static std::uint32_t page_checksum_v3 (const Page &page)
 
static std::uint32_t page_checksum (const Page &page)
 
static std::uint32_t page_checksum_v4 (const Page &page)
 
static std::uint32_t wal_record_checksum_add (std::uint32_t crc, const page_id_t page_id, const Page &page)
 
static std::uint32_t wal_record_checksum_add_v3 (std::uint32_t crc, const page_id_t page_id, const Page &page)
 
static std::uint32_t wal_record_checksum_add_v2 (std::uint32_t crc, const page_id_t page_id, const Page &page)
 
static void write_page_record (std::ostream &out, const Page &page, const std::string &target_path)
 
static constexpr size_t wal_header_bytes () noexcept
 
static constexpr std::uint32_t wal_record_format_version (const std::uint32_t wal_version) noexcept
 
static constexpr size_t wal_record_bytes (const std::uint32_t wal_version) noexcept
 
static std::uint32_t wal_header_checksum (const std::uint32_t wal_version, const std::uint64_t size, const page_id_t root_page, const std::uint64_t page_count, const page_id_t free_page_head, const std::uint64_t checkpoint_sequence, const std::uint64_t dirty_count) noexcept
 
static constexpr size_t wal_trailer_bytes () noexcept
 
static Page read_page_from_stream (std::istream &in, const std::string &path, const std::uint32_t version)
 
static void insert_key_at (Page &page, const size_t idx, const Key &key)
 
static Key erase_key_at (Page &page, const size_t idx)
 
static void insert_child_at (Page &page, const size_t idx, const page_id_t child_id)
 
static page_id_t erase_child_at (Page &page, const size_t idx)
 

Private Attributes

Compare cmp_
 
std::string file_path_
 
Paged_File_Open_Mode open_mode_ = Paged_File_Open_Mode::Read_Write
 
std::string journal_path_
 
std::string journal_tmp_path_
 
std::string wal_path_
 
std::string wal_tmp_path_
 
std::string lock_path_
 
detail::Pid_File_Lock lock_
 
std::fstream file_
 
Array< Pagepages_
 
Array< unsigned chardirty_pages_
 
bool header_dirty_ = false
 
bool auto_sync_ = true
 
std::uint32_t storage_format_version_ = FormatVersion
 
std::uint64_t checkpoint_sequence_ = 0
 
size_t size_ = 0
 
page_id_t root_page_ = 0
 
page_id_t free_page_head_ = 0
 

Static Private Attributes

static constexpr size_t MaxKeys = 2 * MinDegree - 1
 
static constexpr size_t MaxChildren = 2 * MinDegree
 
static constexpr size_t MinKeys = MinDegree - 1
 
static constexpr std::uint32_t LegacyFormatVersion = 1
 
static constexpr std::uint32_t ChecksummedFormatVersion = 2
 
static constexpr std::uint32_t HeaderCheckpointFormatVersion = 3
 
static constexpr std::uint32_t NativeCheckpointFormatVersion = 4
 
static constexpr std::uint32_t PortableFormatVersion = 5
 
static constexpr std::uint32_t FormatVersion = PortableFormatVersion
 
static constexpr std::uint32_t EncodedKeySize
 
static constexpr std::uint8_t PortableEncodingMarker = 3
 
static constexpr std::uint8_t EndianMarker
 
static constexpr std::uint32_t LegacyWalVersion = 1
 
static constexpr std::uint32_t CommitTrailerWalVersion = 2
 
static constexpr std::uint32_t NativeWalVersion = 3
 
static constexpr std::uint32_t PortableWalVersion = 4
 
static constexpr std::uint32_t WalVersion = PortableWalVersion
 

Detailed Description

template<typename Key, class Compare = Aleph::less<Key>, size_t MinDegree = 16, typename Codec = detail::Paged_Value_Codec<Key>>
requires StrictWeakOrder<Compare, Key>
class Aleph::Gen_File_B_Tree< Key, Compare, MinDegree, Codec >

Persistent page-managed B-Tree stored in a single binary file.

Gen_File_B_Tree implements a file-backed B-Tree with:

  • fixed-size node pages identified by page ids
  • an on-disk header containing format/version metadata
  • a free-list for recycling pages released by merges or root collapse
  • in-page keys that mirror the classic B-Tree layout, including keys stored in internal pages

The file is cached in memory after opening, but all updates operate directly on the paged representation instead of rebuilding an in-memory B_Tree and snapshotting its sorted keys. This makes the persistent file structurally faithful to a real on-disk B-Tree while keeping the exposed API close to the existing in-memory container.

Template Parameters
KeyStored key type. It must be default-constructible and copyable for the in-memory page layout, and admit a fixed-size codec so keys can be serialized into portable on-disk pages.
CompareStrict weak ordering used to sort keys.
MinDegreeMinimum degree t of the persistent B-Tree. Valid values are t >= 2.
CodecFixed-size codec used to serialize keys in current files.
Persistence Model
The tree file stores:
  • a header with root page id, size, page count, and free-list head
  • one fixed-size record per allocated page
  • a reusable .lock sidecar with an advisory OS lock and pid marker
  • a .wal sidecar used for redo recovery of page-level commits with an explicit commit trailer
  • a .journal sidecar kept as a legacy full-image fallback path
  • checksummed headers and page records in format version 5, using a fixed-size portable little-endian key codec

With auto_sync enabled, successful mutations write a redo WAL with the dirty page images and then checkpoint those changes into the backing file. Files can also be opened in Paged_File_Open_Mode::Read_Only, which acquires a shared lock and rejects any operation that would write or recover the file. Legacy stores being upgraded still use a full-image fallback path. With auto_sync disabled, mutations stay in the in-memory page cache until sync() is called. reload() discards any unsynchronized changes, replays a pending .wal or legacy .journal if present, and rereads the file. Readers accept the legacy native layouts (v1-v4) as well as the current portable v5 layout with per-page checkpoint sequences.

Complexity
  • Search: O(log n)
  • Insert: O(log n)
  • Remove: O(log n)
  • lower_bound()/upper_bound(): O(log n)
  • sync(): O(p_dirty) page serialization for current portable stores, with a full-image fallback when upgrading legacy files
Thread Safety
Instances are not synchronized. Read_Write handles take an exclusive advisory lock on the .lock sidecar, while Read_Only handles take a shared advisory lock on that same sidecar. The process also tracks open paths locally so invalid mixed opens fail even inside one process. Concurrent access through one handle still requires external synchronization.
Exception Safety
Read-only operations do not mutate the page cache. Mutating operations preserve B-Tree invariants in the in-memory cache if comparisons and key copies do not throw in the middle of a structural update. If auto_sync is enabled and file I/O fails after a successful in-memory mutation, the object remains valid but the on-disk file may lag behind until a later successful sync().
Warning
Current files store keys through Codec in a fixed-size portable representation. Reopening a file still requires the same Compare, MinDegree, and Codec::storage_id. Legacy native formats (v1-v4) remain readable only when Key is trivially copyable.

Generic paged persistent B-Tree container.

This class implements a file-backed B-Tree with a page cache. It is optimized for large datasets that cannot fit entirely in RAM, providing persistent sorted storage with O(log n) performance.

Template Parameters
KeyType of stored elements.
CompareStrict weak ordering used to sort keys.
MinDegreeMinimum degree t determining the branching factor.
CodecFixed-size codec used for serialization.

Definition at line 156 of file tpl_file_b_tree.H.

Member Typedef Documentation

◆ key_type

template<typename Key , class Compare = Aleph::less<Key>, size_t MinDegree = 16, typename Codec = detail::Paged_Value_Codec<Key>>
using Aleph::Gen_File_B_Tree< Key, Compare, MinDegree, Codec >::key_type = Key

Stored key type.

Definition at line 2098 of file tpl_file_b_tree.H.

◆ open_mode_type

template<typename Key , class Compare = Aleph::less<Key>, size_t MinDegree = 16, typename Codec = detail::Paged_Value_Codec<Key>>
using Aleph::Gen_File_B_Tree< Key, Compare, MinDegree, Codec >::open_mode_type = Paged_File_Open_Mode

File opening mode type.

Definition at line 2101 of file tpl_file_b_tree.H.

◆ page_id_t

template<typename Key , class Compare = Aleph::less<Key>, size_t MinDegree = 16, typename Codec = detail::Paged_Value_Codec<Key>>
using Aleph::Gen_File_B_Tree< Key, Compare, MinDegree, Codec >::page_id_t = std::uint64_t
private

Definition at line 185 of file tpl_file_b_tree.H.

◆ page_id_type

template<typename Key , class Compare = Aleph::less<Key>, size_t MinDegree = 16, typename Codec = detail::Paged_Value_Codec<Key>>
using Aleph::Gen_File_B_Tree< Key, Compare, MinDegree, Codec >::page_id_type = page_id_t

Type of on-disk page identifiers.

Definition at line 2100 of file tpl_file_b_tree.H.

◆ tree_type

template<typename Key , class Compare = Aleph::less<Key>, size_t MinDegree = 16, typename Codec = detail::Paged_Value_Codec<Key>>
using Aleph::Gen_File_B_Tree< Key, Compare, MinDegree, Codec >::tree_type = Gen_B_Tree<Key, Compare, MinDegree>

Logical in-memory counterpart.

Definition at line 2099 of file tpl_file_b_tree.H.

Member Enumeration Documentation

◆ PageKind

template<typename Key , class Compare = Aleph::less<Key>, size_t MinDegree = 16, typename Codec = detail::Paged_Value_Codec<Key>>
enum class Aleph::Gen_File_B_Tree::PageKind : std::uint8_t
strongprivate
Enumerator
Free 
Internal 
Leaf 

Definition at line 187 of file tpl_file_b_tree.H.

Constructor & Destructor Documentation

◆ Gen_File_B_Tree() [1/6]

template<typename Key , class Compare = Aleph::less<Key>, size_t MinDegree = 16, typename Codec = detail::Paged_Value_Codec<Key>>
Aleph::Gen_File_B_Tree< Key, Compare, MinDegree, Codec >::Gen_File_B_Tree ( std::string  file_path,
const bool  auto_sync = true,
const Compare &  cmp = Compare() 
)
inlineexplicit

Open or create a paged persistent B-Tree file for read-write access.

Parameters
file_pathPath to the backing file.
auto_syncIf true, successful mutations flush dirty pages and the header to disk.
cmpComparison functor used to order keys.
Exceptions
std::runtime_errorIf the file cannot be created, opened, read, or validated.
std::bad_allocIf the in-memory page cache cannot be allocated.

Definition at line 2115 of file tpl_file_b_tree.H.

◆ Gen_File_B_Tree() [2/6]

template<typename Key , class Compare = Aleph::less<Key>, size_t MinDegree = 16, typename Codec = detail::Paged_Value_Codec<Key>>
Aleph::Gen_File_B_Tree< Key, Compare, MinDegree, Codec >::Gen_File_B_Tree ( std::string  file_path,
const Paged_File_Open_Mode  open_mode,
const bool  auto_sync = true,
const Compare &  cmp = Compare() 
)
inlineexplicit

Open a paged persistent B-Tree file with an explicit access mode.

Parameters
file_pathPath to the backing file.
open_modeRead_Write to allow mutations and recovery, or Read_Only for shared-lock read access to an already clean file.
auto_syncIf true, successful mutations flush dirty pages and the header to disk. Read-only handles always behave as if this were false.
cmpComparison functor used to order keys.
Exceptions
std::runtime_errorIf the file cannot be created, opened, read, or validated, or if a read-only open would require recovery.
std::bad_allocIf the in-memory page cache cannot be allocated.

Definition at line 2133 of file tpl_file_b_tree.H.

References Aleph::detail::Pid_File_Lock::acquire(), ah_runtime_error_unless, Aleph::Gen_File_B_Tree< Key, Compare, MinDegree, Codec >::create_empty_file(), Aleph::divide_and_conquer_partition_dp(), Aleph::Gen_File_B_Tree< Key, Compare, MinDegree, Codec >::ensure_writable(), Aleph::Gen_File_B_Tree< Key, Compare, MinDegree, Codec >::file_, Aleph::Gen_File_B_Tree< Key, Compare, MinDegree, Codec >::file_exists(), Aleph::Gen_File_B_Tree< Key, Compare, MinDegree, Codec >::file_path_, Aleph::Gen_File_B_Tree< Key, Compare, MinDegree, Codec >::init_sidecar_paths(), Aleph::Gen_File_B_Tree< Key, Compare, MinDegree, Codec >::load_from_disk(), Aleph::Gen_File_B_Tree< Key, Compare, MinDegree, Codec >::lock_, Aleph::Gen_File_B_Tree< Key, Compare, MinDegree, Codec >::lock_mode(), Aleph::Gen_File_B_Tree< Key, Compare, MinDegree, Codec >::lock_path_, Aleph::Gen_File_B_Tree< Key, Compare, MinDegree, Codec >::open_storage(), Aleph::Gen_File_B_Tree< Key, Compare, MinDegree, Codec >::read_only(), Aleph::Gen_File_B_Tree< Key, Compare, MinDegree, Codec >::recover_if_needed(), and Aleph::Gen_File_B_Tree< Key, Compare, MinDegree, Codec >::tree_kind().

◆ Gen_File_B_Tree() [3/6]

template<typename Key , class Compare = Aleph::less<Key>, size_t MinDegree = 16, typename Codec = detail::Paged_Value_Codec<Key>>
Aleph::Gen_File_B_Tree< Key, Compare, MinDegree, Codec >::Gen_File_B_Tree ( const char file_path,
const bool  auto_sync = true,
const Compare &  cmp = Compare() 
)
inlineexplicit

Open or create a paged persistent B-Tree file for read-write access.

Parameters
file_pathPath to the backing file.
auto_syncIf true, successful mutations flush dirty pages and the header to disk.
cmpComparison functor used to order keys.
Exceptions
std::runtime_errorIf the file cannot be created, opened, read, or validated.
std::bad_allocIf the in-memory page cache cannot be allocated.

Definition at line 2183 of file tpl_file_b_tree.H.

◆ Gen_File_B_Tree() [4/6]

template<typename Key , class Compare = Aleph::less<Key>, size_t MinDegree = 16, typename Codec = detail::Paged_Value_Codec<Key>>
Aleph::Gen_File_B_Tree< Key, Compare, MinDegree, Codec >::Gen_File_B_Tree ( const char file_path,
const Paged_File_Open_Mode  open_mode,
const bool  auto_sync = true,
const Compare &  cmp = Compare() 
)
inlineexplicit

Open a paged persistent B-Tree file with an explicit access mode.

Parameters
file_pathPath to the backing file.
open_modeRead_Write to allow mutations and recovery, or Read_Only for shared-lock read access to an already clean file.
auto_syncIf true, successful mutations flush dirty pages and the header to disk. Read-only handles always behave as if this were false.
cmpComparison functor used to order keys.
Exceptions
std::runtime_errorIf the file cannot be created, opened, read, or validated, or if a read-only open would require recovery.
std::bad_allocIf the in-memory page cache cannot be allocated.

Definition at line 2202 of file tpl_file_b_tree.H.

◆ Gen_File_B_Tree() [5/6]

template<typename Key , class Compare = Aleph::less<Key>, size_t MinDegree = 16, typename Codec = detail::Paged_Value_Codec<Key>>
Aleph::Gen_File_B_Tree< Key, Compare, MinDegree, Codec >::Gen_File_B_Tree ( const Gen_File_B_Tree< Key, Compare, MinDegree, Codec > &  )
delete

Copying is disabled.

◆ Gen_File_B_Tree() [6/6]

template<typename Key , class Compare = Aleph::less<Key>, size_t MinDegree = 16, typename Codec = detail::Paged_Value_Codec<Key>>
Aleph::Gen_File_B_Tree< Key, Compare, MinDegree, Codec >::Gen_File_B_Tree ( Gen_File_B_Tree< Key, Compare, MinDegree, Codec > &&  )
delete

Moving is disabled.

◆ ~Gen_File_B_Tree()

template<typename Key , class Compare = Aleph::less<Key>, size_t MinDegree = 16, typename Codec = detail::Paged_Value_Codec<Key>>
Aleph::Gen_File_B_Tree< Key, Compare, MinDegree, Codec >::~Gen_File_B_Tree ( )
inlinenoexcept

Close the backing file.

Exceptions
Nothing.

Definition at line 2225 of file tpl_file_b_tree.H.

References Aleph::Gen_File_B_Tree< Key, Compare, MinDegree, Codec >::file_.

Member Function Documentation

◆ add_key_to_crc()

template<typename Key , class Compare = Aleph::less<Key>, size_t MinDegree = 16, typename Codec = detail::Paged_Value_Codec<Key>>
static std::uint32_t Aleph::Gen_File_B_Tree< Key, Compare, MinDegree, Codec >::add_key_to_crc ( const std::uint32_t  crc,
const Key &  key 
)
inlinestaticprivate

◆ add_native_key_to_crc()

◆ allocate_page()

◆ apply_current_cache_to_storage()

template<typename Key , class Compare = Aleph::less<Key>, size_t MinDegree = 16, typename Codec = detail::Paged_Value_Codec<Key>>
void Aleph::Gen_File_B_Tree< Key, Compare, MinDegree, Codec >::apply_current_cache_to_storage ( const std::uint64_t  checkpoint_sequence) const
inlineprivate

◆ auto_sync_enabled()

template<typename Key , class Compare = Aleph::less<Key>, size_t MinDegree = 16, typename Codec = detail::Paged_Value_Codec<Key>>
bool Aleph::Gen_File_B_Tree< Key, Compare, MinDegree, Codec >::auto_sync_enabled ( ) const
inlinenoexcept

Return whether automatic synchronization is enabled.

Returns
true if successful mutations call sync().
Exceptions
Nothing.

Definition at line 2290 of file tpl_file_b_tree.H.

References Aleph::Gen_File_B_Tree< Key, Compare, MinDegree, Codec >::auto_sync_.

Referenced by Aleph::Gen_File_B_Map< Key, Value, Compare, MinDegree, KeyCodec, ValueCodec >::auto_sync_enabled(), and TEST().

◆ borrow_from_next()

◆ borrow_from_prev()

◆ checkpoint()

template<typename Key , class Compare = Aleph::less<Key>, size_t MinDegree = 16, typename Codec = detail::Paged_Value_Codec<Key>>
void Aleph::Gen_File_B_Tree< Key, Compare, MinDegree, Codec >::checkpoint ( ) const
inline

Synonym for sync().

Exceptions
std::runtime_errorIf the file cannot be written or flushed.

Definition at line 2334 of file tpl_file_b_tree.H.

References Aleph::Gen_File_B_Tree< Key, Compare, MinDegree, Codec >::sync().

Referenced by Aleph::Gen_File_B_Map< Key, Value, Compare, MinDegree, KeyCodec, ValueCodec >::checkpoint(), and TEST().

◆ checkpoint_sequence()

◆ checksummed_header_bytes()

template<typename Key , class Compare = Aleph::less<Key>, size_t MinDegree = 16, typename Codec = detail::Paged_Value_Codec<Key>>
static constexpr size_t Aleph::Gen_File_B_Tree< Key, Compare, MinDegree, Codec >::checksummed_header_bytes ( )
inlinestaticconstexprprivatenoexcept

◆ checksummed_page_bytes()

template<typename Key , class Compare = Aleph::less<Key>, size_t MinDegree = 16, typename Codec = detail::Paged_Value_Codec<Key>>
static constexpr size_t Aleph::Gen_File_B_Tree< Key, Compare, MinDegree, Codec >::checksummed_page_bytes ( )
inlinestaticconstexprprivatenoexcept

◆ clear()

template<typename Key , class Compare = Aleph::less<Key>, size_t MinDegree = 16, typename Codec = detail::Paged_Value_Codec<Key>>
void Aleph::Gen_File_B_Tree< Key, Compare, MinDegree, Codec >::clear ( )
inline

◆ clear_dirty_state()

template<typename Key , class Compare = Aleph::less<Key>, size_t MinDegree = 16, typename Codec = detail::Paged_Value_Codec<Key>>
void Aleph::Gen_File_B_Tree< Key, Compare, MinDegree, Codec >::clear_dirty_state ( ) const
inlineprivatenoexcept

◆ collect_keys()

◆ contains()

◆ create_empty_file()

◆ current_page_offset()

◆ dirty_page_count()

template<typename Key , class Compare = Aleph::less<Key>, size_t MinDegree = 16, typename Codec = detail::Paged_Value_Codec<Key>>
size_t Aleph::Gen_File_B_Tree< Key, Compare, MinDegree, Codec >::dirty_page_count ( ) const
inlineprivatenoexcept

◆ empty()

template<typename Key , class Compare = Aleph::less<Key>, size_t MinDegree = 16, typename Codec = detail::Paged_Value_Codec<Key>>
bool Aleph::Gen_File_B_Tree< Key, Compare, MinDegree, Codec >::empty ( ) const
inlinenoexcept

Return whether the tree has no keys.

Returns
true if empty, otherwise false.
Exceptions
Nothing.

Definition at line 2385 of file tpl_file_b_tree.H.

References Aleph::Gen_File_B_Tree< Key, Compare, MinDegree, Codec >::size_.

Referenced by Aleph::Gen_File_B_Map< Key, Value, Compare, MinDegree, KeyCodec, ValueCodec >::empty(), and Aleph::Gen_File_B_Tree< Key, Compare, MinDegree, Codec >::is_empty().

◆ encoding_marker_for_version()

◆ ensure_child_has_extra()

◆ ensure_legacy_native_format_supported()

template<typename Key , class Compare = Aleph::less<Key>, size_t MinDegree = 16, typename Codec = detail::Paged_Value_Codec<Key>>
static void Aleph::Gen_File_B_Tree< Key, Compare, MinDegree, Codec >::ensure_legacy_native_format_supported ( const std::string &  source_path,
const std::uint32_t  version 
)
inlinestaticprivate

◆ ensure_legacy_native_wal_supported()

template<typename Key , class Compare = Aleph::less<Key>, size_t MinDegree = 16, typename Codec = detail::Paged_Value_Codec<Key>>
static void Aleph::Gen_File_B_Tree< Key, Compare, MinDegree, Codec >::ensure_legacy_native_wal_supported ( const std::string &  source_path,
const std::uint32_t  wal_version 
)
inlinestaticprivate

◆ ensure_parent_dir()

template<typename Key , class Compare = Aleph::less<Key>, size_t MinDegree = 16, typename Codec = detail::Paged_Value_Codec<Key>>
void Aleph::Gen_File_B_Tree< Key, Compare, MinDegree, Codec >::ensure_parent_dir ( ) const
inlineprivate

◆ ensure_writable()

◆ equals()

◆ erase_child_at()

◆ erase_key_at()

◆ file_exists()

◆ file_magic()

◆ file_path()

◆ get_compare()

template<typename Key , class Compare = Aleph::less<Key>, size_t MinDegree = 16, typename Codec = detail::Paged_Value_Codec<Key>>
const Compare & Aleph::Gen_File_B_Tree< Key, Compare, MinDegree, Codec >::get_compare ( ) const
inlinenoexcept

Return the comparison object.

Returns
Constant reference to the comparison functor.
Exceptions
Nothing.

Definition at line 2245 of file tpl_file_b_tree.H.

References Aleph::Gen_File_B_Tree< Key, Compare, MinDegree, Codec >::key_comp().

◆ get_file_path()

template<typename Key , class Compare = Aleph::less<Key>, size_t MinDegree = 16, typename Codec = detail::Paged_Value_Codec<Key>>
const std::string & Aleph::Gen_File_B_Tree< Key, Compare, MinDegree, Codec >::get_file_path ( ) const
inlinenoexcept

Synonym for file_path().

Returns
Constant reference to the file path passed at construction.
Exceptions
Nothing.

Definition at line 2263 of file tpl_file_b_tree.H.

References Aleph::Gen_File_B_Tree< Key, Compare, MinDegree, Codec >::file_path().

◆ has_pending_changes()

template<typename Key , class Compare = Aleph::less<Key>, size_t MinDegree = 16, typename Codec = detail::Paged_Value_Codec<Key>>
bool Aleph::Gen_File_B_Tree< Key, Compare, MinDegree, Codec >::has_pending_changes ( ) const
inlineprivatenoexcept

◆ header_bytes()

template<typename Key , class Compare = Aleph::less<Key>, size_t MinDegree = 16, typename Codec = detail::Paged_Value_Codec<Key>>
static constexpr size_t Aleph::Gen_File_B_Tree< Key, Compare, MinDegree, Codec >::header_bytes ( )
inlinestaticconstexprprivatenoexcept

◆ header_checksum()

◆ header_checksum_v2()

◆ height()

template<typename Key , class Compare = Aleph::less<Key>, size_t MinDegree = 16, typename Codec = detail::Paged_Value_Codec<Key>>
size_t Aleph::Gen_File_B_Tree< Key, Compare, MinDegree, Codec >::height ( ) const
inlinenoexcept

◆ init_empty_cache()

◆ init_sidecar_paths()

◆ insert() [1/2]

template<typename Key , class Compare = Aleph::less<Key>, size_t MinDegree = 16, typename Codec = detail::Paged_Value_Codec<Key>>
bool Aleph::Gen_File_B_Tree< Key, Compare, MinDegree, Codec >::insert ( const Key &  key)
inline

Insert a key if it is not already present.

Parameters
keyKey to insert.
Returns
true if insertion happened, false if it was duplicate.
Exceptions
std::bad_allocIf the page cache grows and allocation fails.
std::runtime_errorIf auto_sync is enabled and flushing fails.
Anyexception propagated by Compare or Key copies.

Definition at line 2463 of file tpl_file_b_tree.H.

References Aleph::Gen_File_B_Tree< Key, Compare, MinDegree, Codec >::allocate_page(), Aleph::Gen_File_B_Tree< Key, Compare, MinDegree, Codec >::Page::child_count, Aleph::Gen_File_B_Tree< Key, Compare, MinDegree, Codec >::Page::children, Aleph::Gen_File_B_Tree< Key, Compare, MinDegree, Codec >::contains(), Aleph::divide_and_conquer_partition_dp(), Aleph::Gen_File_B_Tree< Key, Compare, MinDegree, Codec >::ensure_writable(), Aleph::Gen_File_B_Tree< Key, Compare, MinDegree, Codec >::insert_nonfull(), Aleph::Gen_File_B_Tree< Key, Compare, MinDegree, Codec >::Internal, Aleph::Gen_File_B_Tree< Key, Compare, MinDegree, Codec >::Page::key_count, Aleph::Gen_File_B_Tree< Key, Compare, MinDegree, Codec >::Page::keys, Aleph::Gen_File_B_Tree< Key, Compare, MinDegree, Codec >::Leaf, Aleph::Gen_File_B_Tree< Key, Compare, MinDegree, Codec >::mark_header_dirty(), Aleph::Gen_File_B_Tree< Key, Compare, MinDegree, Codec >::mark_page_dirty(), Aleph::Gen_File_B_Tree< Key, Compare, MinDegree, Codec >::MaxKeys, Aleph::Gen_File_B_Tree< Key, Compare, MinDegree, Codec >::page(), Aleph::Gen_File_B_Tree< Key, Compare, MinDegree, Codec >::root_page_, Aleph::Gen_File_B_Tree< Key, Compare, MinDegree, Codec >::size_, Aleph::Gen_File_B_Tree< Key, Compare, MinDegree, Codec >::split_child(), and Aleph::Gen_File_B_Tree< Key, Compare, MinDegree, Codec >::sync_if_enabled().

Referenced by Aleph::Gen_File_B_Map< Key, Value, Compare, MinDegree, KeyCodec, ValueCodec >::insert(), Aleph::Gen_File_B_Tree< Key, Compare, MinDegree, Codec >::insert(), Aleph::Gen_File_B_Map< Key, Value, Compare, MinDegree, KeyCodec, ValueCodec >::insert_or_assign(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), and TEST().

◆ insert() [2/2]

template<typename Key , class Compare = Aleph::less<Key>, size_t MinDegree = 16, typename Codec = detail::Paged_Value_Codec<Key>>
bool Aleph::Gen_File_B_Tree< Key, Compare, MinDegree, Codec >::insert ( Key &&  key)
inline

Insert a key by move if it is not already present.

Parameters
keyKey to insert.
Returns
true if insertion happened, false if it was duplicate.
Exceptions
std::bad_allocIf the page cache grows and allocation fails.
std::runtime_errorIf auto_sync is enabled and flushing fails.
Anyexception propagated by Compare or Key copies.

Definition at line 2506 of file tpl_file_b_tree.H.

References Aleph::copy(), and Aleph::Gen_File_B_Tree< Key, Compare, MinDegree, Codec >::insert().

◆ insert_child_at()

◆ insert_key_at()

◆ insert_nonfull()

◆ is_empty()

template<typename Key , class Compare = Aleph::less<Key>, size_t MinDegree = 16, typename Codec = detail::Paged_Value_Codec<Key>>
bool Aleph::Gen_File_B_Tree< Key, Compare, MinDegree, Codec >::is_empty ( ) const
inlinenoexcept

Synonym for empty().

Returns
true if empty, otherwise false.
Exceptions
Nothing.

Definition at line 2391 of file tpl_file_b_tree.H.

References Aleph::Gen_File_B_Tree< Key, Compare, MinDegree, Codec >::empty().

◆ is_free()

template<typename Key , class Compare = Aleph::less<Key>, size_t MinDegree = 16, typename Codec = detail::Paged_Value_Codec<Key>>
static constexpr bool Aleph::Gen_File_B_Tree< Key, Compare, MinDegree, Codec >::is_free ( const Page page)
inlinestaticconstexprprivatenoexcept

◆ is_internal()

◆ is_leaf()

template<typename Key , class Compare = Aleph::less<Key>, size_t MinDegree = 16, typename Codec = detail::Paged_Value_Codec<Key>>
static constexpr bool Aleph::Gen_File_B_Tree< Key, Compare, MinDegree, Codec >::is_leaf ( const Page page)
inlinestaticconstexprprivatenoexcept

◆ is_read_only()

template<typename Key , class Compare = Aleph::less<Key>, size_t MinDegree = 16, typename Codec = detail::Paged_Value_Codec<Key>>
bool Aleph::Gen_File_B_Tree< Key, Compare, MinDegree, Codec >::is_read_only ( ) const
inlinenoexcept

Return whether this handle is read-only.

Returns
true if opened in Read_Only mode, otherwise false.
Exceptions
Nothing.

Definition at line 2281 of file tpl_file_b_tree.H.

References Aleph::Gen_File_B_Tree< Key, Compare, MinDegree, Codec >::read_only().

Referenced by Aleph::Gen_File_B_Map< Key, Value, Compare, MinDegree, KeyCodec, ValueCodec >::is_read_only().

◆ key_comp()

template<typename Key , class Compare = Aleph::less<Key>, size_t MinDegree = 16, typename Codec = detail::Paged_Value_Codec<Key>>
const Compare & Aleph::Gen_File_B_Tree< Key, Compare, MinDegree, Codec >::key_comp ( ) const
inlinenoexcept

Return the comparison object.

Returns
Constant reference to the comparison functor.
Note
The comparator is immutable once the tree is persisted; no mutable accessor is provided to prevent callers from replacing the comparator after page splits/merges have been written to disk.
Exceptions
Nothing.

Definition at line 2239 of file tpl_file_b_tree.H.

References Aleph::Gen_File_B_Tree< Key, Compare, MinDegree, Codec >::cmp_.

Referenced by Aleph::Gen_File_B_Map< Key, Value, Compare, MinDegree, KeyCodec, ValueCodec >::equals_key(), Aleph::Gen_File_B_Tree< Key, Compare, MinDegree, Codec >::get_compare(), and Aleph::Gen_File_B_Map< Key, Value, Compare, MinDegree, KeyCodec, ValueCodec >::key_comp().

◆ key_size_for_version()

◆ keys()

◆ legacy_header_bytes()

template<typename Key , class Compare = Aleph::less<Key>, size_t MinDegree = 16, typename Codec = detail::Paged_Value_Codec<Key>>
static constexpr size_t Aleph::Gen_File_B_Tree< Key, Compare, MinDegree, Codec >::legacy_header_bytes ( )
inlinestaticconstexprprivatenoexcept

◆ legacy_page_bytes()

◆ load_from_disk()

◆ lock_mode()

template<typename Key , class Compare = Aleph::less<Key>, size_t MinDegree = 16, typename Codec = detail::Paged_Value_Codec<Key>>
detail::Pid_File_Lock_Mode Aleph::Gen_File_B_Tree< Key, Compare, MinDegree, Codec >::lock_mode ( ) const
inlineprivatenoexcept

◆ lower_bound()

◆ lower_bound_index()

◆ make_page()

◆ mark_header_dirty()

◆ mark_page_dirty()

◆ max_in()

◆ max_key()

template<typename Key , class Compare = Aleph::less<Key>, size_t MinDegree = 16, typename Codec = detail::Paged_Value_Codec<Key>>
std::optional< Key > Aleph::Gen_File_B_Tree< Key, Compare, MinDegree, Codec >::max_key ( ) const
inline

Return the maximum key, if any.

Returns
Largest key in the tree or std::nullopt if empty.
Exceptions
Anyexception propagated by Key copy construction.

Definition at line 2571 of file tpl_file_b_tree.H.

References Aleph::Gen_File_B_Tree< Key, Compare, MinDegree, Codec >::max_in(), and Aleph::Gen_File_B_Tree< Key, Compare, MinDegree, Codec >::root_page_.

Referenced by Aleph::Gen_File_B_Map< Key, Value, Compare, MinDegree, KeyCodec, ValueCodec >::max_item(), and Aleph::Gen_File_B_Tree< Key, Compare, MinDegree, Codec >::verify_node().

◆ merge_children()

◆ min_in()

◆ min_key()

template<typename Key , class Compare = Aleph::less<Key>, size_t MinDegree = 16, typename Codec = detail::Paged_Value_Codec<Key>>
std::optional< Key > Aleph::Gen_File_B_Tree< Key, Compare, MinDegree, Codec >::min_key ( ) const
inline

Return the minimum key, if any.

Returns
Smallest key in the tree or std::nullopt if empty.
Exceptions
Anyexception propagated by Key copy construction.

Definition at line 2562 of file tpl_file_b_tree.H.

References Aleph::Gen_File_B_Tree< Key, Compare, MinDegree, Codec >::min_in(), and Aleph::Gen_File_B_Tree< Key, Compare, MinDegree, Codec >::root_page_.

Referenced by Aleph::Gen_File_B_Map< Key, Value, Compare, MinDegree, KeyCodec, ValueCodec >::min_item(), and Aleph::Gen_File_B_Tree< Key, Compare, MinDegree, Codec >::verify_node().

◆ native_page_bytes()

template<typename Key , class Compare = Aleph::less<Key>, size_t MinDegree = 16, typename Codec = detail::Paged_Value_Codec<Key>>
static constexpr size_t Aleph::Gen_File_B_Tree< Key, Compare, MinDegree, Codec >::native_page_bytes ( )
inlinestaticconstexprprivatenoexcept

◆ open_mode()

template<typename Key , class Compare = Aleph::less<Key>, size_t MinDegree = 16, typename Codec = detail::Paged_Value_Codec<Key>>
Paged_File_Open_Mode Aleph::Gen_File_B_Tree< Key, Compare, MinDegree, Codec >::open_mode ( ) const
inlinenoexcept

Return the access mode used to open the file.

Returns
Read_Write or Read_Only.
Exceptions
Nothing.

Definition at line 2272 of file tpl_file_b_tree.H.

References Aleph::Gen_File_B_Tree< Key, Compare, MinDegree, Codec >::open_mode_.

Referenced by Aleph::Gen_File_B_Map< Key, Value, Compare, MinDegree, KeyCodec, ValueCodec >::open_mode().

◆ open_storage()

◆ operator=() [1/2]

template<typename Key , class Compare = Aleph::less<Key>, size_t MinDegree = 16, typename Codec = detail::Paged_Value_Codec<Key>>
Gen_File_B_Tree & Aleph::Gen_File_B_Tree< Key, Compare, MinDegree, Codec >::operator= ( const Gen_File_B_Tree< Key, Compare, MinDegree, Codec > &  )
delete

Assignment is disabled.

◆ operator=() [2/2]

template<typename Key , class Compare = Aleph::less<Key>, size_t MinDegree = 16, typename Codec = detail::Paged_Value_Codec<Key>>
Gen_File_B_Tree & Aleph::Gen_File_B_Tree< Key, Compare, MinDegree, Codec >::operator= ( Gen_File_B_Tree< Key, Compare, MinDegree, Codec > &&  )
delete

Move assignment is disabled.

◆ page() [1/2]

template<typename Key , class Compare = Aleph::less<Key>, size_t MinDegree = 16, typename Codec = detail::Paged_Value_Codec<Key>>
Page & Aleph::Gen_File_B_Tree< Key, Compare, MinDegree, Codec >::page ( const page_id_t  page_id)
inlineprivate

Definition at line 1651 of file tpl_file_b_tree.H.

References ah_runtime_error_unless, Aleph::and, and Aleph::Gen_File_B_Tree< Key, Compare, MinDegree, Codec >::pages_.

Referenced by Aleph::Gen_File_B_Tree< Key, Compare, MinDegree, Codec >::allocate_page(), Aleph::Gen_File_B_Tree< Key, Compare, MinDegree, Codec >::apply_current_cache_to_storage(), Aleph::Gen_File_B_Tree< Key, Compare, MinDegree, Codec >::borrow_from_next(), Aleph::Gen_File_B_Tree< Key, Compare, MinDegree, Codec >::borrow_from_prev(), Aleph::Gen_File_B_Tree< Key, Compare, MinDegree, Codec >::collect_keys(), Aleph::Gen_File_B_Tree< Key, Compare, MinDegree, Codec >::contains(), Aleph::Gen_File_B_Tree< Key, Compare, MinDegree, Codec >::ensure_child_has_extra(), Aleph::Gen_File_B_Tree< Key, Compare, MinDegree, Codec >::erase_child_at(), Aleph::Gen_File_B_Tree< Key, Compare, MinDegree, Codec >::erase_key_at(), Aleph::Gen_File_B_Tree< Key, Compare, MinDegree, Codec >::height(), Aleph::Gen_File_B_Tree< Key, Compare, MinDegree, Codec >::insert(), Aleph::Gen_File_B_Tree< Key, Compare, MinDegree, Codec >::insert_child_at(), Aleph::Gen_File_B_Tree< Key, Compare, MinDegree, Codec >::insert_key_at(), Aleph::Gen_File_B_Tree< Key, Compare, MinDegree, Codec >::insert_nonfull(), Aleph::Gen_File_B_Tree< Key, Compare, MinDegree, Codec >::is_free(), Aleph::Gen_File_B_Tree< Key, Compare, MinDegree, Codec >::is_internal(), Aleph::Gen_File_B_Tree< Key, Compare, MinDegree, Codec >::is_leaf(), Aleph::Gen_File_B_Tree< Key, Compare, MinDegree, Codec >::lower_bound(), Aleph::Gen_File_B_Tree< Key, Compare, MinDegree, Codec >::lower_bound_index(), Aleph::Gen_File_B_Tree< Key, Compare, MinDegree, Codec >::make_page(), Aleph::Gen_File_B_Tree< Key, Compare, MinDegree, Codec >::mark_page_dirty(), Aleph::Gen_File_B_Tree< Key, Compare, MinDegree, Codec >::max_in(), Aleph::Gen_File_B_Tree< Key, Compare, MinDegree, Codec >::merge_children(), Aleph::Gen_File_B_Tree< Key, Compare, MinDegree, Codec >::min_in(), Aleph::Gen_File_B_Tree< Key, Compare, MinDegree, Codec >::page_checksum(), Aleph::Gen_File_B_Tree< Key, Compare, MinDegree, Codec >::page_checksum_v3(), Aleph::Gen_File_B_Tree< Key, Compare, MinDegree, Codec >::page_checksum_v4(), Aleph::Gen_File_B_Tree< Key, Compare, MinDegree, Codec >::read_page_from_stream(), Aleph::Gen_File_B_Tree< Key, Compare, MinDegree, Codec >::recover_from_wal(), Aleph::Gen_File_B_Tree< Key, Compare, MinDegree, Codec >::release_page(), Aleph::Gen_File_B_Tree< Key, Compare, MinDegree, Codec >::remove(), Aleph::Gen_File_B_Tree< Key, Compare, MinDegree, Codec >::remove_from(), Aleph::Gen_File_B_Tree< Key, Compare, MinDegree, Codec >::split_child(), Aleph::Gen_File_B_Tree< Key, Compare, MinDegree, Codec >::stamp_all_pages_for_checkpoint(), Aleph::Gen_File_B_Tree< Key, Compare, MinDegree, Codec >::strictly_sorted(), Aleph::Gen_File_B_Tree< Key, Compare, MinDegree, Codec >::upper_bound(), Aleph::Gen_File_B_Tree< Key, Compare, MinDegree, Codec >::upper_bound_index(), Aleph::Gen_File_B_Tree< Key, Compare, MinDegree, Codec >::verify_node(), Aleph::Gen_File_B_Tree< Key, Compare, MinDegree, Codec >::wal_record_checksum_add(), Aleph::Gen_File_B_Tree< Key, Compare, MinDegree, Codec >::wal_record_checksum_add_v2(), Aleph::Gen_File_B_Tree< Key, Compare, MinDegree, Codec >::wal_record_checksum_add_v3(), Aleph::Gen_File_B_Tree< Key, Compare, MinDegree, Codec >::write_current_page_to_storage(), Aleph::Gen_File_B_Tree< Key, Compare, MinDegree, Codec >::write_full_image(), Aleph::Gen_File_B_Tree< Key, Compare, MinDegree, Codec >::write_page_record(), and Aleph::Gen_File_B_Tree< Key, Compare, MinDegree, Codec >::write_wal_to_path().

◆ page() [2/2]

template<typename Key , class Compare = Aleph::less<Key>, size_t MinDegree = 16, typename Codec = detail::Paged_Value_Codec<Key>>
const Page & Aleph::Gen_File_B_Tree< Key, Compare, MinDegree, Codec >::page ( const page_id_t  page_id) const
inlineprivate

◆ page_bytes()

◆ page_checksum()

◆ page_checksum_v3()

◆ page_checksum_v4()

◆ page_count()

◆ page_size_bytes()

template<typename Key , class Compare = Aleph::less<Key>, size_t MinDegree = 16, typename Codec = detail::Paged_Value_Codec<Key>>
size_t Aleph::Gen_File_B_Tree< Key, Compare, MinDegree, Codec >::page_size_bytes ( ) const
inlinenoexcept

Return the fixed serialized page size.

Returns
Number of bytes used by each page record in the file.
Exceptions
Nothing.

Definition at line 2308 of file tpl_file_b_tree.H.

References Aleph::Gen_File_B_Tree< Key, Compare, MinDegree, Codec >::page_bytes().

Referenced by Aleph::Gen_File_B_Map< Key, Value, Compare, MinDegree, KeyCodec, ValueCodec >::page_size_bytes().

◆ portable_page_bytes()

template<typename Key , class Compare = Aleph::less<Key>, size_t MinDegree = 16, typename Codec = detail::Paged_Value_Codec<Key>>
static constexpr size_t Aleph::Gen_File_B_Tree< Key, Compare, MinDegree, Codec >::portable_page_bytes ( )
inlinestaticconstexprprivatenoexcept

◆ read_image()

template<typename Key , class Compare = Aleph::less<Key>, size_t MinDegree = 16, typename Codec = detail::Paged_Value_Codec<Key>>
Loaded_Image Aleph::Gen_File_B_Tree< Key, Compare, MinDegree, Codec >::read_image ( const std::string &  source_path) const
inlineprivate

Definition at line 1401 of file tpl_file_b_tree.H.

References ah_runtime_error_unless, Aleph::Gen_File_B_Tree< Key, Compare, MinDegree, Codec >::ChecksummedFormatVersion, Aleph::divide_and_conquer_partition_dp(), Aleph::Gen_File_B_Tree< Key, Compare, MinDegree, Codec >::encoding_marker_for_version(), Aleph::Gen_File_B_Tree< Key, Compare, MinDegree, Codec >::ensure_legacy_native_format_supported(), Aleph::Gen_File_B_Tree< Key, Compare, MinDegree, Codec >::file_magic(), Aleph::Gen_File_B_Tree< Key, Compare, MinDegree, Codec >::FormatVersion, Aleph::Gen_File_B_Tree< Key, Compare, MinDegree, Codec >::header_checksum(), Aleph::Gen_File_B_Tree< Key, Compare, MinDegree, Codec >::header_checksum_v2(), Aleph::Gen_File_B_Tree< Key, Compare, MinDegree, Codec >::HeaderCheckpointFormatVersion, Aleph::Gen_File_B_Tree< Key, Compare, MinDegree, Codec >::key_size_for_version(), Aleph::Gen_File_B_Tree< Key, Compare, MinDegree, Codec >::LegacyFormatVersion, Aleph::Gen_File_B_Tree< Key, Compare, MinDegree, Codec >::NativeCheckpointFormatVersion, Aleph::Gen_File_B_Tree< Key, Compare, MinDegree, Codec >::page_count(), Aleph::Gen_File_B_Tree< Key, Compare, MinDegree, Codec >::PortableFormatVersion, Aleph::Gen_File_B_Tree< Key, Compare, MinDegree, Codec >::read_page_from_stream(), Aleph::Gen_File_B_Tree< Key, Compare, MinDegree, Codec >::reserved_bytes_for_version(), Aleph::Gen_File_B_Tree< Key, Compare, MinDegree, Codec >::serialized_header_bytes(), Aleph::Gen_File_B_Tree< Key, Compare, MinDegree, Codec >::serialized_page_bytes(), and Aleph::Gen_File_B_Tree< Key, Compare, MinDegree, Codec >::Loaded_Image::version.

Referenced by Aleph::Gen_File_B_Tree< Key, Compare, MinDegree, Codec >::load_from_disk(), Aleph::Gen_File_B_Tree< Key, Compare, MinDegree, Codec >::recover_from_wal(), and Aleph::Gen_File_B_Tree< Key, Compare, MinDegree, Codec >::recover_if_needed().

◆ read_key()

◆ read_native_key()

template<typename Key , class Compare = Aleph::less<Key>, size_t MinDegree = 16, typename Codec = detail::Paged_Value_Codec<Key>>
static Key Aleph::Gen_File_B_Tree< Key, Compare, MinDegree, Codec >::read_native_key ( std::istream &  in,
const std::string &  file_path,
const char what 
)
inlinestaticprivate

◆ read_only()

◆ read_page_from_stream()

template<typename Key , class Compare = Aleph::less<Key>, size_t MinDegree = 16, typename Codec = detail::Paged_Value_Codec<Key>>
static Page Aleph::Gen_File_B_Tree< Key, Compare, MinDegree, Codec >::read_page_from_stream ( std::istream &  in,
const std::string &  path,
const std::uint32_t  version 
)
inlinestaticprivate

Definition at line 1008 of file tpl_file_b_tree.H.

References ah_runtime_error_unless, Aleph::Gen_File_B_Tree< Key, Compare, MinDegree, Codec >::Page::checkpoint_sequence, Aleph::Gen_File_B_Tree< Key, Compare, MinDegree, Codec >::Page::child_count, Aleph::Gen_File_B_Tree< Key, Compare, MinDegree, Codec >::Page::children, Aleph::divide_and_conquer_partition_dp(), Aleph::Gen_File_B_Tree< Key, Compare, MinDegree, Codec >::HeaderCheckpointFormatVersion, Aleph::Gen_File_B_Tree< Key, Compare, MinDegree, Codec >::Page::key_count, Aleph::Gen_File_B_Tree< Key, Compare, MinDegree, Codec >::Page::keys, Aleph::Gen_File_B_Tree< Key, Compare, MinDegree, Codec >::Page::kind, Aleph::Gen_File_B_Tree< Key, Compare, MinDegree, Codec >::Page::link, Aleph::Gen_File_B_Tree< Key, Compare, MinDegree, Codec >::MaxChildren, Aleph::Gen_File_B_Tree< Key, Compare, MinDegree, Codec >::MaxKeys, Aleph::Gen_File_B_Tree< Key, Compare, MinDegree, Codec >::NativeCheckpointFormatVersion, Aleph::Gen_File_B_Tree< Key, Compare, MinDegree, Codec >::page(), Aleph::Gen_File_B_Tree< Key, Compare, MinDegree, Codec >::page_checksum(), Aleph::Gen_File_B_Tree< Key, Compare, MinDegree, Codec >::page_checksum_v3(), Aleph::Gen_File_B_Tree< Key, Compare, MinDegree, Codec >::page_checksum_v4(), Aleph::Gen_File_B_Tree< Key, Compare, MinDegree, Codec >::PortableFormatVersion, and Aleph::Gen_File_B_Tree< Key, Compare, MinDegree, Codec >::read_key().

Referenced by Aleph::Gen_File_B_Tree< Key, Compare, MinDegree, Codec >::read_image(), Aleph::Gen_File_B_Tree< Key, Compare, MinDegree, Codec >::read_storage_page_if_current(), and Aleph::Gen_File_B_Tree< Key, Compare, MinDegree, Codec >::recover_from_wal().

◆ read_pod()

template<typename Key , class Compare = Aleph::less<Key>, size_t MinDegree = 16, typename Codec = detail::Paged_Value_Codec<Key>>
template<typename T >
static T Aleph::Gen_File_B_Tree< Key, Compare, MinDegree, Codec >::read_pod ( std::istream &  in,
const std::string &  file_path,
const char what 
)
inlinestaticprivate

◆ read_portable_key()

template<typename Key , class Compare = Aleph::less<Key>, size_t MinDegree = 16, typename Codec = detail::Paged_Value_Codec<Key>>
static Key Aleph::Gen_File_B_Tree< Key, Compare, MinDegree, Codec >::read_portable_key ( std::istream &  in,
const std::string &  file_path,
const char what 
)
inlinestaticprivate

◆ read_storage_page_if_current()

◆ recover_from_wal()

template<typename Key , class Compare = Aleph::less<Key>, size_t MinDegree = 16, typename Codec = detail::Paged_Value_Codec<Key>>
void Aleph::Gen_File_B_Tree< Key, Compare, MinDegree, Codec >::recover_from_wal ( )
inlineprivate

Definition at line 1148 of file tpl_file_b_tree.H.

References ah_runtime_error_unless, Aleph::and, Aleph::Gen_File_B_Tree< Key, Compare, MinDegree, Codec >::checkpoint_sequence_, Aleph::Gen_File_B_Tree< Key, Compare, MinDegree, Codec >::CommitTrailerWalVersion, Aleph::detail::crc32_begin(), Aleph::detail::crc32_finish(), Aleph::divide_and_conquer_partition_dp(), Aleph::Gen_File_B_Tree< Key, Compare, MinDegree, Codec >::encoding_marker_for_version(), Aleph::Gen_File_B_Tree< Key, Compare, MinDegree, Codec >::ensure_legacy_native_wal_supported(), Aleph::Gen_File_B_Tree< Key, Compare, MinDegree, Codec >::file_, Aleph::Gen_File_B_Tree< Key, Compare, MinDegree, Codec >::file_exists(), Aleph::Gen_File_B_Tree< Key, Compare, MinDegree, Codec >::file_path_, Aleph::Gen_File_B_Tree< Key, Compare, MinDegree, Codec >::FormatVersion, Aleph::Gen_File_B_Tree< Key, Compare, MinDegree, Codec >::key_size_for_version(), Aleph::Gen_File_B_Tree< Key, Compare, MinDegree, Codec >::LegacyWalVersion, Aleph::Gen_File_B_Tree< Key, Compare, MinDegree, Codec >::NativeWalVersion, Aleph::Gen_File_B_Tree< Key, Compare, MinDegree, Codec >::open_storage(), Aleph::Gen_File_B_Tree< Key, Compare, MinDegree, Codec >::page(), Aleph::Gen_File_B_Tree< Key, Compare, MinDegree, Codec >::PortableWalVersion, Aleph::Gen_File_B_Tree< Key, Compare, MinDegree, Codec >::read_image(), Aleph::Gen_File_B_Tree< Key, Compare, MinDegree, Codec >::read_only(), Aleph::Gen_File_B_Tree< Key, Compare, MinDegree, Codec >::read_page_from_stream(), Aleph::Gen_File_B_Tree< Key, Compare, MinDegree, Codec >::read_storage_page_if_current(), Aleph::detail::remove_file_if_exists(), Aleph::Gen_File_B_Tree< Key, Compare, MinDegree, Codec >::reserved_bytes_for_version(), Aleph::Gen_File_B_Tree< Key, Compare, MinDegree, Codec >::storage_format_version_, Aleph::Gen_File_B_Tree< Key, Compare, MinDegree, Codec >::storage_format_version_on_disk(), Aleph::detail::sync_file_by_path(), Aleph::Gen_File_B_Tree< Key, Compare, MinDegree, Codec >::tree_kind(), Aleph::Gen_File_B_Tree< Key, Compare, MinDegree, Codec >::wal_header_bytes(), Aleph::Gen_File_B_Tree< Key, Compare, MinDegree, Codec >::wal_header_checksum(), Aleph::Gen_File_B_Tree< Key, Compare, MinDegree, Codec >::wal_magic(), Aleph::Gen_File_B_Tree< Key, Compare, MinDegree, Codec >::wal_path_, Aleph::Gen_File_B_Tree< Key, Compare, MinDegree, Codec >::wal_record_bytes(), Aleph::Gen_File_B_Tree< Key, Compare, MinDegree, Codec >::wal_record_checksum_add(), Aleph::Gen_File_B_Tree< Key, Compare, MinDegree, Codec >::wal_record_checksum_add_v2(), Aleph::Gen_File_B_Tree< Key, Compare, MinDegree, Codec >::wal_record_checksum_add_v3(), Aleph::Gen_File_B_Tree< Key, Compare, MinDegree, Codec >::wal_record_format_version(), Aleph::Gen_File_B_Tree< Key, Compare, MinDegree, Codec >::wal_tmp_path_, Aleph::Gen_File_B_Tree< Key, Compare, MinDegree, Codec >::wal_trailer_bytes(), Aleph::Gen_File_B_Tree< Key, Compare, MinDegree, Codec >::wal_trailer_magic(), Aleph::Gen_File_B_Tree< Key, Compare, MinDegree, Codec >::WalVersion, Aleph::Gen_File_B_Tree< Key, Compare, MinDegree, Codec >::write_current_page_to_storage(), and Aleph::Gen_File_B_Tree< Key, Compare, MinDegree, Codec >::write_header_to_storage().

Referenced by Aleph::Gen_File_B_Tree< Key, Compare, MinDegree, Codec >::recover_if_needed().

◆ recover_if_needed()

◆ release_page()

◆ reload()

template<typename Key , class Compare = Aleph::less<Key>, size_t MinDegree = 16, typename Codec = detail::Paged_Value_Codec<Key>>
void Aleph::Gen_File_B_Tree< Key, Compare, MinDegree, Codec >::reload ( )
inline

◆ remove()

template<typename Key , class Compare = Aleph::less<Key>, size_t MinDegree = 16, typename Codec = detail::Paged_Value_Codec<Key>>
bool Aleph::Gen_File_B_Tree< Key, Compare, MinDegree, Codec >::remove ( const Key &  key)
inline

◆ remove_from()

template<typename Key , class Compare = Aleph::less<Key>, size_t MinDegree = 16, typename Codec = detail::Paged_Value_Codec<Key>>
bool Aleph::Gen_File_B_Tree< Key, Compare, MinDegree, Codec >::remove_from ( const page_id_t  page_id,
const Key &  key 
)
inlineprivate

◆ reserved_bytes_for_version()

◆ search()

template<typename Key , class Compare = Aleph::less<Key>, size_t MinDegree = 16, typename Codec = detail::Paged_Value_Codec<Key>>
bool Aleph::Gen_File_B_Tree< Key, Compare, MinDegree, Codec >::search ( const Key &  key) const
inline

Synonym for contains().

Parameters
keyKey to search.
Returns
true if the key exists, otherwise false.
Exceptions
Anyexception propagated by Compare.

Definition at line 2451 of file tpl_file_b_tree.H.

References Aleph::Gen_File_B_Tree< Key, Compare, MinDegree, Codec >::contains().

◆ seekp_to()

◆ serialized_header_bytes()

◆ serialized_page_bytes()

◆ set_auto_sync()

template<typename Key , class Compare = Aleph::less<Key>, size_t MinDegree = 16, typename Codec = detail::Paged_Value_Codec<Key>>
void Aleph::Gen_File_B_Tree< Key, Compare, MinDegree, Codec >::set_auto_sync ( const bool  enabled)
inlinenoexcept

◆ size()

◆ split_child()

◆ stamp_all_pages_for_checkpoint()

◆ storage_format_version_on_disk()

◆ strictly_sorted()

◆ sync()

template<typename Key , class Compare = Aleph::less<Key>, size_t MinDegree = 16, typename Codec = detail::Paged_Value_Codec<Key>>
void Aleph::Gen_File_B_Tree< Key, Compare, MinDegree, Codec >::sync ( ) const
inline

Flush the current tree image using redo WAL or full-image fallback.

Exceptions
std::runtime_errorIf the file cannot be written or flushed.

Definition at line 2342 of file tpl_file_b_tree.H.

References Aleph::and, Aleph::Gen_File_B_Tree< Key, Compare, MinDegree, Codec >::apply_current_cache_to_storage(), Aleph::Gen_File_B_Tree< Key, Compare, MinDegree, Codec >::checkpoint_sequence_, Aleph::Gen_File_B_Tree< Key, Compare, MinDegree, Codec >::clear_dirty_state(), Aleph::divide_and_conquer_partition_dp(), Aleph::Gen_File_B_Tree< Key, Compare, MinDegree, Codec >::ensure_writable(), Aleph::Gen_File_B_Tree< Key, Compare, MinDegree, Codec >::file_exists(), Aleph::Gen_File_B_Tree< Key, Compare, MinDegree, Codec >::FormatVersion, Aleph::Gen_File_B_Tree< Key, Compare, MinDegree, Codec >::has_pending_changes(), Aleph::Gen_File_B_Tree< Key, Compare, MinDegree, Codec >::journal_path_, Aleph::Gen_File_B_Tree< Key, Compare, MinDegree, Codec >::journal_tmp_path_, Aleph::detail::remove_file_if_exists(), Aleph::detail::rename_file_atomic(), Aleph::Gen_File_B_Tree< Key, Compare, MinDegree, Codec >::stamp_all_pages_for_checkpoint(), Aleph::Gen_File_B_Tree< Key, Compare, MinDegree, Codec >::storage_format_version_, Aleph::Gen_File_B_Tree< Key, Compare, MinDegree, Codec >::tree_kind(), Aleph::Gen_File_B_Tree< Key, Compare, MinDegree, Codec >::wal_path_, Aleph::Gen_File_B_Tree< Key, Compare, MinDegree, Codec >::wal_tmp_path_, Aleph::Gen_File_B_Tree< Key, Compare, MinDegree, Codec >::write_full_image_to_path(), and Aleph::Gen_File_B_Tree< Key, Compare, MinDegree, Codec >::write_wal_to_path().

Referenced by Aleph::Gen_File_B_Tree< Key, Compare, MinDegree, Codec >::checkpoint(), Aleph::Gen_File_B_Tree< Key, Compare, MinDegree, Codec >::create_empty_file(), Aleph::Gen_File_B_Map< Key, Value, Compare, MinDegree, KeyCodec, ValueCodec >::sync(), Aleph::Gen_File_B_Tree< Key, Compare, MinDegree, Codec >::sync_if_enabled(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), and TEST().

◆ sync_if_enabled()

◆ tree_kind()

◆ upper_bound()

template<typename Key , class Compare = Aleph::less<Key>, size_t MinDegree = 16, typename Codec = detail::Paged_Value_Codec<Key>>
std::optional< Key > Aleph::Gen_File_B_Tree< Key, Compare, MinDegree, Codec >::upper_bound ( const Key &  key) const
inline

◆ upper_bound_index()

◆ verify()

template<typename Key , class Compare = Aleph::less<Key>, size_t MinDegree = 16, typename Codec = detail::Paged_Value_Codec<Key>>
bool Aleph::Gen_File_B_Tree< Key, Compare, MinDegree, Codec >::verify ( ) const
inline

◆ verify_node()

template<typename Key , class Compare = Aleph::less<Key>, size_t MinDegree = 16, typename Codec = detail::Paged_Value_Codec<Key>>
bool Aleph::Gen_File_B_Tree< Key, Compare, MinDegree, Codec >::verify_node ( const page_id_t  page_id,
const std::optional< Key > &  min_key,
const std::optional< Key > &  max_key,
const size_t  depth,
size_t &  leaf_depth,
size_t &  counted,
Array< unsigned char > &  visited 
) const
inlineprivate

◆ version_uses_portable_codec()

◆ wal_header_bytes()

template<typename Key , class Compare = Aleph::less<Key>, size_t MinDegree = 16, typename Codec = detail::Paged_Value_Codec<Key>>
static constexpr size_t Aleph::Gen_File_B_Tree< Key, Compare, MinDegree, Codec >::wal_header_bytes ( )
inlinestaticconstexprprivatenoexcept

◆ wal_header_checksum()

◆ wal_magic()

template<typename Key , class Compare = Aleph::less<Key>, size_t MinDegree = 16, typename Codec = detail::Paged_Value_Codec<Key>>
static constexpr auto Aleph::Gen_File_B_Tree< Key, Compare, MinDegree, Codec >::wal_magic ( )
inlinestaticconstexprprivatenoexcept

◆ wal_record_bytes()

template<typename Key , class Compare = Aleph::less<Key>, size_t MinDegree = 16, typename Codec = detail::Paged_Value_Codec<Key>>
static constexpr size_t Aleph::Gen_File_B_Tree< Key, Compare, MinDegree, Codec >::wal_record_bytes ( const std::uint32_t  wal_version)
inlinestaticconstexprprivatenoexcept

◆ wal_record_checksum_add()

◆ wal_record_checksum_add_v2()

◆ wal_record_checksum_add_v3()

◆ wal_record_format_version()

◆ wal_trailer_bytes()

template<typename Key , class Compare = Aleph::less<Key>, size_t MinDegree = 16, typename Codec = detail::Paged_Value_Codec<Key>>
static constexpr size_t Aleph::Gen_File_B_Tree< Key, Compare, MinDegree, Codec >::wal_trailer_bytes ( )
inlinestaticconstexprprivatenoexcept

◆ wal_trailer_magic()

template<typename Key , class Compare = Aleph::less<Key>, size_t MinDegree = 16, typename Codec = detail::Paged_Value_Codec<Key>>
static constexpr auto Aleph::Gen_File_B_Tree< Key, Compare, MinDegree, Codec >::wal_trailer_magic ( )
inlinestaticconstexprprivatenoexcept

◆ write_current_header_to_storage()

◆ write_current_page_to_storage()

◆ write_full_image()

template<typename Key , class Compare = Aleph::less<Key>, size_t MinDegree = 16, typename Codec = detail::Paged_Value_Codec<Key>>
void Aleph::Gen_File_B_Tree< Key, Compare, MinDegree, Codec >::write_full_image ( std::ostream &  out,
const std::string &  target_path,
const std::uint64_t  checkpoint_sequence 
) const
inlineprivate

◆ write_full_image_to_path()

◆ write_header_to_storage()

template<typename Key , class Compare = Aleph::less<Key>, size_t MinDegree = 16, typename Codec = detail::Paged_Value_Codec<Key>>
void Aleph::Gen_File_B_Tree< Key, Compare, MinDegree, Codec >::write_header_to_storage ( const std::uint64_t  size,
const page_id_t  root_page,
const std::uint64_t  page_count,
const page_id_t  free_page_head,
const std::uint64_t  checkpoint_sequence 
) const
inlineprivate

◆ write_key()

template<typename Key , class Compare = Aleph::less<Key>, size_t MinDegree = 16, typename Codec = detail::Paged_Value_Codec<Key>>
static void Aleph::Gen_File_B_Tree< Key, Compare, MinDegree, Codec >::write_key ( std::ostream &  out,
const Key &  key,
const std::string &  file_path,
const char what 
)
inlinestaticprivate

◆ write_native_key()

template<typename Key , class Compare = Aleph::less<Key>, size_t MinDegree = 16, typename Codec = detail::Paged_Value_Codec<Key>>
static void Aleph::Gen_File_B_Tree< Key, Compare, MinDegree, Codec >::write_native_key ( std::ostream &  out,
const Key &  key,
const std::string &  file_path,
const char what 
)
inlinestaticprivate

◆ write_page_record()

template<typename Key , class Compare = Aleph::less<Key>, size_t MinDegree = 16, typename Codec = detail::Paged_Value_Codec<Key>>
static void Aleph::Gen_File_B_Tree< Key, Compare, MinDegree, Codec >::write_page_record ( std::ostream &  out,
const Page page,
const std::string &  target_path 
)
inlinestaticprivate

◆ write_pod()

◆ write_portable_key()

template<typename Key , class Compare = Aleph::less<Key>, size_t MinDegree = 16, typename Codec = detail::Paged_Value_Codec<Key>>
static void Aleph::Gen_File_B_Tree< Key, Compare, MinDegree, Codec >::write_portable_key ( std::ostream &  out,
const Key &  key,
const std::string &  file_path,
const char what 
)
inlinestaticprivate

◆ write_wal_to_path()

template<typename Key , class Compare = Aleph::less<Key>, size_t MinDegree = 16, typename Codec = detail::Paged_Value_Codec<Key>>
void Aleph::Gen_File_B_Tree< Key, Compare, MinDegree, Codec >::write_wal_to_path ( const std::string &  target_path,
const std::uint64_t  checkpoint_sequence 
) const
inlineprivate

Definition at line 937 of file tpl_file_b_tree.H.

References ah_runtime_error_unless, Aleph::Gen_File_B_Tree< Key, Compare, MinDegree, Codec >::checkpoint_sequence(), Aleph::detail::crc32_begin(), Aleph::detail::crc32_finish(), Aleph::Gen_File_B_Tree< Key, Compare, MinDegree, Codec >::dirty_page_count(), Aleph::Gen_File_B_Tree< Key, Compare, MinDegree, Codec >::dirty_pages_, Aleph::divide_and_conquer_partition_dp(), Aleph::Gen_File_B_Tree< Key, Compare, MinDegree, Codec >::encoding_marker_for_version(), Aleph::Gen_File_B_Tree< Key, Compare, MinDegree, Codec >::FormatVersion, Aleph::Gen_File_B_Tree< Key, Compare, MinDegree, Codec >::free_page_head_, Aleph::Gen_File_B_Tree< Key, Compare, MinDegree, Codec >::key_size_for_version(), Aleph::Gen_File_B_Tree< Key, Compare, MinDegree, Codec >::page(), Aleph::Gen_File_B_Tree< Key, Compare, MinDegree, Codec >::page_count(), Aleph::Gen_File_B_Tree< Key, Compare, MinDegree, Codec >::pages_, Aleph::Gen_File_B_Tree< Key, Compare, MinDegree, Codec >::reserved_bytes_for_version(), Aleph::Gen_File_B_Tree< Key, Compare, MinDegree, Codec >::root_page_, Aleph::Array< T >::size(), Aleph::Gen_File_B_Tree< Key, Compare, MinDegree, Codec >::size(), Aleph::Gen_File_B_Tree< Key, Compare, MinDegree, Codec >::size_, Aleph::detail::sync_file_by_path(), Aleph::detail::sync_parent_directory(), Aleph::Gen_File_B_Tree< Key, Compare, MinDegree, Codec >::tree_kind(), Aleph::Gen_File_B_Tree< Key, Compare, MinDegree, Codec >::wal_header_checksum(), Aleph::Gen_File_B_Tree< Key, Compare, MinDegree, Codec >::wal_magic(), Aleph::Gen_File_B_Tree< Key, Compare, MinDegree, Codec >::wal_record_checksum_add(), Aleph::Gen_File_B_Tree< Key, Compare, MinDegree, Codec >::wal_trailer_magic(), Aleph::Gen_File_B_Tree< Key, Compare, MinDegree, Codec >::WalVersion, Aleph::Gen_File_B_Tree< Key, Compare, MinDegree, Codec >::write_page_record(), and Aleph::Gen_File_B_Tree< Key, Compare, MinDegree, Codec >::write_pod().

Referenced by Aleph::Gen_File_B_Tree< Key, Compare, MinDegree, Codec >::sync().

Member Data Documentation

◆ auto_sync_

◆ checkpoint_sequence_

◆ ChecksummedFormatVersion

template<typename Key , class Compare = Aleph::less<Key>, size_t MinDegree = 16, typename Codec = detail::Paged_Value_Codec<Key>>
constexpr std::uint32_t Aleph::Gen_File_B_Tree< Key, Compare, MinDegree, Codec >::ChecksummedFormatVersion = 2
staticconstexprprivate

◆ cmp_

◆ CommitTrailerWalVersion

template<typename Key , class Compare = Aleph::less<Key>, size_t MinDegree = 16, typename Codec = detail::Paged_Value_Codec<Key>>
constexpr std::uint32_t Aleph::Gen_File_B_Tree< Key, Compare, MinDegree, Codec >::CommitTrailerWalVersion = 2
staticconstexprprivate

◆ dirty_pages_

◆ EncodedKeySize

template<typename Key , class Compare = Aleph::less<Key>, size_t MinDegree = 16, typename Codec = detail::Paged_Value_Codec<Key>>
constexpr std::uint32_t Aleph::Gen_File_B_Tree< Key, Compare, MinDegree, Codec >::EncodedKeySize
staticconstexprprivate
Initial value:
=
static_cast<std::uint32_t>(Codec::encoded_size)

Definition at line 179 of file tpl_file_b_tree.H.

Referenced by Aleph::Gen_File_B_Tree< Key, Compare, MinDegree, Codec >::key_size_for_version().

◆ EndianMarker

template<typename Key , class Compare = Aleph::less<Key>, size_t MinDegree = 16, typename Codec = detail::Paged_Value_Codec<Key>>
constexpr std::uint8_t Aleph::Gen_File_B_Tree< Key, Compare, MinDegree, Codec >::EndianMarker
staticconstexprprivate
Initial value:
=
std::endian::native == std::endian::little ? 1 : 2

Definition at line 182 of file tpl_file_b_tree.H.

Referenced by Aleph::Gen_File_B_Tree< Key, Compare, MinDegree, Codec >::encoding_marker_for_version().

◆ file_

◆ file_path_

template<typename Key , class Compare = Aleph::less<Key>, size_t MinDegree = 16, typename Codec = detail::Paged_Value_Codec<Key>>
std::string Aleph::Gen_File_B_Tree< Key, Compare, MinDegree, Codec >::file_path_
private

◆ FormatVersion

◆ free_page_head_

◆ header_dirty_

◆ HeaderCheckpointFormatVersion

◆ journal_path_

template<typename Key , class Compare = Aleph::less<Key>, size_t MinDegree = 16, typename Codec = detail::Paged_Value_Codec<Key>>
std::string Aleph::Gen_File_B_Tree< Key, Compare, MinDegree, Codec >::journal_path_
private

◆ journal_tmp_path_

template<typename Key , class Compare = Aleph::less<Key>, size_t MinDegree = 16, typename Codec = detail::Paged_Value_Codec<Key>>
std::string Aleph::Gen_File_B_Tree< Key, Compare, MinDegree, Codec >::journal_tmp_path_
private

◆ LegacyFormatVersion

template<typename Key , class Compare = Aleph::less<Key>, size_t MinDegree = 16, typename Codec = detail::Paged_Value_Codec<Key>>
constexpr std::uint32_t Aleph::Gen_File_B_Tree< Key, Compare, MinDegree, Codec >::LegacyFormatVersion = 1
staticconstexprprivate

◆ LegacyWalVersion

template<typename Key , class Compare = Aleph::less<Key>, size_t MinDegree = 16, typename Codec = detail::Paged_Value_Codec<Key>>
constexpr std::uint32_t Aleph::Gen_File_B_Tree< Key, Compare, MinDegree, Codec >::LegacyWalVersion = 1
staticconstexprprivate

◆ lock_

template<typename Key , class Compare = Aleph::less<Key>, size_t MinDegree = 16, typename Codec = detail::Paged_Value_Codec<Key>>
detail::Pid_File_Lock Aleph::Gen_File_B_Tree< Key, Compare, MinDegree, Codec >::lock_
mutableprivate

◆ lock_path_

template<typename Key , class Compare = Aleph::less<Key>, size_t MinDegree = 16, typename Codec = detail::Paged_Value_Codec<Key>>
std::string Aleph::Gen_File_B_Tree< Key, Compare, MinDegree, Codec >::lock_path_
private

◆ MaxChildren

◆ MaxKeys

◆ MinKeys

template<typename Key , class Compare = Aleph::less<Key>, size_t MinDegree = 16, typename Codec = detail::Paged_Value_Codec<Key>>
constexpr size_t Aleph::Gen_File_B_Tree< Key, Compare, MinDegree, Codec >::MinKeys = MinDegree - 1
staticconstexprprivate

◆ NativeCheckpointFormatVersion

◆ NativeWalVersion

template<typename Key , class Compare = Aleph::less<Key>, size_t MinDegree = 16, typename Codec = detail::Paged_Value_Codec<Key>>
constexpr std::uint32_t Aleph::Gen_File_B_Tree< Key, Compare, MinDegree, Codec >::NativeWalVersion = 3
staticconstexprprivate

◆ open_mode_

◆ pages_

◆ PortableEncodingMarker

template<typename Key , class Compare = Aleph::less<Key>, size_t MinDegree = 16, typename Codec = detail::Paged_Value_Codec<Key>>
constexpr std::uint8_t Aleph::Gen_File_B_Tree< Key, Compare, MinDegree, Codec >::PortableEncodingMarker = 3
staticconstexprprivate

◆ PortableFormatVersion

◆ PortableWalVersion

template<typename Key , class Compare = Aleph::less<Key>, size_t MinDegree = 16, typename Codec = detail::Paged_Value_Codec<Key>>
constexpr std::uint32_t Aleph::Gen_File_B_Tree< Key, Compare, MinDegree, Codec >::PortableWalVersion = 4
staticconstexprprivate

◆ Read_Only

template<typename Key , class Compare = Aleph::less<Key>, size_t MinDegree = 16, typename Codec = detail::Paged_Value_Codec<Key>>
constexpr auto Aleph::Gen_File_B_Tree< Key, Compare, MinDegree, Codec >::Read_Only = Paged_File_Open_Mode::Read_Only
staticconstexpr

Definition at line 2104 of file tpl_file_b_tree.H.

◆ Read_Write

template<typename Key , class Compare = Aleph::less<Key>, size_t MinDegree = 16, typename Codec = detail::Paged_Value_Codec<Key>>
constexpr auto Aleph::Gen_File_B_Tree< Key, Compare, MinDegree, Codec >::Read_Write = Paged_File_Open_Mode::Read_Write
staticconstexpr

Definition at line 2103 of file tpl_file_b_tree.H.

◆ root_page_

◆ size_

◆ storage_format_version_

◆ wal_path_

template<typename Key , class Compare = Aleph::less<Key>, size_t MinDegree = 16, typename Codec = detail::Paged_Value_Codec<Key>>
std::string Aleph::Gen_File_B_Tree< Key, Compare, MinDegree, Codec >::wal_path_
private

◆ wal_tmp_path_

template<typename Key , class Compare = Aleph::less<Key>, size_t MinDegree = 16, typename Codec = detail::Paged_Value_Codec<Key>>
std::string Aleph::Gen_File_B_Tree< Key, Compare, MinDegree, Codec >::wal_tmp_path_
private

◆ WalVersion

template<typename Key , class Compare = Aleph::less<Key>, size_t MinDegree = 16, typename Codec = detail::Paged_Value_Codec<Key>>
constexpr std::uint32_t Aleph::Gen_File_B_Tree< Key, Compare, MinDegree, Codec >::WalVersion = PortableWalVersion
staticconstexprprivate

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