Commit 656ec766 authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent 92fe0aa7
......@@ -598,11 +598,14 @@ func (prs *rangeSplit) Expand(rnode *nodeInRange) (children rangeSplit) {
return children
}
// GetToBucket returns bucket corresponding to key k.
// While reaching to that bucket, it expands step-by-step trees that are leading to that bucket.
// GetToLeaf returns leaf node corresponding to key k.
//
// Leaf is usually bucket node, but, in the sole single case of empty tree, can be that root tree node.
// GetToLeaf expands step-by-step every tree from where it has to traverse to next depth level.
//
// XXX also return path?
func (prs *rangeSplit) GetToBucket(ctx context.Context, k Key) (rbucket *nodeInRange, ok bool, err error) {
rnode, ok := prs.Get_(k)
func (prs *rangeSplit) GetToLeaf(ctx context.Context, k Key) (rnode *nodeInRange, ok bool, err error) {
rnode, ok = prs.Get_(k)
if !ok {
return nil, false, nil // key not covered
}
......@@ -620,6 +623,8 @@ func (prs *rangeSplit) GetToBucket(ctx context.Context, k Key) (rbucket *nodeInR
}
defer rnode.node.PDeactivate()
// FIXME ø tree -> don't expand -> tree
children := prs.Expand(rnode)
rnode = children.Get(k) // k must be there
}
......@@ -872,7 +877,7 @@ func diffT(ctx context.Context, a, b *Tree, δZTC SetOid, trackIdx map[zodb.Oid]
Aqueue = SetKey{}
for k := range Bqueue {
Bdone.Add(k)
bbucket, ok, err := bv.GetToBucket(ctx, k)
bnode, ok, err := bv.GetToLeaf(ctx, k)
if err != nil {
return nil, err
}
......@@ -881,10 +886,12 @@ func diffT(ctx context.Context, a, b *Tree, δZTC SetOid, trackIdx map[zodb.Oid]
continue // key not covered
}
// XXX check for bnode.node.(*Tree) (ø tree case)
// + bucket if not already done
// XXX update track.hole if k not in bbucket
if !bbucket.done {
δB, err := diffB(ctx, nil, bbucket.node.(*Bucket))
if !bnode.done {
δB, err := diffB(ctx, nil, bnode.node.(*Bucket))
if err != nil {
return nil, err
}
......@@ -902,7 +909,7 @@ func diffT(ctx context.Context, a, b *Tree, δZTC SetOid, trackIdx map[zodb.Oid]
}
}
bbucket.done = true
bnode.done = true
}
}
......@@ -911,7 +918,7 @@ func diffT(ctx context.Context, a, b *Tree, δZTC SetOid, trackIdx map[zodb.Oid]
Bqueue = SetKey{}
for k := range Aqueue {
Adone.Add(k)
abucket, ok, err := av.GetToBucket(ctx, k)
abucket, ok, err := av.GetToLeaf(ctx, k)
if err != nil {
return nil, err
}
......@@ -920,6 +927,8 @@ func diffT(ctx context.Context, a, b *Tree, δZTC SetOid, trackIdx map[zodb.Oid]
continue // key not covered
}
// XXX check for anode.node.(*Tree) (ø tree case)
// - bucket if not already done
// XXX also extract holes
if !abucket.done {
......
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