Commit 8316aa92 authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent 55fdc2c1
...@@ -339,43 +339,11 @@ func (δftail *_ΔFileTail) _rebuild1(foid zodb.Oid, δZtail *zodb.ΔTail, db *z ...@@ -339,43 +339,11 @@ func (δftail *_ΔFileTail) _rebuild1(foid zodb.Oid, δZtail *zodb.ΔTail, db *z
panic("rebuild1: vδE != nil") panic("rebuild1: vδE != nil")
} }
vδE := []_ΔFileEpoch{} vδE, err := vδEBuild(foid, δZtail, db)
vδZ := δZtail.Data()
atPrev := δZtail.Tail()
for i := 0; i < len(vδZ); i++ {
δZ := vδZ[i]
fchanged := false
for _, oid := range δZ.Changev {
if oid == foid {
fchanged = true
break
}
}
if !fchanged {
continue
}
δ, err := zfilediff(db, foid, atPrev, δZ.Rev)
if err != nil { if err != nil {
return err return err
} }
if δ != nil {
δE := _ΔFileEpoch{
Rev: δZ.Rev,
oldRoot: δ.blktabOld,
newRoot: δ.blktabNew,
oldBlkSize: δ.blksizeOld,
newBlkSize: δ.blksizeNew,
oldTrackSetZBlk: nil, // nothing was tracked
}
vδE = append(vδE, δE)
}
atPrev = δZ.Rev
}
δftail.vδE = vδE δftail.vδE = vδE
return nil return nil
} }
...@@ -971,7 +939,53 @@ func (δFtail *ΔFtail) _BlkRevAt(ctx context.Context, zfile *ZBigFile, blk int6 ...@@ -971,7 +939,53 @@ func (δFtail *ΔFtail) _BlkRevAt(ctx context.Context, zfile *ZBigFile, blk int6
} }
// ---------------------------------------- // ---- vδEBuild (rebuild core) ----
// vδEBuild builds vδE from vδZ for file.
//
// XXX place ok?
func vδEBuild(foid zodb.Oid, δZtail *zodb.ΔTail, db *zodb.DB) (vδE []_ΔFileEpoch, err error) {
defer xerr.Contextf(&err, "file<%s>: build vδE", foid)
vδE = []_ΔFileEpoch{}
vδZ := δZtail.Data()
atPrev := δZtail.Tail()
for i := 0; i < len(vδZ); i++ {
δZ := vδZ[i]
fchanged := false
for _, oid := range δZ.Changev {
if oid == foid {
fchanged = true
break
}
}
if !fchanged {
continue
}
δ, err := zfilediff(db, foid, atPrev, δZ.Rev)
if err != nil {
return nil, err
}
if δ != nil {
δE := _ΔFileEpoch{
Rev: δZ.Rev,
oldRoot: δ.blktabOld,
newRoot: δ.blktabNew,
oldBlkSize: δ.blksizeOld,
newBlkSize: δ.blksizeNew,
oldTrackSetZBlk: nil, // nothing was tracked
}
vδE = append(vδE, δE)
}
atPrev = δZ.Rev
}
return vδE, nil
}
// zfilediff returns direct difference for ZBigFile<foid> old..new . // zfilediff returns direct difference for ZBigFile<foid> old..new .
......
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