Commit 7bd1ae31 authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent b56cada6
...@@ -195,27 +195,34 @@ func (δb *ΔTail) Track(path []Node) { // XXX Tree|Bucket; path[0] = root ...@@ -195,27 +195,34 @@ func (δb *ΔTail) Track(path []Node) { // XXX Tree|Bucket; path[0] = root
// taken into account. In other words a tree history will assuredly include // taken into account. In other words a tree history will assuredly include
// only those keys, that correspond to tracked subset of δZ. // only those keys, that correspond to tracked subset of δZ.
// //
// XXX return -> [] of (root, []key) that are invalidated. // XXX returned [](root, []key) -> move to separate SliceByRev to get diff?
// XXX -> + separate SliceByRev? or Data to get diff? func (btail *ΔTail) Update(δZ *zodb.EventCommit) (δB ΔRevEntry) {
func (δB *ΔTail) Update(δZ *zodb.EventCommit) { btail.δZtail.Append(δZ.Tid, δZ.Changev)
/*
.δZtail += δZ
*/
δB.update()
}
// update brings .δBtail up to date by recomputing diff XXX and taking new // {} root -> []oid changed under that root
// entries in .δZtail into account. δZByRoot := map[*Tree][]zodb.Oid{} // XXX -> map[*Tree]SetOid ?
func (δB *ΔTail) update() { for _, δ := range δZ.Changev {
/* roots, ok := btail.trackIdx[δ]
δbZ = {} if !ok {
for δ in δZ: continue
.trackIdx[δ]: }
ø -> nothing for root := range roots {
root -> δbZ[root] += δ δZByRoot[root] = append(δZByRoot[root], δ)
}
}
δB.Rev = δZ.Tid
if len(δZByRoot) == 0 {
return δB // tracked set not changed
}
// XXX stub to get file.size invalidation working
for root := range δZByRoot {
δB.Changev = append(δB.Changev, ΔTree{root, nil})
}
return δB
if δbZ == ø: /* TODO btree-diff:
return
zconnNew = db.Open(δZ.rev) zconnNew = db.Open(δZ.rev)
defer(zconnNew.close) defer(zconnNew.close)
...@@ -235,19 +242,23 @@ func (δB *ΔTail) update() { ...@@ -235,19 +242,23 @@ func (δB *ΔTail) update() {
*/ */
} }
// update brings .δBtail up to date by recomputing diff XXX and taking new
// entries in .δZtail into account.
// func (btail *ΔTail) update()
// XXX -> Get(root, key, at) -> (valueOid, rev) ? // XXX -> Get(root, key, at) -> (valueOid, rev) ?
func (δB *ΔTail) LastRevOf(root Tree, key Key, at zodb.Tid) (_ zodb.Tid, exact bool) { func (btail *ΔTail) LastRevOf(root Tree, key Key, at zodb.Tid) (_ zodb.Tid, exact bool) {
/* /*
lastRevOf = δB.lastRevOf[root] lastRevOf = btail.lastRevOf[root]
rev = lastRevOf[key] rev = lastRevOf[key]
while rev > at: while rev > at:
rev = scan δB.δBtail ↓ looking for change(key) # XXX linear scan rev = scan btail.δBtail ↓ looking for change(key) # XXX linear scan
return rev return rev
*/ */
return 0, false // XXX stub (saying take only ZBlk.rev into account) return 0, false // XXX stub (saying take only ZBlk.rev into account)
} }
func (δB *ΔTail) ForgetPast(revCut zodb.Tid) { func (btail *ΔTail) ForgetPast(revCut zodb.Tid) {
δB.δZtail.ForgetPast(revCut) // XXX stub btail.δZtail.ForgetPast(revCut) // XXX stub
} }
...@@ -705,8 +705,7 @@ func (δf *ΔFTail) Track(file *BigFile, path []btree.LONode) { ...@@ -705,8 +705,7 @@ func (δf *ΔFTail) Track(file *BigFile, path []btree.LONode) {
} }
func (δf *ΔFTail) Update(δZ *zodb.EventCommit) ΔFentry { func (δf *ΔFTail) Update(δZ *zodb.EventCommit) ΔFentry {
δf.ΔTail.Update(δZ) δB := δf.ΔTail.Update(δZ)
δB := xbtree.ΔRevEntry{} // XXX stub
var changev []ΔFile // δB.Changev root -> file (via .fileIdx) var changev []ΔFile // δB.Changev root -> file (via .fileIdx)
for _, δ := range δB.Changev { for _, δ := range δB.Changev {
files := δf.fileIdx[δ.Root] files := δf.fileIdx[δ.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