Commit 16ea27e7 authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent 3054ccfd
...@@ -82,12 +82,12 @@ type ΔBtail struct { ...@@ -82,12 +82,12 @@ type ΔBtail struct {
δZtail *zodb.ΔTail δZtail *zodb.ΔTail
vδBroots []_ΔBroots // [] (rev↑, roots changed in this rev) vδBroots []_ΔBroots // [] (rev↑, roots changed in this rev)
vδTbyRoot map[zodb.Oid]*ΔTtail // {} root -> [] k/v change history; only for keys ∈ tracked subset vδTbyRoot map[zodb.Oid]*_ΔTtail // {} root -> [] k/v change history; only for keys ∈ tracked subset
// set of tracked nodes as of @head state. // set of tracked nodes as of @head state.
// For this set all vδT are fully computed. // For this set all vδT are fully computed.
// The set of nodes that were requested to be tracked, but were not yet // The set of nodes that were requested to be tracked, but were not yet
// taken into account, is kept in ΔTtail.trackNew & co. // taken into account, is kept in _ΔTtail.trackNew & co.
trackSet blib.PPTreeSubSet trackSet blib.PPTreeSubSet
// set of trees for which .trackNew is non-empty // set of trees for which .trackNew is non-empty
...@@ -98,10 +98,10 @@ type ΔBtail struct { ...@@ -98,10 +98,10 @@ type ΔBtail struct {
db *zodb.DB // to open connections to load new/old tree|buckets db *zodb.DB // to open connections to load new/old tree|buckets
} }
// ΔTtail represent tail of revisional changes to one BTree. // _ΔTtail represent tail of revisional changes to one BTree.
// //
// See ΔBtail documentation for details. // See ΔBtail documentation for details.
type ΔTtail struct { type _ΔTtail struct {
vδT []ΔTree // changes to tree keys; rev↑. covers keys ∈ tracked subset vδT []ΔTree // changes to tree keys; rev↑. covers keys ∈ tracked subset
// set of nodes that were requested to be tracked in this tree, but for // set of nodes that were requested to be tracked in this tree, but for
...@@ -146,16 +146,16 @@ func NewΔBtail(at0 zodb.Tid, db *zodb.DB) *ΔBtail { ...@@ -146,16 +146,16 @@ func NewΔBtail(at0 zodb.Tid, db *zodb.DB) *ΔBtail {
return &ΔBtail{ return &ΔBtail{
δZtail: zodb.NewΔTail(at0), δZtail: zodb.NewΔTail(at0),
vδBroots: nil, vδBroots: nil,
vδTbyRoot: map[zodb.Oid]*ΔTtail{}, vδTbyRoot: map[zodb.Oid]*_ΔTtail{},
trackSet: blib.PPTreeSubSet{}, trackSet: blib.PPTreeSubSet{},
trackNewRoots: setOid{}, trackNewRoots: setOid{},
db: db, db: db,
} }
} }
// newΔTtail creates new empty ΔTtail object. // newΔTtail creates new empty _ΔTtail object.
func newΔTtail() *ΔTtail { func newΔTtail() *_ΔTtail {
return &ΔTtail{ return &_ΔTtail{
trackNew: blib.PPTreeSubSet{}, trackNew: blib.PPTreeSubSet{},
lastRevOf: make(map[Key]zodb.Tid), lastRevOf: make(map[Key]zodb.Tid),
} }
...@@ -182,7 +182,7 @@ func (orig *ΔBtail) Clone() *ΔBtail { ...@@ -182,7 +182,7 @@ func (orig *ΔBtail) Clone() *ΔBtail {
} }
// vδTbyRoot // vδTbyRoot
klon.vδTbyRoot = make(map[zodb.Oid]*ΔTtail, len(orig.vδTbyRoot)) klon.vδTbyRoot = make(map[zodb.Oid]*_ΔTtail, len(orig.vδTbyRoot))
for root, origΔTtail := range orig.vδTbyRoot { for root, origΔTtail := range orig.vδTbyRoot {
klon.vδTbyRoot[root] = origΔTtail.Clone() klon.vδTbyRoot[root] = origΔTtail.Clone()
} }
...@@ -194,9 +194,9 @@ func (orig *ΔBtail) Clone() *ΔBtail { ...@@ -194,9 +194,9 @@ func (orig *ΔBtail) Clone() *ΔBtail {
return klon return klon
} }
// Clone returns copy of ΔTtail. // Clone returns copy of _ΔTtail.
func (orig *ΔTtail) Clone() *ΔTtail { 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.lastRevOf = make(map[Key]zodb.Tid, len(orig.lastRevOf)) klon.lastRevOf = make(map[Key]zodb.Tid, len(orig.lastRevOf))
...@@ -333,7 +333,7 @@ func (δBtail *ΔBtail) rebuild1(root zodb.Oid) error { ...@@ -333,7 +333,7 @@ func (δBtail *ΔBtail) rebuild1(root zodb.Oid) error {
} }
// rebuild rebuilds ΔTtail taking trackNew requests into account. // rebuild rebuilds _ΔTtail taking trackNew requests into account.
// //
// It returns: // It returns:
// //
...@@ -342,7 +342,7 @@ func (δBtail *ΔBtail) rebuild1(root zodb.Oid) error { ...@@ -342,7 +342,7 @@ func (δBtail *ΔBtail) rebuild1(root zodb.Oid) error {
// - set of revisions for which new entries in .vδT have been created. // - set of revisions for which new entries in .vδT have been created.
// //
// XXX place // XXX place
func (δTtail *ΔTtail) rebuild(root zodb.Oid, δZtail *zodb.ΔTail, db *zodb.DB) (δtrackSet blib.PPTreeSubSet, δrevSet setTid, err error) { func (δTtail *_ΔTtail) rebuild(root zodb.Oid, δZtail *zodb.ΔTail, db *zodb.DB) (δtrackSet blib.PPTreeSubSet, δrevSet setTid, err error) {
defer xerr.Contextf(&err, "ΔTtail<%s> rebuild", root) defer xerr.Contextf(&err, "ΔTtail<%s> rebuild", root)
// XXX locking // XXX locking
...@@ -463,7 +463,7 @@ func widenTrackNew(trackNew blib.PPTreeSubSet, δtkeycov *blib.RangedKeySet, roo ...@@ -463,7 +463,7 @@ func widenTrackNew(trackNew blib.PPTreeSubSet, δtkeycov *blib.RangedKeySet, roo
// //
// δtrackNew/δtkeycov represents how trackNew changes when going through `atPrev <- δZ.Rev` . // δtrackNew/δtkeycov represents how trackNew changes when going through `atPrev <- δZ.Rev` .
// newRevEntry indicates whether δZ.Rev was not there before in .vδT and new corresponding δT entry was created. // newRevEntry indicates whether δZ.Rev was not there before in .vδT and new corresponding δT entry was created.
func (δTtail *ΔTtail) rebuild1(atPrev zodb.Tid, δZ zodb.ΔRevEntry, trackNew blib.PPTreeSubSet, db *zodb.DB) (δtrackNew *blib.ΔPPTreeSubSet, δtkeycov *blib.RangedKeySet, newRevEntry bool, err error) { func (δTtail *_ΔTtail) rebuild1(atPrev zodb.Tid, δZ zodb.ΔRevEntry, trackNew blib.PPTreeSubSet, db *zodb.DB) (δtrackNew *blib.ΔPPTreeSubSet, δtkeycov *blib.RangedKeySet, newRevEntry bool, err error) {
defer xerr.Contextf(&err, "rebuild1 %s<-%s", atPrev, δZ.Rev) defer xerr.Contextf(&err, "rebuild1 %s<-%s", atPrev, δZ.Rev)
debugfΔBtail("\n rebuild1 @%s <- @%s\n", atPrev, δZ.Rev) debugfΔBtail("\n rebuild1 @%s <- @%s\n", atPrev, δZ.Rev)
...@@ -688,7 +688,7 @@ func (δBtail *ΔBtail) _Update1(δZ *zodb.EventCommit) (δB1 _ΔBUpdate1, err e ...@@ -688,7 +688,7 @@ func (δBtail *ΔBtail) _Update1(δZ *zodb.EventCommit) (δB1 _ΔBUpdate1, err e
return δB1, nil return δB1, nil
} }
// vδBroots_Update updates .vδBroots to remember that ΔTtail for root has // vδBroots_Update updates .vδBroots to remember that _ΔTtail for root has
// changed entries with δrevSet revisions. // changed entries with δrevSet revisions.
// //
// XXX place TODO δrevSet -> []rev↑ // XXX place TODO δrevSet -> []rev↑
...@@ -723,7 +723,7 @@ func (δBtail *ΔBtail) ForgetPast(revCut zodb.Tid) { ...@@ -723,7 +723,7 @@ func (δBtail *ΔBtail) ForgetPast(revCut zodb.Tid) {
// go through vδBroots till revcut -> find which trees to trim -> trim ΔTtails. // go through vδBroots till revcut -> find which trees to trim -> trim ΔTtails.
totrim := setOid{} // roots whose ΔTtail has changes ≤ revCut totrim := setOid{} // roots whose _ΔTtail has changes ≤ revCut
icut := 0 icut := 0
for ; icut < len(δBtail.vδBroots); icut++ { for ; icut < len(δBtail.vδBroots); icut++ {
δBroots := δBtail.vδBroots[icut] δBroots := δBtail.vδBroots[icut]
...@@ -743,7 +743,7 @@ func (δBtail *ΔBtail) ForgetPast(revCut zodb.Tid) { ...@@ -743,7 +743,7 @@ func (δBtail *ΔBtail) ForgetPast(revCut zodb.Tid) {
} }
} }
func (δTtail *ΔTtail) forgetPast(revCut zodb.Tid) { func (δTtail *_ΔTtail) forgetPast(revCut zodb.Tid) {
// XXX locking // XXX locking
// XXX lastRevOf // XXX lastRevOf
......
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