MCPcopy
hub / github.com/etcd-io/bbolt / del

Method del

node.go:145–159  ·  view source on GitHub ↗

del removes a key from the node.

(key []byte)

Source from the content-addressed store, hash-verified

143
144// del removes a key from the node.
145func (n *node) del(key []byte) {
146 // Find index of key.
147 index := sort.Search(len(n.inodes), func(i int) bool { return bytes.Compare(n.inodes[i].Key(), key) != -1 })
148
149 // Exit if the key isn't found.
150 if index >= len(n.inodes) || !bytes.Equal(n.inodes[index].Key(), key) {
151 return
152 }
153
154 // Delete inode from the node.
155 n.inodes = append(n.inodes[:index], n.inodes[index+1:]...)
156
157 // Mark the node as needing rebalancing.
158 n.unbalanced = true
159}
160
161// read initializes the node from a page.
162func (n *node) read(p *common.Page) {

Callers 5

rebalanceMethod · 0.80
DeleteBucketMethod · 0.80
MoveBucketMethod · 0.80
DeleteMethod · 0.80
DeleteMethod · 0.80

Calls 1

KeyMethod · 0.45

Tested by

no test coverage detected