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

Method split

node.go:206–225  ·  view source on GitHub ↗

split breaks up a node into multiple smaller nodes, if appropriate. This should only be called from the spill() function.

(pageSize uintptr)

Source from the content-addressed store, hash-verified

204// split breaks up a node into multiple smaller nodes, if appropriate.
205// This should only be called from the spill() function.
206func (n *node) split(pageSize uintptr) []*node {
207 var nodes []*node
208
209 node := n
210 for {
211 // Split node into two.
212 a, b := node.splitTwo(pageSize)
213 nodes = append(nodes, a)
214
215 // If we can't split then exit the loop.
216 if b == nil {
217 break
218 }
219
220 // Set node to b so it gets split on the next iteration.
221 node = b
222 }
223
224 return nodes
225}
226
227// splitTwo breaks up a node into two smaller nodes, if appropriate.
228// This should only be called from the split() function.

Callers 4

spillMethod · 0.95
TestNode_splitFunction · 0.95
TestNode_split_MinKeysFunction · 0.95

Calls 1

splitTwoMethod · 0.80

Tested by 3

TestNode_splitFunction · 0.76
TestNode_split_MinKeysFunction · 0.76