Commit 855ab4b8 authored by Kirill Smelkov's avatar Kirill Smelkov

X ΔBtail: Goodbye .KVAtTail

Use ΔValue.Old for closest to tail entry instead.
parent 3275f8a0
...@@ -117,9 +117,6 @@ type ΔTtail struct { ...@@ -117,9 +117,6 @@ type ΔTtail struct {
trackNew blib.PPTreeSubSet trackNew blib.PPTreeSubSet
// XXX + trackNewKeys RangedKeySet // XXX + trackNewKeys RangedKeySet
// {}k/v @tail for keys that are changed in (tail, head].
KVAtTail map[Key]Value // XXX not needed since vδT has ΔValue ?
// index for LastRevOf queries // index for LastRevOf queries
lastRevOf map[Key]zodb.Tid // {} key -> last lastRevOf map[Key]zodb.Tid // {} key -> last
} }
...@@ -168,7 +165,6 @@ func NewΔBtail(at0 zodb.Tid, db *zodb.DB) *ΔBtail { ...@@ -168,7 +165,6 @@ func NewΔBtail(at0 zodb.Tid, db *zodb.DB) *ΔBtail {
func newΔTtail() *ΔTtail { func newΔTtail() *ΔTtail {
return &ΔTtail{ return &ΔTtail{
trackNew: blib.PPTreeSubSet{}, trackNew: blib.PPTreeSubSet{},
KVAtTail: make(map[Key]Value),
lastRevOf: make(map[Key]zodb.Tid), lastRevOf: make(map[Key]zodb.Tid),
} }
} }
...@@ -211,10 +207,6 @@ func (orig *ΔTtail) Clone() *ΔTtail { ...@@ -211,10 +207,6 @@ func (orig *ΔTtail) Clone() *ΔTtail {
klon := &ΔTtail{} klon := &ΔTtail{}
klon.vδT = vδTClone(orig.vδT) klon.vδT = vδTClone(orig.vδT)
klon.trackNew = orig.trackNew.Clone() klon.trackNew = orig.trackNew.Clone()
klon.KVAtTail = make(map[Key]Value, len(orig.KVAtTail))
for k, v := range orig.KVAtTail {
klon.KVAtTail[k] = v
}
klon.lastRevOf = make(map[Key]zodb.Tid, len(orig.lastRevOf)) klon.lastRevOf = make(map[Key]zodb.Tid, len(orig.lastRevOf))
for k, rev := range orig.lastRevOf { for k, rev := range orig.lastRevOf {
klon.lastRevOf[k] = rev klon.lastRevOf[k] = rev
...@@ -389,7 +381,7 @@ func (δTtail *ΔTtail) rebuild(root zodb.Oid, δZtail *zodb.ΔTail, db *zodb.DB ...@@ -389,7 +381,7 @@ func (δTtail *ΔTtail) rebuild(root zodb.Oid, δZtail *zodb.ΔTail, db *zodb.DB
δrevSet.Add(δZ.Rev) δrevSet.Add(δZ.Rev)
} }
// XXX update .KVAtTail, .lastRevOf // XXX update .lastRevOf
} }
// an iteration closer to tail may turn out to add a key to the tracking set. // an iteration closer to tail may turn out to add a key to the tracking set.
...@@ -546,7 +538,7 @@ func (δTtail *ΔTtail) rebuild1(atPrev zodb.Tid, δZ zodb.ΔRevEntry, trackNew ...@@ -546,7 +538,7 @@ func (δTtail *ΔTtail) rebuild1(atPrev zodb.Tid, δZ zodb.ΔRevEntry, trackNew
} }
} }
// XXX update .KVAtTail, .lastRevOf (here?) // XXX update .lastRevOf (here?)
return δtrack, δtkeycov, newRevEntry, nil return δtrack, δtkeycov, newRevEntry, nil
} }
...@@ -600,7 +592,6 @@ func (δBtail *ΔBtail) Update(δZ *zodb.EventCommit) (_ ΔB, err error) { ...@@ -600,7 +592,6 @@ func (δBtail *ΔBtail) Update(δZ *zodb.EventCommit) (_ ΔB, err error) {
} }
} }
// XXX rebuild KVAtTail
// XXX rebuild lastRevOf // XXX rebuild lastRevOf
} }
...@@ -741,7 +732,7 @@ func (δBtail *ΔBtail) ForgetPast(revCut zodb.Tid) { ...@@ -741,7 +732,7 @@ func (δBtail *ΔBtail) ForgetPast(revCut zodb.Tid) {
} }
func (δTtail *ΔTtail) forgetPast(revCut zodb.Tid) { func (δTtail *ΔTtail) forgetPast(revCut zodb.Tid) {
// XXX KVAtTail, lastRevOf // XXX lastRevOf
icut := 0 icut := 0
for ; icut < len(δTtail.vδT); icut++ { for ; icut < len(δTtail.vδT); icut++ {
...@@ -810,13 +801,6 @@ func (δBtail *ΔBtail) GetAt(ctx context.Context, root *Tree, key Key, at zodb. ...@@ -810,13 +801,6 @@ func (δBtail *ΔBtail) GetAt(ctx context.Context, root *Tree, key Key, at zodb.
// key not in history tail at all. // key not in history tail at all.
// use @head[key] // use @head[key]
/*
// XXX kill KVAtTail completely
value, ok = δTtail.KVAtTail[key] // XXX kill - just use δvalue.Old from next-to-at entry
if ok {
return
}
*/
// @tail[key] is not present - key was not changing in (tail, head]. // @tail[key] is not present - key was not changing in (tail, head].
// since at ∈ (tail, head] we can use @head[key] as the result // since at ∈ (tail, head] we can use @head[key] as the result
......
...@@ -1564,7 +1564,7 @@ func _KAdj(t1, t2 *xbtreetest.Commit, keysv ...setKey) (kadj KAdjMatrix) { ...@@ -1564,7 +1564,7 @@ func _KAdj(t1, t2 *xbtreetest.Commit, keysv ...setKey) (kadj KAdjMatrix) {
// it also verifies that δbtail.vδBroots matches ΔTtail data. // it also verifies that δbtail.vδBroots matches ΔTtail data.
func assertΔTtail(t *testing.T, subj string, δbtail *ΔBtail, tj *xbtreetest.Commit, treeRoot zodb.Oid, xat map[zodb.Tid]string, vδTok ...map[Key]Δstring) { func assertΔTtail(t *testing.T, subj string, δbtail *ΔBtail, tj *xbtreetest.Commit, treeRoot zodb.Oid, xat map[zodb.Tid]string, vδTok ...map[Key]Δstring) {
t.Helper() t.Helper()
// XXX +KVAtTail, +lastRevOf // XXX +lastRevOf
l := len(vδTok) l := len(vδTok)
var vatOK []zodb.Tid var vatOK []zodb.Tid
......
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