Commit d24d23a7 authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent f81aa6f8
......@@ -689,9 +689,10 @@ func (δBtail *ΔBtail) rebuild() (err error) {
δTtail, ok := δBtail.byRoot[root]
if !ok {
// this root was not tracked before -> create δTtail for it with empty changes
// XXX do not keep entries with empty δkv ?
var vδT []ΔTree
for j := 0; j < len(vδZ); j++ {
vδT = append(vδT, ΔTree{Rev: vδZ[j].Rev, ΔKV: make(map[Key]ΔValue)})
for _, δZj := range vδZ {
vδT = append(vδT, ΔTree{Rev: δZj.Rev, ΔKV: make(map[Key]ΔValue)})
}
δTtail = &ΔTtail{
vδT: vδT,
......@@ -745,8 +746,6 @@ func (δBtail *ΔBtail) Update(δZ *zodb.EventCommit) (_ ΔB, err error) {
// update .trackIdx and vδB from .trackNew
δBtail.rebuild()
δBtail.δZtail.Append(δZ.Tid, δZ.Changev)
tracef("Update δZ: %v\n", δZ.Changev)
tracef("trackIdx: %v\n", δBtail.trackIdx)
tracef("holeIdxByRoot: %v\n", δBtail.holeIdxByRoot)
......@@ -787,7 +786,12 @@ func (δBtail *ΔBtail) Update(δZ *zodb.EventCommit) (_ ΔB, err error) {
δB.ByRoot[root] = δT
δTtail, ok := δBtail.byRoot[root]
if !ok {
// this root was not tracked before ... XXX
// this root was not tracked before -> create δTtail for it with empty changes
// XXX do not keep entries with empty δkv ?
var vδT []ΔTree
for _, δZj := range δBtail.δZtail.Data() {
vδT = append(vδT, ΔTree{Rev: δZj.Rev, ΔKV: make(map[Key]ΔValue)})
}
δTtail = &ΔTtail {
// XXX vδT: ...
// XXX KVAtTail: ...,
......@@ -803,6 +807,7 @@ func (δBtail *ΔBtail) Update(δZ *zodb.EventCommit) (_ ΔB, err error) {
}
}
δBtail.δZtail.Append(δZ.Tid, δZ.Changev)
return δB, nil
}
......
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