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

.

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