Search code examples
c++databaseb-tree

stx-btree store on disc


I'm developing small database, and I have deiced to use stx-btree implementation for store the data in btree.

Is it possible to store stx-btree on disc?

Thanks in advance!

UPDATE: I need hold in memory piece of btree and load/save required tree node when it's necessary.


Solution

  • I know very little about c or c++ or even btree's but saw this question while reviewing and googled it as it looked interesting ! ...

    Have a look at this gitHub page :

    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);