我正在开发小型数据库,我已经开始使用stx-btree实现将数据存储在btree中。
是否可以在光盘上存储stx-btree?
提前致谢!
UPDATE:我需要在btree的内存块中保留并在必要时加载/保存所需的树节点。
答案 0 :(得分:2)
我对c或c ++甚至btree都知之甚少,但在查看和搜索它时看到了这个问题,因为它看起来很有趣! ...
看看这个gitHub页面:
https://github.com/fakechris/stx-btree-ondisk
--- Extensions ---
Beyond the usual STL interface the B+ tree classes support some extra goodies.
// Output the tree in a pseudo-hierarchical text dump to std::cout. This
// function requires that BTREE_DEBUG is defined prior to including the btree
// headers. Furthermore the key and data types must be std::ostream printable.
void print() const;
// Run extensive checks of the tree invariants. If a corruption in found the
// program will abort via assert(). See below on enabling auto-verification.
void verify() const;
// Serialize and restore the B+ tree nodes and data into/from a binary image.
// This requires that the key and data types are integral and contain no
// outside pointers or references.
void dump(std::ostream &os) const;
bool restore(std::istream &is);