del removes a key from the node.
(key []byte)
| 143 | |
| 144 | // del removes a key from the node. |
| 145 | func (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. |
| 162 | func (n *node) read(p *common.Page) { |
no test coverage detected