MCPcopy Create free account
hub / github.com/ByteStorage/FlyDB / Put

Method Put

engine/index/bptree.go:55–63  ·  view source on GitHub ↗

Put Inserts a key-value pair into the B+ tree index The two arguments to the Put method The first argument is the key, and the second argument is the value The key is the primary key of the data, and the value is the offset of the data in the data file

(key []byte, pst *data.LogRecordPst)

Source from the content-addressed store, hash-verified

53// The key is the primary key of the data,
54// and the value is the offset of the data in the data file
55func (bptree *BPlusTree) Put(key []byte, pst *data.LogRecordPst) bool {
56 if err := bptree.tree.Update(func(tx *bbolt.Tx) error {
57 bucket := tx.Bucket(indexBucketName)
58 return bucket.Put(key, data.EncodeLogRecordPst(pst))
59 }); err != nil {
60 panic(ErrPutValueFailed)
61 }
62 return true
63}
64
65// Get Gets the value corresponding to the key from the B+ tree index
66// The argument to the Get method is required to be a byte array

Callers

nothing calls this directly

Calls 3

EncodeLogRecordPstFunction · 0.92
UpdateMethod · 0.80
PutMethod · 0.65

Tested by

no test coverage detected