Commit 0ad20539 authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent 351cc95d
......@@ -87,6 +87,7 @@ type ΔTail struct {
}
// ΔRoots describes which BTrees were change in one revision.
// XXX kill?
type ΔRoots struct {
Rev zodb.Tid
Changev []*Tree // root XXX -> Oid? XXX -> SetTree?
......@@ -105,7 +106,8 @@ type ΔTreeTail struct {
// ΔTree describes changes to one BTree in one revision.
type ΔTree struct {
Rev zodb.Tid
Change map[Key]Value
Root *Tree // XXX ok to have here?
KV map[Key]Value
}
// NewΔTail creats new empty ΔTail object.
......@@ -175,7 +177,7 @@ func (δb *ΔTail) Track(path []Node) { // XXX Tree|Bucket; path[0] = root
// only those keys, that correspond to tracked subset of δZ.
//
// XXX returned [](root, []key) -> move to separate SliceByRev to get diff?
func (btail *ΔTail) Update(δZ *zodb.EventCommit) (δB ΔRoots) {
func (btail *ΔTail) Update(δZ *zodb.EventCommit) []ΔTree {
btail.δZtail.Append(δZ.Tid, δZ.Changev)
// {} root -> []oid changed under that root
......@@ -190,14 +192,14 @@ func (btail *ΔTail) Update(δZ *zodb.EventCommit) (δB ΔRoots) {
}
}
δB.Rev = δZ.Tid
if len(δZByRoot) == 0 {
return δB // tracked set not changed
return nil // tracked set not changed
}
// XXX stub to get file.size invalidation working
var δB []ΔTree
for root := range δZByRoot {
δB.Changev = append(δB.Changev, root)
δB = append(δB, ΔTree{δZ.Tid, root, nil})
}
return δB
......
......@@ -68,22 +68,28 @@ func (δf *ΔFTail) Track(file *BigFile, path []btree.LONode) {
// XXX
func (δf *ΔFTail) Update(δZ *zodb.EventCommit) ΔFentry {
δB := δf.ΔTail.Update(δZ)
var changev []ΔFile // δB.Changev root -> file (via .fileIdx)
for _, δ := range δB.Changev {
var changev []ΔFile // δB root -> file (via .fileIdx)
for _, δ := range δB {
files := δf.fileIdx[δ.Root]
if len(files) == 0 {
panicf("ΔFTail: root<%s> -> ø file", δ.Root.POid())
}
for file := range files {
var blkv []int64
for blk /*, zblk*/ := range δ.KV {
// FIXME stub - need to take both keys and zblk changes into account
// XXX document, and in particular how to include atTail
blkv = append(blkv, blk)
}
changev = append(changev, ΔFile{
File: file,
Blkv: δ.Keyv,
Blkv: blkv,
})
}
}
return ΔFentry{
Rev: δB.Rev,
Rev: δZ.Tid,
Changev: changev,
}
}
......
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