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)
| 53 | // The key is the primary key of the data, |
| 54 | // and the value is the offset of the data in the data file |
| 55 | func (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 |
nothing calls this directly
no test coverage detected