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

Function ReadInodeFromPage

internal/common/inode.go:49–68  ·  view source on GitHub ↗
(p *Page)

Source from the content-addressed store, hash-verified

47}
48
49func ReadInodeFromPage(p *Page) Inodes {
50 inodes := make(Inodes, int(p.Count()))
51 isLeaf := p.IsLeafPage()
52 for i := 0; i < int(p.Count()); i++ {
53 inode := &inodes[i]
54 if isLeaf {
55 elem := p.LeafPageElement(uint16(i))
56 inode.SetFlags(elem.Flags())
57 inode.SetKey(elem.Key())
58 inode.SetValue(elem.Value())
59 } else {
60 elem := p.BranchPageElement(uint16(i))
61 inode.SetPgid(elem.Pgid())
62 inode.SetKey(elem.Key())
63 }
64 Assert(len(inode.Key()) > 0, "read: zero-length inode key")
65 }
66
67 return inodes
68}
69
70func WriteInodeToPage(inodes Inodes, p *Page) uint32 {
71 // Loop over each item and write it to the page.

Callers 2

readMethod · 0.92
ClearPageElementsFunction · 0.92

Calls 13

AssertFunction · 0.85
IsLeafPageMethod · 0.80
LeafPageElementMethod · 0.80
SetKeyMethod · 0.80
SetValueMethod · 0.80
BranchPageElementMethod · 0.80
CountMethod · 0.65
SetFlagsMethod · 0.45
FlagsMethod · 0.45
KeyMethod · 0.45
ValueMethod · 0.45
SetPgidMethod · 0.45

Tested by

no test coverage detected