Commit 312d0f25 authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent 588a512a
......@@ -627,7 +627,7 @@ func (δftail *_ΔFileTail) _forgetPast(revCut zodb.Tid) {
// - DelBlk(zblk, blk)
type _ZinblkOverlay struct {
Base map[zodb.Oid]setI64 // taken from _RootTrack.Zinblk or _ΔFileEpoch.oldZinblk
Adj map[zodb.Oid]setI64 // blk<0 reresents whitout
Adj map[zodb.Oid]setI64 // adjustement over base; blk<0 reresents whitout
}
// SliceByFileRev returns history of file changes in (lo, hi] range.
......@@ -718,7 +718,6 @@ func (δFtail *ΔFtail) SliceByFileRev(zfile *ZBigFile, lo, hi zodb.Tid) /*reado
var head zodb.Tid // head] of current epoch coverage
// state of Zinblk as we are scanning ← current epoch
// initially corresponds to head of the epoch (= @head for latest epoch)
// Zinblk := map[zodb.Oid]setI64{} // zblk -> which #blk refers to it
Zinblk := _ZinblkOverlay{} // zblk -> which #blk refers to it
var ZinblkAt zodb.Tid // Zinblk covers [ZinblkAt,<next δT>)
if ie+1 == le {
......@@ -728,18 +727,12 @@ func (δFtail *ΔFtail) SliceByFileRev(zfile *ZBigFile, lo, hi zodb.Tid) /*reado
rt, ok := δFtail.byRoot[root] // XXX locking
if ok {
Zinblk.Base = rt.Zinblk
// for zblk, inblk := range rt.Zinblk { // XXX -> no clone
// Zinblk[zblk] = inblk.Clone()
// }
}
} else {
δE := vδE[ie+1]
root = δE.oldRoot
head = δE.Rev - 1 // TODO better set to exact revision coming before δE.Rev
Zinblk.Base = δE.oldZinblk
// for zblk, inblk := range δE.oldZinblk {
// Zinblk[zblk] = inblk.Clone() // XXX -> no Clone needed
// }
}
//fmt.Printf("Zinblk: %v\n", Zinblk)
......@@ -791,16 +784,6 @@ func (δFtail *ΔFtail) SliceByFileRev(zfile *ZBigFile, lo, hi zodb.Tid) /*reado
}
}
}
/*
for zblk, inblkAdj := range ZinblkAdj {
inblk, ok := Zinblk[zblk]
if !ok {
Zinblk[zblk] = inblkAdj
} else {
inblk.Update(inblkAdj)
}
}
*/
// merge vδZ and vδT of current epoch
for ((iz >= 0 && vδZ[iz].Rev > epoch) || it >= 0) {
......@@ -830,19 +813,9 @@ func (δFtail *ΔFtail) SliceByFileRev(zfile *ZBigFile, lo, hi zodb.Tid) /*reado
// apply in reverse as we go ←
if δzblk.New != xbtree.VDEL {
Zinblk.DelBlk(δzblk.New, blk)
// inblk, ok := Zinblk[δzblk.New] // XXX
// if ok {
// inblk.Del(blk)
// }
}
if δzblk.Old != xbtree.VDEL {
Zinblk.AddBlk(δzblk.Old, blk)
// inblk, ok := Zinblk[δzblk.Old] // XXX
// if !ok {
// inblk = setI64{}
// Zinblk[δzblk.Old] = inblk
// }
// inblk.Add(blk)
}
if δT.Rev <= hi {
......@@ -884,6 +857,7 @@ func (δFtail *ΔFtail) SliceByFileRev(zfile *ZBigFile, lo, hi zodb.Tid) /*reado
// ZinblkOverlay XXX move closer to end?
// Get_ returns set(blk) for o[zoid].
func (o *_ZinblkOverlay) Get_(zoid zodb.Oid) (inblk /*readonly*/setI64, ok bool) {
base, bok := o.Base[zoid]
adj, aok := o.Adj[zoid]
......@@ -910,6 +884,7 @@ func (o *_ZinblkOverlay) Get_(zoid zodb.Oid) (inblk /*readonly*/setI64, ok bool)
return inblk, true
}
// DelBlk removes blk from o[zoid].
func (o *_ZinblkOverlay) DelBlk(zoid zodb.Oid, blk int64) {
if blk < 0 {
panic("blk < 0")
......@@ -917,6 +892,7 @@ func (o *_ZinblkOverlay) DelBlk(zoid zodb.Oid, blk int64) {
o._AddBlk(zoid, flipsign(blk))
}
// AddBlk adds blk to o[zoid].
func (o *_ZinblkOverlay) AddBlk(zoid zodb.Oid, blk int64) {
if blk < 0 {
panic("blk < 0")
......
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