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
d0481d4c
Commit
d0481d4c
authored
Oct 08, 2021
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
77c4efc7
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
24 additions
and
26 deletions
+24
-26
wcfs/internal/xbtree/δbtail.go
wcfs/internal/xbtree/δbtail.go
+24
-26
No files found.
wcfs/internal/xbtree/δbtail.go
View file @
d0481d4c
...
...
@@ -308,7 +308,7 @@ func (δBtail *ΔBtail) Head() zodb.Tid { return δBtail.δZtail.Head() }
func
(
δBtail
*
ΔBtail
)
Tail
()
zodb
.
Tid
{
return
δBtail
.
δZtail
.
Tail
()
}
// ---- Track/rebuild/Update/Forget ----
// ---- Track/
snapshot+
rebuild/Update/Forget ----
// Track adds tree path to tracked set.
//
...
...
@@ -388,7 +388,7 @@ func (δBtail *ΔBtail) track(path []zodb.Oid, keycov KeyRange) {
tracefΔBtail
(
"->T: nop
\n
"
)
path_
:=
δBtail
.
trackSet
.
Path
(
leaf
)
if
!
pathEqual
(
path
,
path_
)
{
panicf
(
"BUG: key
range
%s is already tracked via path=%v
\n
track requests path=%v"
,
keycov
,
path_
,
path
)
panicf
(
"BUG: key
cov
%s is already tracked via path=%v
\n
track requests path=%v"
,
keycov
,
path_
,
path
)
}
return
}
...
...
@@ -404,7 +404,7 @@ func (δBtail *ΔBtail) track(path []zodb.Oid, keycov KeyRange) {
tracefΔBtail
(
"->T: nop
\n
"
)
path_
:=
δTtail
.
trackNew
.
Path
(
leaf
)
if
!
pathEqual
(
path
,
path_
)
{
panicf
(
"BUG: key
range
%s is already in trackNew via path=%v
\n
track requests path=%v"
,
keycov
,
path_
,
path
)
panicf
(
"BUG: key
cov
%s is already in trackNew via path=%v
\n
track requests path=%v"
,
keycov
,
path_
,
path
)
}
return
}
...
...
@@ -417,27 +417,6 @@ func (δBtail *ΔBtail) track(path []zodb.Oid, keycov KeyRange) {
tracefΔBtail
(
"->T: [%s].ktrackNew -> %s
\n
"
,
root
,
δTtail
.
ktrackNew
)
}
// rebuildAll rebuilds ΔBtail taking all trackNew requests into account.
// XXX inline into _Update1 ?
func
(
δBtail
*
ΔBtail
)
rebuildAll
()
(
err
error
)
{
defer
xerr
.
Context
(
&
err
,
"ΔBtail rebuildAll"
)
// XXX locking correct?
δBtail
.
mu
.
Lock
()
defer
δBtail
.
mu
.
Unlock
()
tracefΔBtail
(
"
\n
RebuildAll @%s..@%s trackNewRoots: %s
\n
"
,
δBtail
.
Tail
(),
δBtail
.
Head
(),
δBtail
.
trackNewRoots
)
for
root
:=
range
δBtail
.
trackNewRoots
{
δTtail
:=
δBtail
.
byRoot
[
root
]
// must be there
err
=
δTtail
.
_runRebuildJob
(
root
,
δBtail
)
if
err
!=
nil
{
return
err
}
}
return
nil
}
// vδTSnapForTrackedKey returns vδT snapshot for root that takes into account
// at least all previous Track requests related to key.
//
...
...
@@ -588,7 +567,6 @@ func (δTtail *_ΔTtail) _runRebuildJob(root zodb.Oid, δBtail *ΔBtail) (err er
return
err
}
// Update updates δB with object-level ZODB changes.
//
// Only those objects from δZ that belong to tracked set are guaranteed to be
...
...
@@ -733,6 +711,26 @@ func (δBtail *ΔBtail) _Update1(δZ *zodb.EventCommit) (δB1 _ΔBUpdate1, err e
return
δB1
,
nil
}
// rebuildAll rebuilds ΔBtail taking all trackNew requests into account.
func
(
δBtail
*
ΔBtail
)
rebuildAll
()
(
err
error
)
{
defer
xerr
.
Context
(
&
err
,
"ΔBtail rebuildAll"
)
// XXX locking correct?
δBtail
.
mu
.
Lock
()
defer
δBtail
.
mu
.
Unlock
()
tracefΔBtail
(
"
\n
RebuildAll @%s..@%s trackNewRoots: %s
\n
"
,
δBtail
.
Tail
(),
δBtail
.
Head
(),
δBtail
.
trackNewRoots
)
for
root
:=
range
δBtail
.
trackNewRoots
{
δTtail
:=
δBtail
.
byRoot
[
root
]
// must be there
err
=
δTtail
.
_runRebuildJob
(
root
,
δBtail
)
if
err
!=
nil
{
return
err
}
}
return
nil
}
// _vδBroots_Update updates .vδBroots to remember that _ΔTtail for root has
// changed entries with δrevSet revisions.
//
...
...
@@ -953,7 +951,7 @@ func (δBtail *ΔBtail) SliceByRootRev(root zodb.Oid, lo, hi zodb.Tid) (/*readon
}
// ---- vδTBuild/vδTMerge ----
// ---- vδTBuild/vδTMerge
(rebuild core)
----
// vδTBuild builds vδT from vδZ for root/tracked=trackNew.
//
...
...
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