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

.

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