Commit 646ac661 authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent 90abcd03
...@@ -298,27 +298,6 @@ func (δFtail *ΔFtail) Track(file *ZBigFile, blk int64, path []btree.LONode, bl ...@@ -298,27 +298,6 @@ func (δFtail *ΔFtail) Track(file *ZBigFile, blk int64, path []btree.LONode, bl
} }
} }
// rebuildAll rebuilds vδE for all files from trackNew requests.
func (δFtail *ΔFtail) rebuildAll() (err error) {
defer xerr.Contextf(&err, "ΔFtail rebuildAll")
// XXX locking
δBtail := δFtail.δBtail
δZtail := δBtail.ΔZtail()
db := δBtail.DB()
for foid := range δFtail.trackNew {
δFtail.trackNew.Del(foid)
δftail := δFtail.byFile[foid]
δftail.vδE, err = vδEBuild(foid, δZtail, db)
if err != nil {
δFtail.trackNew.Add(foid)
return err
}
}
return nil
}
// rebuild1IfNeeded rebuilds vδE for a file if there is such need. // rebuild1IfNeeded rebuilds vδE for a file if there is such need.
// //
// It also returns corresponding δftail.root for convenience. // It also returns corresponding δftail.root for convenience.
...@@ -374,6 +353,29 @@ func (δFtail *ΔFtail) rebuild1IfNeeded(foid zodb.Oid) (vδE []_ΔFileEpoch, he ...@@ -374,6 +353,29 @@ func (δFtail *ΔFtail) rebuild1IfNeeded(foid zodb.Oid) (vδE []_ΔFileEpoch, he
return vδE, root, err return vδE, root, err
} }
// _rebuildAll rebuilds vδE for all files from trackNew requests.
//
// must be calledwith δFtail.mu locked.
func (δFtail *ΔFtail) _rebuildAll() (err error) {
defer xerr.Contextf(&err, "ΔFtail rebuildAll")
δBtail := δFtail.δBtail
δZtail := δBtail.ΔZtail()
db := δBtail.DB()
for foid := range δFtail.trackNew {
δFtail.trackNew.Del(foid)
δftail := δFtail.byFile[foid]
// no need to set δftail.rebuildJob - we are under lock
δftail.vδE, err = vδEBuild(foid, δZtail, db)
if err != nil {
δFtail.trackNew.Add(foid)
return err
}
}
return nil
}
// Update updates δFtail given raw ZODB changes. // Update updates δFtail given raw ZODB changes.
// //
// It returns change in files space that corresponds to δZ. // It returns change in files space that corresponds to δZ.
...@@ -388,7 +390,7 @@ func (δFtail *ΔFtail) Update(δZ *zodb.EventCommit) (_ ΔF, err error) { ...@@ -388,7 +390,7 @@ func (δFtail *ΔFtail) Update(δZ *zodb.EventCommit) (_ ΔF, err error) {
// TODO verify that there is no in-progress readers/writers // TODO verify that there is no in-progress readers/writers
// rebuild vδE for newly tracked files // rebuild vδE for newly tracked files
err = δFtail.rebuildAll() err = δFtail._rebuildAll()
if err != nil { if err != nil {
return ΔF{}, err return ΔF{}, err
} }
......
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