Commit 36bb9b1e authored by Kirill Smelkov's avatar Kirill Smelkov

go/zodb/btree: Expose iterating through leaf tree nodes as public API

Done for consistency with 313d2d78 (go/zodb/btree: Expose access to
BTree/Bucket entries as public API).
parent a47146ea
......@@ -25,6 +25,8 @@
//
// node.Entryv() returns [] of (key, child/value).
//
// BTree.FirstBucket() and Bucket.Next() allow to iterate through leaf B⁺ tree nodes.
//
// --------
//
// (*) https://github.com/zopefoundation/ZODB/blob/3.10.7-4-gb8d7a8567/src/BTrees/Development.txt#L211
......
......@@ -133,6 +133,18 @@ func (b *Bucket) Entryv() []BucketEntry {
return ev
}
// ---- leaf nodes iteration ----
// FirstBucket returns bucket containing the smallest key in the tree.
func (t *BTree) FirstBucket() *Bucket {
return t.firstbucket
}
// Next returns tree bucket with next larger keys relative to current bucket.
func (b *Bucket) Next() *Bucket {
return b.next
}
// ---- point query ----
// Get searches BTree by key.
......
......@@ -253,6 +253,7 @@ func TestBTree(t *testing.T) {
}
// XXX verify Entryv ?
// XXX verify FirstBucket / Next ?
verifyFirstBucket(B3)
}
......@@ -135,6 +135,18 @@ func (b *IOBucket) Entryv() []IOBucketEntry {
return ev
}
// ---- leaf nodes iteration ----
// FirstBucket returns bucket containing the smallest key in the tree.
func (t *IOBTree) FirstBucket() *IOBucket {
return t.firstbucket
}
// Next returns tree bucket with next larger keys relative to current bucket.
func (b *IOBucket) Next() *IOBucket {
return b.next
}
// ---- point query ----
// Get searches IOBTree by key.
......
......@@ -135,6 +135,18 @@ func (b *LOBucket) Entryv() []LOBucketEntry {
return ev
}
// ---- leaf nodes iteration ----
// FirstBucket returns bucket containing the smallest key in the tree.
func (t *LOBTree) FirstBucket() *LOBucket {
return t.firstbucket
}
// Next returns tree bucket with next larger keys relative to current bucket.
func (b *LOBucket) Next() *LOBucket {
return b.next
}
// ---- point query ----
// Get searches LOBTree by key.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment