Commit a36307f2 authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent 73811795
......@@ -672,13 +672,13 @@ func (δTtail *_ΔTtail) __rebuild(root zodb.Oid, δBtail *ΔBtail, releaseLock
//
// TODO optionally accept zconnOld/zconnNew from client
func (δBtail *ΔBtail) Update(δZ *zodb.EventCommit) (_ ΔB, err error) {
headOld := δBtail.Head()
defer xerr.Contextf(&err, "ΔBtail.Update %s -> %s", headOld, δZ.Tid)
δBtail.mu.Lock()
defer δBtail.mu.Unlock()
// TODO verify that there is no in-progress readers/writers
headOld := δBtail.Head()
defer xerr.Contextf(&err, "ΔBtail.Update %s -> %s", headOld, δZ.Tid)
δB1, err := δBtail._Update1(δZ)
δB := ΔB{Rev: δZ.Tid, ByRoot: make(map[zodb.Oid]map[Key]ΔValue)}
......
......@@ -316,6 +316,8 @@ func (δFtail *ΔFtail) rebuildAll() (err error) {
//
// it returns corresponding δftail for convenience. XXX
// the only case when vδE actually needs to be rebuilt is when the file just started to be tracked.
//
// XXX naming -> vδEForFile ?
func (δFtail *ΔFtail) rebuild1IfNeeded(foid zodb.Oid) (vδE []_ΔFileEpoch, headRoot zodb.Oid, err error) {
δFtail.mu.Lock() // TODO verify that there is no in-progress writers
defer δFtail.mu.Unlock()
......@@ -359,12 +361,12 @@ func (δftail *_ΔFileTail) _rebuild1(foid zodb.Oid, δZtail *zodb.ΔTail, db *z
//
// δZ should include all objects changed by ZODB transaction.
func (δFtail *ΔFtail) Update(δZ *zodb.EventCommit) (_ ΔF, err error) {
defer xerr.Contextf(&err, "ΔFtail update %s -> %s", δFtail.Head(), δZ.Tid)
headOld := δFtail.Head()
defer xerr.Contextf(&err, "ΔFtail update %s -> %s", headOld, δZ.Tid)
// XXX locking
//δFtail.mu.Lock()
//defer δFtail.mu.Unlock()
//// TODO verify that there is no in-progress readers/writers
δFtail.mu.Lock()
defer δFtail.mu.Unlock()
// TODO verify that there is no in-progress readers/writers
// rebuild vδE for newly tracked files
err = δFtail.rebuildAll()
......@@ -372,7 +374,6 @@ func (δFtail *ΔFtail) Update(δZ *zodb.EventCommit) (_ ΔF, err error) {
return ΔF{}, err
}
headOld := δFtail.Head()
δB, err := δFtail.δBtail.Update(δZ)
if err != nil {
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