Commit 22226d99 authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent dc40c397
......@@ -227,6 +227,7 @@ func vδTClone(orig []ΔTree) []ΔTree {
func (δBtail *ΔBtail) Head() zodb.Tid { return δBtail.δZtail.Head() }
func (δBtail *ΔBtail) Tail() zodb.Tid { return δBtail.δZtail.Tail() }
// Track adds tree path to tracked set.
//
// path[0] signifies tree root.
......@@ -550,7 +551,8 @@ func (δTtail *_ΔTtail) rebuild1(atPrev zodb.Tid, δZ zodb.ΔRevEntry, trackNew
return δtrack, δtkeycov, newRevEntry, nil
}
// Update updates δB with per-object-level ZODB changes.
// Update updates δB with object-level ZODB changes.
//
// Only those objects from δZ that belong to tracked set are guaranteed to be
// taken into account. In other words a tree history will assuredly include
......@@ -620,7 +622,6 @@ type _ΔBUpdate1 struct {
}
type _ΔTUpdate1 struct {
δtkeycov1 *blib.RangedKeySet // {} root -> δtrackedKeys after first treediff (always grow)
δtrack *blib.ΔPPTreeSubSet // XXX kill (not used)
}
func (δBtail *ΔBtail) _Update1(δZ *zodb.EventCommit) (δB1 _ΔBUpdate1, err error) {
headOld := δBtail.Head()
......@@ -680,7 +681,7 @@ func (δBtail *ΔBtail) _Update1(δZ *zodb.EventCommit) (δB1 _ΔBUpdate1, err e
}
δBtail.trackSet.ApplyΔ(δtrack)
δB1.ByRoot[root] = &_ΔTUpdate1{δtkeycov1: δtkeycov, δtrack: δtrack}
δB1.ByRoot[root] = &_ΔTUpdate1{δtkeycov1: δtkeycov}
}
return δB1, nil
......@@ -866,14 +867,14 @@ func (δBtail *ΔBtail) SliceByRootRev(root zodb.Oid, lo, hi zodb.Tid) /*readonl
return nil
}
// find max j : [j].rev ≤ hi XXX linear scan -> binary search
// find max j : [j].rev ≤ hi linear scan -> TODO binary search
j := l - 1
for ; j >= 0 && vδT[j].Rev > hi; j-- {}
if j < 0 {
return nil // ø
}
// find max i : [i].rev > lo XXX linear scan -> binary search
// find max i : [i].rev > lo linear scan -> TODO binary search
i := j
for ; i >= 0 && vδT[i].Rev > lo; i-- {}
i++
......
......@@ -287,11 +287,11 @@ func (δFtail *ΔFtail) rebuildAll() (err error) {
return nil
}
// rebuildIfNeeded rebuilds vδE if there is such need.
// rebuild1IfNeeded rebuilds vδE if there is such need.
//
// it returns corresponding δftail for convenience.
// the only case when vδE actually needs to be rebuilt is when the file just started to be tracked.
func (δFtail *ΔFtail) rebuildIfNeeded(foid zodb.Oid) (_ *_ΔFileTail, err error) {
func (δFtail *ΔFtail) rebuild1IfNeeded(foid zodb.Oid) (_ *_ΔFileTail, err error) {
// XXX locking
δftail := δFtail.byFile[foid]
......@@ -604,7 +604,7 @@ func (δFtail *ΔFtail) SliceByFileRev(zfile *ZBigFile, lo, hi zodb.Tid) /*reado
// δFile ────────o───────o──────x─────x────────────────────────
δftail, err := δFtail.rebuildIfNeeded(foid)
δftail, err := δFtail.rebuild1IfNeeded(foid)
if err != nil {
panic(err) // XXX
}
......@@ -848,7 +848,7 @@ func (δFtail *ΔFtail) _BlkRevAt(ctx context.Context, zfile *ZBigFile, blk int6
// XXX locking
δftail, err := δFtail.rebuildIfNeeded(foid)
δftail, err := δFtail.rebuild1IfNeeded(foid)
if err != nil {
return zodb.InvalidTid, false, err
}
......
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