graph LR
B_Tree_Core["B-Tree Core"]
Node_Management["Node Management"]
Item_Interface["Item Interface"]
Memory_Management_FreeList_["Memory Management (FreeList)"]
Traversal_Iteration["Traversal & Iteration"]
B_Tree_Core -- "orchestrates" --> Node_Management
Node_Management -- "provides structure to" --> B_Tree_Core
Node_Management -- "stores" --> Item_Interface
Item_Interface -- "defines ordering for" --> Node_Management
B_Tree_Core -- "utilizes for initialization" --> Memory_Management_FreeList_
Node_Management -- "allocates/frees nodes via" --> Memory_Management_FreeList_
B_Tree_Core -- "exposes" --> Traversal_Iteration
Traversal_Iteration -- "navigates" --> Node_Management
click B_Tree_Core href "https://github.com/CodeBoarding/GeneratedOnBoardings/blob/main/btree/B_Tree_Core.md" "Details"
click Node_Management href "https://github.com/CodeBoarding/GeneratedOnBoardings/blob/main/btree/Node_Management.md" "Details"
The btree project implements an in-memory B-Tree data structure, designed for efficient ordered data storage and retrieval. The core of the system is the B-Tree Core component, which manages the overall tree structure and exposes the primary API for interactions such as insertion, deletion, and retrieval. This component relies heavily on Node Management, which handles the internal representation and manipulation of individual B-tree nodes, including their items and child references. Data elements stored within the tree must conform to the Item Interface, ensuring proper ordering through its Less method. To optimize performance and reduce garbage collection overhead, the system incorporates a Memory Management (FreeList) component, responsible for the efficient allocation and deallocation of nodes. Finally, the Traversal & Iteration component provides various methods for navigating the tree's elements in a sorted manner, enabling ordered access to data. The B-Tree Core orchestrates operations by interacting with Node Management, which in turn utilizes the Item Interface for data comparison and Memory Management for node lifecycle. Traversal & Iteration functions also interact with the B-Tree Core to navigate the tree structure.
B-Tree Core [Expand]
The primary entry point and orchestrator of the B-tree. Manages the tree's root, degree, and overall state, exposing the public API for tree operations.
Related Classes/Methods:
btree.BTreebtree.Newbtree.NewWithFreeListbtree.BTree.Getbtree.BTree.Putbtree.BTree.Deletebtree.BTree.Ascendbtree.BTree.Descend
Node Management [Expand]
Represents the fundamental building blocks (nodes) of the B-tree. Handles internal node logic, including item storage, child references, and operations like splitting and ensuring mutability for copy-on-write.
Related Classes/Methods:
btree.nodebtree.items.insertAtbtree.items.removeAtbtree.items.popbtree.items.truncatebtree.items.findbtree.children.insertAtbtree.children.removeAtbtree.children.popbtree.children.truncatebtree.node.mutableForbtree.node.mutableChildbtree.node.splitbtree.node.maybeSplitChild
Defines the contract for data elements stored within the B-tree, requiring a Less method to establish a strict weak ordering for all items.
Related Classes/Methods:
btree.Itembtree.Item.Less
Provides an efficient mechanism for managing the allocation and deallocation of node objects, reducing garbage collection overhead by reusing freed nodes.
Related Classes/Methods:
btree.FreeListbtree.NewFreeListbtree.FreeList.newNodebtree.FreeList.freeNode
Offers mechanisms for traversing the B-tree's elements in a sorted manner (ascending or descending) using callback functions, allowing for flexible iteration over subsets of the tree.
Related Classes/Methods:
btree.ItemIteratorbtree.BTree.Ascendbtree.BTree.Descendbtree.BTree.AscendGreaterOrEqualbtree.BTree.AscendLessThanbtree.BTree.AscendRangebtree.BTree.DescendLessOrEqualbtree.BTree.DescendRange