CinematicCow / Lumora

A key value database in go
Other
0 stars 0 forks source link

Make B+ Tree Persistent #4

Closed CinematicCow closed 9 months ago

CinematicCow commented 9 months ago

Need to make the B+ tree persistent to save memory. Proposed solution :

CinematicCow commented 9 months ago

Using the fs2 package, we can change the init function as follows:

func NewBPlusTree(filePath string) (*BPlusTree, error) {
    bf, err := fmap.CreateBlockFile(filePath)
    if err != nil {
        return nil, err
    }
    tree, err := bptree.New(bf, 8, -1)
    if err != nil {
        return nil, err
    }
    return &BPlusTree{tree: tree}, nil
}

Need to test with bench

CinematicCow commented 9 months ago

closed with 992bc83