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

Function pageItemLeafPageElement

cmd/bbolt/command/command_page_item.go:100–111  ·  view source on GitHub ↗
(pageBytes []byte, index uint16)

Source from the content-addressed store, hash-verified

98}
99
100func pageItemLeafPageElement(pageBytes []byte, index uint16) ([]byte, []byte, error) {
101 p := common.LoadPage(pageBytes)
102 if index >= p.Count() {
103 return nil, nil, fmt.Errorf("leafPageElement: expected item index less than %d, but got %d", p.Count(), index)
104 }
105 if p.Typ() != "leaf" {
106 return nil, nil, fmt.Errorf("leafPageElement: expected page type of 'leaf', but got '%s'", p.Typ())
107 }
108
109 e := p.LeafPageElement(index)
110 return e.Key(), e.Value(), nil
111}

Callers 2

pageItemPrintLeafItemKeyFunction · 0.85

Calls 7

LoadPageFunction · 0.92
TypMethod · 0.80
LeafPageElementMethod · 0.80
CountMethod · 0.65
ErrorfMethod · 0.65
KeyMethod · 0.45
ValueMethod · 0.45

Tested by

no test coverage detected