Commit effe6404 authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent 4a1737b4
...@@ -497,6 +497,7 @@ func (orig *ΔBtail) clone() *ΔBtail { ...@@ -497,6 +497,7 @@ func (orig *ΔBtail) clone() *ΔBtail {
return klon return klon
} }
/*
// newΔTtail creates new empty ΔTtail object. // newΔTtail creates new empty ΔTtail object.
func newΔTtail() *ΔTtail { func newΔTtail() *ΔTtail {
return &ΔTtail{ return &ΔTtail{
...@@ -504,6 +505,7 @@ func newΔTtail() *ΔTtail { ...@@ -504,6 +505,7 @@ func newΔTtail() *ΔTtail {
lastRevOf: make(map[Key]zodb.Tid), lastRevOf: make(map[Key]zodb.Tid),
} }
} }
*/
// (tail, head] coverage // (tail, head] coverage
func (δBtail *ΔBtail) Head() zodb.Tid { return δBtail.δZtail.Head() } func (δBtail *ΔBtail) Head() zodb.Tid { return δBtail.δZtail.Head() }
...@@ -555,10 +557,12 @@ func (δBtail *ΔBtail) Track(key Key, keyPresent bool, path []Node) error { // ...@@ -555,10 +557,12 @@ func (δBtail *ΔBtail) Track(key Key, keyPresent bool, path []Node) error { //
} }
} }
/*
_, ok := δBtail.byRoot[root] _, ok := δBtail.byRoot[root]
if !ok { if !ok {
δBtail.byRoot[root] = newΔTtail() δBtail.byRoot[root] = newΔTtail()
} }
*/
// XXX update diff XXX here? or as separate step? // XXX update diff XXX here? or as separate step?
// XXX update lastRevOf // XXX update lastRevOf
...@@ -651,9 +655,6 @@ func (δBtail *ΔBtail) rebuild() (err error) { ...@@ -651,9 +655,6 @@ func (δBtail *ΔBtail) rebuild() (err error) {
// XXX dup wrt Update? // XXX dup wrt Update?
δZTC, δtopsByRoot := δZConnectTracked(δZ.Changev, trackNew)
// XXX len(δtopsByRoot) == 0 -> skip
var atPrev zodb.Tid var atPrev zodb.Tid
if i > 0 { if i > 0 {
atPrev = vδZ[i-1].Rev atPrev = vδZ[i-1].Rev
...@@ -661,6 +662,17 @@ func (δBtail *ΔBtail) rebuild() (err error) { ...@@ -661,6 +662,17 @@ func (δBtail *ΔBtail) rebuild() (err error) {
atPrev = δBtail.δZtail.Tail() atPrev = δBtail.δZtail.Tail()
} }
δZTC, δtopsByRoot := δZConnectTracked(δZ.Changev, trackNew)
tracef("\nrebuild @%s <- @%s\n", atPrev, δZ.Rev)
tracef("δZ:\t%v\n", δZ.Changev)
tracef("trackNew: %v\n", trackNew)
tracef("trackIdx: %v\n", δBtail.trackIdx) // XXX needed?
defer tracef("\n\n")
// XXX len(δtopsByRoot) == 0 -> skip
// open ZODB connection corresponding to "current" and "prev" states // open ZODB connection corresponding to "current" and "prev" states
txn, ctx := transaction.New(context.TODO()) txn, ctx := transaction.New(context.TODO())
defer txn.Abort() // XXX -> into func() or don't use defer defer txn.Abort() // XXX -> into func() or don't use defer
...@@ -682,6 +694,8 @@ func (δBtail *ΔBtail) rebuild() (err error) { ...@@ -682,6 +694,8 @@ func (δBtail *ΔBtail) rebuild() (err error) {
return err return err
} }
tracef("-> root<%s> δkv*: %v\n", root, δT)
if len(δT) == 0 { // an object might be resaved without change if len(δT) == 0 { // an object might be resaved without change
continue continue
} }
...@@ -700,7 +714,6 @@ func (δBtail *ΔBtail) rebuild() (err error) { ...@@ -700,7 +714,6 @@ func (δBtail *ΔBtail) rebuild() (err error) {
// XXX lastRevOf: ..., // XXX lastRevOf: ...,
} }
δBtail.byRoot[root] = δTtail δBtail.byRoot[root] = δTtail
} }
// δTtail.vδT[i] <- merge δT* // δTtail.vδT[i] <- merge δT*
...@@ -784,6 +797,8 @@ func (δBtail *ΔBtail) Update(δZ *zodb.EventCommit) (_ ΔB, err error) { ...@@ -784,6 +797,8 @@ func (δBtail *ΔBtail) Update(δZ *zodb.EventCommit) (_ ΔB, err error) {
return ΔB{}, err return ΔB{}, err
} }
tracef("\n-> root<%s> δkv: %v\n", root, δT)
if len(δT) > 0 { // an object might be resaved without change if len(δT) > 0 { // an object might be resaved without change
δB.ByRoot[root] = δT δB.ByRoot[root] = δT
δTtail, ok := δBtail.byRoot[root] δTtail, ok := δBtail.byRoot[root]
......
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