Commit 27e68642 authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent 0fa06cbd
......@@ -89,27 +89,6 @@ type ΔValue struct {
}
/* XXX kill
// treeSetKey represents ordered set of keys.
// it can be point-queried and range-accessed.
// TODO -> btree
type treeSetKey struct {
SetKey
}
// InRange returns
func (hi treeSetKey) GetInRange(lo, hi_ Key) SetKey {
// FIXME dumb O(n) -> TODO use cznic/b
ret := SetKey{}
for k := range hi.SetKey {
if lo <= k && k <= hi_ {
ret.Add(k)
}
}
return ret
}
*/
// δZConnectTracked computes connected closure of δZ/T.
//
// δZ - all changes in a ZODB transaction.
......@@ -380,18 +359,6 @@ func treediff(ctx context.Context, root zodb.Oid, δtops SetOid, δZTC SetOid, t
δtrackv = append(δtrackv, δtrackTop)
}
/* XXX kill
// adjust holeIdx
for k, δv := range δT {
if δv.Old == VDEL {
holeIdx.Del(k)
}
if δv.New == VDEL {
holeIdx.Add(k)
}
}
*/
// adjust trackSet by merge(δtrackTops)
δtrack = &ΔPPTreeSubSet{Del: PPTreeSubSet{}, Add: PPTreeSubSet{}, δnchildNonLeafs: map[zodb.Oid]int{}}
for _, δ := range δtrackv {
......@@ -463,7 +430,6 @@ func diffX(ctx context.Context, a, b Node, δZTC SetOid, trackSet PPTreeSubSet)
// a, b point to top of subtrees @old and @new revisions.
// δZTC is connected set of objects covering δZT (objects changed in this tree in old..new).
func diffT(ctx context.Context, A, B *Tree, δZTC SetOid, trackSet PPTreeSubSet) (δ map[Key]ΔValue, δtrack *ΔPPTreeSubSet, err error) {
// var holeIdx treeSetKey XXX kill
tracef(" diffT %s %s\n", xidOf(A), xidOf(B))
defer xerr.Contextf(&err, "diffT %s %s", xidOf(A), xidOf(B))
......@@ -533,12 +499,6 @@ func diffT(ctx context.Context, A, B *Tree, δZTC SetOid, trackSet PPTreeSubSet)
tracef(" Akq <- %s\n", δtodo)
Akqueue.UnionInplace(δtodo)
}
/* XXX kill
if !Akdone.Has(k) {
tracef(" Akq <- %d\n", k)
Akqueue.Add(k)
}
*/
}
Bktodo := func(r KeyRange) {
if !Bkdone.HasRange(r) {
......@@ -548,12 +508,6 @@ func diffT(ctx context.Context, A, B *Tree, δZTC SetOid, trackSet PPTreeSubSet)
tracef(" Bkq <- %s\n", δtodo)
Bkqueue.UnionInplace(δtodo)
}
/* XXX kill
if !Bkdone.Has(k) {
tracef(" Bkq <- %d\n", k)
Bkqueue.Add(k)
}
*/
}
// {} oid -> parent for all nodes in Bv: current and previously expanded - up till top B
......@@ -585,17 +539,6 @@ func diffT(ctx context.Context, A, B *Tree, δZTC SetOid, trackSet PPTreeSubSet)
err = δMerge(δ, δA); /*X*/if err != nil { return nil,nil, err }
δtrack.Del.AddPath(ra.Path())
/*
// Bkqueue <- δA
for k := range δA {
Akdone.Add(k)
Bktodo(k)
}
// Bkqueue <- holes(ra.range) XXX -> Bktodo(ra.range)
for k := range holeIdx.GetInRange(ra.lo, ra.hi_) {
Bktodo(k)
}
*/
// Bkqueue <- ra.range
Bktodo(KeyRange{ra.lo, ra.hi_})
ra.done = true
......@@ -604,11 +547,6 @@ func diffT(ctx context.Context, A, B *Tree, δZTC SetOid, trackSet PPTreeSubSet)
// empty tree - only queue holes covered by it
if len(a.Entryv()) == 0 {
Bktodo(KeyRange{ra.lo, ra.hi_})
/* XXX kill
for k := range holeIdx.GetInRange(ra.lo, ra.hi_) {
Bktodo(k)
}
*/
continue
}
......@@ -662,8 +600,6 @@ func diffT(ctx context.Context, A, B *Tree, δZTC SetOid, trackSet PPTreeSubSet)
}
if found {
// ac can be skipped
// XXX Bkqueue <- holes(ac.range \ bc.range) XXX test for this
// adjust trackSet since path to the node could have changed
apath := trackSet.Path(acOid)
bpath := BtrackSet.Path(acOid)
......@@ -712,7 +648,6 @@ func diffT(ctx context.Context, A, B *Tree, δZTC SetOid, trackSet PPTreeSubSet)
break
}
// for k := range Bkqueue {
for _, r := range Bkqueue.AllRanges() {
lo := r.lo
for {
......@@ -734,12 +669,6 @@ func diffT(ctx context.Context, A, B *Tree, δZTC SetOid, trackSet PPTreeSubSet)
br := KeyRange{b.lo, b.hi_}
Bkdone.AddRange(br)
Aktodo(br)
/*
for k_ := range δB {
Bkdone.Add(k_)
Aktodo(k_)
}
*/
b.done = true
}
......@@ -751,14 +680,11 @@ func diffT(ctx context.Context, A, B *Tree, δZTC SetOid, trackSet PPTreeSubSet)
// continue with next right bucket
lo = b.hi_ + 1
}
// XXX k is not there -> hole XXX test XXX <- kill?
}
Bkqueue.Clear()
tracef("\n")
tracef(" Akq: %s\n", Akqueue)
// for k := range Akqueue {
for _, r := range Akqueue.AllRanges() {
lo := r.lo
for {
......@@ -780,17 +706,6 @@ func diffT(ctx context.Context, A, B *Tree, δZTC SetOid, trackSet PPTreeSubSet)
ar := KeyRange{a.lo, a.hi_}
Akdone.AddRange(ar)
Bktodo(ar)
/* XXX kill
// Bkqueue <- δA
for k_ := range δA {
Akdone.Add(k_)
Bktodo(k_)
}
// Bkqueue <- holes(a.range)
for k_ := range holeIdx.GetInRange(a.lo, a.hi_) {
Bktodo(k_)
}
*/
a.done = true
}
......
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