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

Method goToFirstElementOnTheStack

cursor.go:169–187  ·  view source on GitHub ↗

first moves the cursor to the first leaf element under the last page in the stack.

()

Source from the content-addressed store, hash-verified

167
168// first moves the cursor to the first leaf element under the last page in the stack.
169func (c *Cursor) goToFirstElementOnTheStack() {
170 for {
171 // Exit when we hit a leaf page.
172 var ref = &c.stack[len(c.stack)-1]
173 if ref.isLeaf() {
174 break
175 }
176
177 // Keep adding pages pointing to the first element to the stack.
178 var pgId common.Pgid
179 if ref.node != nil {
180 pgId = ref.node.inodes[ref.index].Pgid()
181 } else {
182 pgId = ref.page.BranchPageElement(uint16(ref.index)).Pgid()
183 }
184 p, n := c.bucket.pageNode(pgId)
185 c.stack = append(c.stack, elemRef{page: p, node: n, index: 0})
186 }
187}
188
189// last moves the cursor to the last leaf element under the last page in the stack.
190func (c *Cursor) last() {

Callers 2

firstMethod · 0.95
nextMethod · 0.95

Calls 4

isLeafMethod · 0.80
BranchPageElementMethod · 0.80
pageNodeMethod · 0.80
PgidMethod · 0.45

Tested by

no test coverage detected