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

Method read

node.go:162–174  ·  view source on GitHub ↗

read initializes the node from a page.

(p *common.Page)

Source from the content-addressed store, hash-verified

160
161// read initializes the node from a page.
162func (n *node) read(p *common.Page) {
163 n.pgid = p.Id()
164 n.isLeaf = p.IsLeafPage()
165 n.inodes = common.ReadInodeFromPage(p)
166
167 // Save first key, so we can find the node in the parent when we spill.
168 if len(n.inodes) > 0 {
169 n.key = n.inodes[0].Key()
170 common.Assert(len(n.key) > 0, "read: zero-length node key")
171 } else {
172 n.key = nil
173 }
174}
175
176// write writes the items onto one or more pages.
177// The page should have p.id (might be 0 for meta or bucket-inline page) and p.overflow set

Callers 3

TestNode_read_LeafPageFunction · 0.95
TestNode_write_LeafPageFunction · 0.95
nodeMethod · 0.95

Calls 5

ReadInodeFromPageFunction · 0.92
AssertFunction · 0.92
IdMethod · 0.80
IsLeafPageMethod · 0.80
KeyMethod · 0.45

Tested by 2

TestNode_read_LeafPageFunction · 0.76
TestNode_write_LeafPageFunction · 0.76