Skip to content

Latest commit

 

History

History
57 lines (45 loc) · 943 Bytes

Readme.md

File metadata and controls

57 lines (45 loc) · 943 Bytes

bplustree

Implementing bplustree base on disk(kv store).The type of key is uint64 and value is string.
And all actions are not Concurrent security.

InitTree

if tree, err = NewTree("./data.db"); err != nil {
	panic(err)
}
defer tree.Close()

NewTree will create new file named ./data.db if not existed, or will read data by bplustree format.

Insert

if err = tree.Insert(20, "2001"); err != nil {
    panic(err)
}

Find

if val, err = tree.Find(20); err != nil {
    panic(err)
} 

Delete

if err = tree.Delete(20); err != nil {
	panic(err)
}

Update

if err = tree.Update(20, "2002"); err != nil {
    panic(err)
}

all error

var HasExistedKeyError = errors.New("hasExistedKey")
var NotFoundKey = errors.New("notFoundKey")
var InvalidDBFormat = errors.New("invalid db format")

test

go test -v

LICENSE

MIT