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

Function GetActiveMetaPage

internal/guts_cli/guts_cli.go:125–141  ·  view source on GitHub ↗

GetActiveMetaPage returns the active meta page and its page ID (0 or 1).

(path string)

Source from the content-addressed store, hash-verified

123
124// GetActiveMetaPage returns the active meta page and its page ID (0 or 1).
125func GetActiveMetaPage(path string) (*common.Meta, common.Pgid, error) {
126 _, buf0, err0 := ReadPage(path, 0)
127 if err0 != nil {
128 return nil, 0, err0
129 }
130 m0 := common.LoadPageMeta(buf0)
131 _, buf1, err1 := ReadPage(path, 1)
132 if err1 != nil {
133 return nil, 1, err1
134 }
135 m1 := common.LoadPageMeta(buf1)
136 if m0.Txid() < m1.Txid() {
137 return m1, 1, nil
138 } else {
139 return m0, 0, nil
140 }
141}

Callers 2

readFreelistPageIdsFunction · 0.92
GetRootPageFunction · 0.85

Calls 3

LoadPageMetaFunction · 0.92
ReadPageFunction · 0.85
TxidMethod · 0.80

Tested by 1

readFreelistPageIdsFunction · 0.74