Commit 1679ddf1 authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent 0e46b293
...@@ -379,13 +379,13 @@ func (δFtail *ΔFtail) Update(δZ *zodb.EventCommit) (_ ΔF, err error) { ...@@ -379,13 +379,13 @@ func (δFtail *ΔFtail) Update(δZ *zodb.EventCommit) (_ ΔF, err error) {
} }
// take btree changes into account // take btree changes into account
// fmt.Printf("δB.ΔByRoot: %v\n", δB.ΔByRoot) //fmt.Printf("δB.ΔByRoot: %v\n", δB.ΔByRoot)
for root, δt := range δB.ΔByRoot { for root, δt := range δB.ΔByRoot {
// fmt.Printf("root: %v δt: %v\n", root, δt) //fmt.Printf("root: %v δt: %v\n", root, δt)
files := δFtail.fileIdx[root] files := δFtail.fileIdx[root]
if len(files) == 0 { // NOTE files might be empty e.g. if a zfile was tracked, then
panicf("BUG: ΔFtail: root<%s> -> ø files", root) // deleted, but the tree referenced by zfile.blktab is still
} // not-deleted, remains tracked and is changed.
for file := range files { for file := range files {
δfile, ok := δF.ByFile[file] δfile, ok := δF.ByFile[file]
if !ok { if !ok {
...@@ -393,7 +393,6 @@ func (δFtail *ΔFtail) Update(δZ *zodb.EventCommit) (_ ΔF, err error) { ...@@ -393,7 +393,6 @@ func (δFtail *ΔFtail) Update(δZ *zodb.EventCommit) (_ ΔF, err error) {
δF.ByFile[file] = δfile δF.ByFile[file] = δfile
} }
for blk /*, δzblk*/ := range δt { for blk /*, δzblk*/ := range δt {
// XXX document, and in particular how to include atTail
δfile.Blocks.Add(blk) δfile.Blocks.Add(blk)
} }
...@@ -446,7 +445,7 @@ func (δFtail *ΔFtail) Update(δZ *zodb.EventCommit) (_ ΔF, err error) { ...@@ -446,7 +445,7 @@ func (δFtail *ΔFtail) Update(δZ *zodb.EventCommit) (_ ΔF, err error) {
if len(inblk) == 0 { if len(inblk) == 0 {
continue continue
} }
// fmt.Printf("root: %v inblk: %v\n", root, inblk) //fmt.Printf("root: %v inblk: %v\n", root, inblk)
files := δFtail.fileIdx[root] files := δFtail.fileIdx[root]
for file := range files { for file := range files {
δfile, ok := δF.ByFile[file] δfile, ok := δF.ByFile[file]
...@@ -473,10 +472,26 @@ func (δFtail *ΔFtail) Update(δZ *zodb.EventCommit) (_ ΔF, err error) { ...@@ -473,10 +472,26 @@ func (δFtail *ΔFtail) Update(δZ *zodb.EventCommit) (_ ΔF, err error) {
// XXX + rebuild XXX not here - in track(new file) // XXX + rebuild XXX not here - in track(new file)
_ = δ
//fmt.Printf("δZBigFile: %v\n", δ) //fmt.Printf("δZBigFile: %v\n", δ)
// XXX update .fileIdx // update .fileIdx
if δ.blktabOld != xbtree.VDEL {
files, ok := δFtail.fileIdx[δ.blktabOld]
if ok {
files.Del(foid)
if len(files) == 0 {
delete(δFtail.fileIdx, δ.blktabOld)
}
}
}
if δ.blktabNew != xbtree.VDEL {
files, ok := δFtail.fileIdx[δ.blktabNew]
if !ok {
files = setOid{}
δFtail.fileIdx[δ.blktabNew] = files
}
files.Add(foid)
}
} }
// fmt.Printf("-> δF: %v\n", δF) // fmt.Printf("-> δF: %v\n", δF)
......
...@@ -485,6 +485,16 @@ func testΔFtail(t_ *testing.T, testq chan ΔFTestEntry) { ...@@ -485,6 +485,16 @@ func testΔFtail(t_ *testing.T, testq chan ΔFTestEntry) {
vδE = vδE[icut:] vδE = vδE[icut:]
} }
// verify δFtail.fileIdx
fileIdxOK := map[zodb.Oid]setOid{}
if !delfile {
__ := setOid{}; __.Add(foid)
fileIdxOK[t.Root()] = __
}
if !reflect.DeepEqual(δFtail.fileIdx, fileIdxOK) {
t.Errorf("fileIdx:\nhave: %v\nwant: %v", δFtail.fileIdx, fileIdxOK)
}
// verify δftail.root // verify δftail.root
δftail := δFtail.byFile[foid] δftail := δFtail.byFile[foid]
rootOK := t.Root() rootOK := t.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