Commit 2716a284 authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent 19f3a09d
......@@ -635,16 +635,24 @@ func (tidx trackIndex) AddPath(path []zodb.Oid) {
}
}
// rebuild rebuilds ΔBtree taking trackNew requests into account. XXX
// rebuild rebuilds ΔBtail taking trackNew requests into account. XXX
// XXX place
func (δBtail *ΔBtail) rebuild() {
// XXX stub
// XXX locking
/*
// vδT <- merge treediff(lo..hi/trackNew)
vδZ := δBtail.δZtail.Data()
for i := len(vδZ)-1; i>=0; i-- {
δZ := vδZ[i]
δZTC, δtopsByRoot := δBtail.δZConnectTracked(δZ, trackNew)
}
*/
// merge .trackNew into .trackIdx
δBtail.trackIdx.Update(δBtail.trackNew)
δBtail.trackNew = trackIndex{}
return
panic("TODO")
}
// Update updates δB with per-object level ZODB changes.
......@@ -669,7 +677,7 @@ func (δBtail *ΔBtail) Update(δZ *zodb.EventCommit) (_ ΔB, err error) {
tracef("trackIdx: %v\n", δBtail.trackIdx)
tracef("holeIdxByRoot: %v\n", δBtail.holeIdxByRoot)
δZTC, δtopsByRoot := δBtail.δZConnectTracked(δZ)
δZTC, δtopsByRoot := δZConnectTracked(δZ, δBtail.trackIdx)
δB := ΔB{Rev: δZ.Tid, ByRoot: make(map[zodb.Oid]map[Key]ΔValue)}
......@@ -718,13 +726,13 @@ func (δBtail *ΔBtail) Update(δZ *zodb.EventCommit) (_ ΔB, err error) {
// for example for e.g. t₀->t₁->b₂ if δZ/T={t₀ b₂} -> δZ/TC=δZ/T+{t₁}
//
// δtopsByRoot = {} root -> {top changed nodes in that tree}
func (δBtail *ΔBtail) δZConnectTracked(δZv *zodb.EventCommit) (δZTC SetOid, δtopsByRoot map[zodb.Oid]SetOid) {
func δZConnectTracked(δZv *zodb.EventCommit, T trackIndex) (δZTC SetOid, δtopsByRoot map[zodb.Oid]SetOid) {
δZ := SetOid{}; for _, δ := range δZv.Changev { δZ.Add(δ) }
δZTC = SetOid{}
δtopsByRoot = map[zodb.Oid]SetOid{}
for δ := range δZ {
track, ok := δBtail.trackIdx[δ]
track, ok := T[δ]
if !ok {
continue // not tracked at all
}
......@@ -759,7 +767,7 @@ func (δBtail *ΔBtail) δZConnectTracked(δZv *zodb.EventCommit) (δZTC SetOid,
}
path = append(path, parent)
trackUp, ok := δBtail.trackIdx[parent]
trackUp, ok := T[parent]
if !ok {
panicf("BUG: .p%s -> %s, but %s is not tracked", node, parent, parent)
}
......@@ -1574,10 +1582,10 @@ func (δBtail *ΔBtail) GetAt(ctx context.Context, root *Tree, key Key, at zodb.
}
// XXX don't need
func (δBtail *ΔBtail) SliceByRev(lo, hi zodb.Tid) /*readonly*/ []ΔB {
δassertSlice(δBtail, lo, hi)
panic("TODO")
}
//func (δBtail *ΔBtail) SliceByRev(lo, hi zodb.Tid) /*readonly*/ []ΔB {
// δassertSlice(δBtail, lo, hi)
// panic("TODO")
//}
// SliceByRootRev returns history of a tree changes in (lo, hi] range.
//
......
......@@ -1019,7 +1019,7 @@ func xverifyΔBTail_rebuild_TR(t *testing.T, db *zodb.DB, δbtail *ΔBtail, tj *
// XXX verify Get
// verify SliceByRootRev
// verify SliceByRootRev XXX -> verify δbtail.byRoot[treeRoot] directly
l := len(vδTok)
vatOK := make([]zodb.Tid, l)
t0 := tj
......@@ -1037,7 +1037,7 @@ func xverifyΔBTail_rebuild_TR(t *testing.T, db *zodb.DB, δbtail *ΔBtail, tj *
atPrev := lo
for i, δToid := range vδToid {
vat[i] = δToid.Rev
δT := XGetδKV(db, atPrev, δToid.Rev, δToid.ΔKV) // {} k -> δ(ZBlk(oid).data)
δT := XGetδKV(db, atPrev, δToid.Rev, δToid.ΔKV) // {} k -> δ(ZBlk(oid).data)
vδT = append(vδT, δT)
atPrev = δToid.Rev
}
......
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