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
// taken into account. In other words a tree history will assuredly include
// only those keys, that correspond to tracked subset of δZ.
//
// XXX return -> [] of (root, []key) that are invalidated.
// XXX -> + separate SliceByRev? or Data to get diff?
func (δB *ΔTail) Update(δZ *zodb.EventCommit) {
/*
.δZtail += δZ
*/
δB.update()
}
// XXX returned [](root, []key) -> move to separate SliceByRev to get diff?
func (btail *ΔTail) Update(δZ *zodb.EventCommit) (δB ΔRevEntry) {
btail.δZtail.Append(δZ.Tid, δZ.Changev)
// update brings .δBtail up to date by recomputing diff XXX and taking new
// entries in .δZtail into account.
func (δB *ΔTail) update() {
/*
δbZ = {}
for δ in δZ:
.trackIdx[δ]:
ø -> nothing
root -> δbZ[root] += δ
// {} root -> []oid changed under that root
δZByRoot := map[*Tree][]zodb.Oid{} // XXX -> map[*Tree]SetOid ?
for _, δ := range δZ.Changev {
roots, ok := btail.trackIdx[δ]
if !ok {
continue
}
for root := range roots {
δ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 == ø:
return
/* TODO btree-diff:
zconnNew = db.Open(δZ.rev)
defer(zconnNew.close)
......@@ -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) ?
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]
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 0, false // XXX stub (saying take only ZBlk.rev into account)
}
func (δB *ΔTail) ForgetPast(revCut zodb.Tid) {
δB.δZtail.ForgetPast(revCut) // XXX stub
func (btail *ΔTail) ForgetPast(revCut zodb.Tid) {
btail.δZtail.ForgetPast(revCut) // XXX stub
}
......@@ -705,8 +705,7 @@ func (δf *ΔFTail) Track(file *BigFile, path []btree.LONode) {
}
func (δf *ΔFTail) Update(δZ *zodb.EventCommit) ΔFentry {
δf.ΔTail.Update(δZ)
δB := xbtree.ΔRevEntry{} // XXX stub
δB := δf.ΔTail.Update(δZ)
var changev []ΔFile // δB.Changev root -> file (via .fileIdx)
for _, δ := range δB.Changev {
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