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

Method size

node.go:41–48  ·  view source on GitHub ↗

size returns the size of the node after serialization.

()

Source from the content-addressed store, hash-verified

39
40// size returns the size of the node after serialization.
41func (n *node) size() int {
42 sz, elsz := common.PageHeaderSize, n.pageElementSize()
43 for i := 0; i < len(n.inodes); i++ {
44 item := &n.inodes[i]
45 sz += elsz + uintptr(len(item.Key())) + uintptr(len(item.Value()))
46 }
47 return int(sz)
48}
49
50// sizeLessThan returns true if the node is less than a given size.
51// This is an optimization to avoid calculating a large node when we only need

Callers 3

rebalanceMethod · 0.95
spillMethod · 0.80
writeMethod · 0.80

Calls 3

pageElementSizeMethod · 0.95
KeyMethod · 0.45
ValueMethod · 0.45

Tested by

no test coverage detected