Commit d37761bb authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent 61d79c05
...@@ -29,11 +29,8 @@ import ( ...@@ -29,11 +29,8 @@ import (
"lab.nexedi.com/nexedi/wendelin.core/wcfs/internal/xbtree/blib" "lab.nexedi.com/nexedi/wendelin.core/wcfs/internal/xbtree/blib"
) )
// RTree represents Tree node that RBucket refers to as parent. // RBucketSet represents set of buckets covering whole [-∞,∞) range.
type RTree struct { type RBucketSet []*RBucket // k↑
Oid zodb.Oid
Parent *RTree
}
// RBucket represents Bucket node with values covering [lo, hi_] key range in its Tree. // RBucket represents Bucket node with values covering [lo, hi_] key range in its Tree.
// NOTE it is not [lo,hi) but [lo,hi_] instead to avoid overflow at KeyMax. // NOTE it is not [lo,hi) but [lo,hi_] instead to avoid overflow at KeyMax.
...@@ -44,6 +41,13 @@ type RBucket struct { ...@@ -44,6 +41,13 @@ type RBucket struct {
KV map[Key]string // bucket's k->v; values were ZBlk objects whose data is loaded instead. KV map[Key]string // bucket's k->v; values were ZBlk objects whose data is loaded instead.
} }
// RTree represents Tree node that RBucket refers to as parent.
type RTree struct {
Oid zodb.Oid
Parent *RTree
}
// Path returns path to this bucket from tree root. // Path returns path to this bucket from tree root.
func (rb *RBucket) Path() []zodb.Oid { func (rb *RBucket) Path() []zodb.Oid {
path := []zodb.Oid{rb.Oid} path := []zodb.Oid{rb.Oid}
...@@ -55,10 +59,6 @@ func (rb *RBucket) Path() []zodb.Oid { ...@@ -55,10 +59,6 @@ func (rb *RBucket) Path() []zodb.Oid {
return path return path
} }
// RBucketSet represents set of buckets covering whole [-∞,∞) range.
type RBucketSet []*RBucket // k↑
// Get returns RBucket which covers key k. // Get returns RBucket which covers key k.
func (rbs RBucketSet) Get(k Key) *RBucket { func (rbs RBucketSet) Get(k Key) *RBucket {
i := sort.Search(len(rbs), func(i int) bool { i := sort.Search(len(rbs), func(i int) bool {
......
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