Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
W
wendelin.core
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Labels
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
Kirill Smelkov
wendelin.core
Commits
16ea27e7
Commit
16ea27e7
authored
Aug 17, 2021
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
3054ccfd
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
19 deletions
+19
-19
wcfs/internal/xbtree/δbtail.go
wcfs/internal/xbtree/δbtail.go
+19
-19
No files found.
wcfs/internal/xbtree/δbtail.go
View file @
16ea27e7
...
...
@@ -81,13 +81,13 @@ type ΔBtail struct {
// includes all changed objects, not only tracked ones.
δZtail
*
zodb
.
ΔTail
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δBroots
[]
_ΔBroots
// [] (rev↑, roots changed in this rev)
vδTbyRoot
map
[
zodb
.
Oid
]
*
_
ΔTtail
// {} root -> [] k/v change history; only for keys ∈ tracked subset
// set of tracked nodes as of @head state.
// For this set all vδT are fully computed.
// 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
// set of trees for which .trackNew is non-empty
...
...
@@ -98,10 +98,10 @@ type ΔBtail struct {
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.
type
ΔTtail
struct
{
type
_
ΔTtail
struct
{
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
...
...
@@ -146,16 +146,16 @@ func NewΔBtail(at0 zodb.Tid, db *zodb.DB) *ΔBtail {
return
&
ΔBtail
{
δZtail
:
zodb
.
NewΔTail
(
at0
),
vδBroots
:
nil
,
vδTbyRoot
:
map
[
zodb
.
Oid
]
*
ΔTtail
{},
vδTbyRoot
:
map
[
zodb
.
Oid
]
*
_
ΔTtail
{},
trackSet
:
blib
.
PPTreeSubSet
{},
trackNewRoots
:
setOid
{},
db
:
db
,
}
}
// newΔTtail creates new empty ΔTtail object.
func
newΔTtail
()
*
ΔTtail
{
return
&
ΔTtail
{
// newΔTtail creates new empty
_
ΔTtail object.
func
newΔTtail
()
*
_
ΔTtail
{
return
&
_
ΔTtail
{
trackNew
:
blib
.
PPTreeSubSet
{},
lastRevOf
:
make
(
map
[
Key
]
zodb
.
Tid
),
}
...
...
@@ -182,7 +182,7 @@ func (orig *ΔBtail) Clone() *ΔBtail {
}
// 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
{
klon
.
vδTbyRoot
[
root
]
=
origΔTtail
.
Clone
()
}
...
...
@@ -194,9 +194,9 @@ func (orig *ΔBtail) Clone() *ΔBtail {
return
klon
}
// Clone returns copy of ΔTtail.
func
(
orig
*
ΔTtail
)
Clone
()
*
ΔTtail
{
klon
:=
&
ΔTtail
{}
// Clone returns copy of
_
ΔTtail.
func
(
orig
*
_ΔTtail
)
Clone
()
*
_
ΔTtail
{
klon
:=
&
_
ΔTtail
{}
klon
.
vδT
=
vδTClone
(
orig
.
vδT
)
klon
.
trackNew
=
orig
.
trackNew
.
Clone
()
klon
.
lastRevOf
=
make
(
map
[
Key
]
zodb
.
Tid
,
len
(
orig
.
lastRevOf
))
...
...
@@ -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:
//
...
...
@@ -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.
//
// 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
)
// XXX locking
...
...
@@ -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` .
// 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
)
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
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.
//
// XXX place TODO δrevSet -> []rev↑
...
...
@@ -723,7 +723,7 @@ func (δBtail *ΔBtail) ForgetPast(revCut zodb.Tid) {
// 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
for
;
icut
<
len
(
δBtail
.
vδBroots
);
icut
++
{
δBroots
:=
δBtail
.
vδBroots
[
icut
]
...
...
@@ -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 lastRevOf
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment