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
3563e821
Commit
3563e821
authored
3 years ago
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
cd9db582
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
27 additions
and
4 deletions
+27
-4
wcfs/internal/xbtree/δbtail.go
wcfs/internal/xbtree/δbtail.go
+27
-4
No files found.
wcfs/internal/xbtree/δbtail.go
View file @
3563e821
...
...
@@ -308,16 +308,28 @@ func (δBtail *ΔBtail) rebuildAll() (err error) {
tracefΔBtail
(
"
\n
RebuildAll @%s..@%s trackNewRoots: %s
\n
"
,
δBtail
.
Tail
(),
δBtail
.
Head
(),
δBtail
.
trackNewRoots
)
for
root
:=
range
δBtail
.
trackNewRoots
{
delete
(
δBtail
.
trackNewRoots
,
root
)
δBtail
.
rebuild1
(
root
)
}
return
nil
}
// rebuild1IfNeeded rebuilds ΔBtail for single root if that root needs rebuilding.
func
(
δBtail
*
ΔBtail
)
rebuild1IfNeeded
(
root
zodb
.
Oid
)
error
{
// XXX locking
_
,
ok
:=
δBtail
.
trackNewRoots
[
root
]
if
!
ok
{
return
nil
}
delete
(
δBtail
.
trackNewRoots
,
root
)
return
δBtail
.
rebuild1
(
root
)
}
// rebuild1 rebuilds ΔBtail for single root.
func
(
δBtail
*
ΔBtail
)
rebuild1
(
root
zodb
.
Oid
)
error
{
// XXX locking
delete
(
δBtail
.
trackNewRoots
,
root
)
δTtail
:=
δBtail
.
vδTbyRoot
[
root
]
// must be there
δtrackSet
,
δrevSet
,
err
:=
δTtail
.
rebuild
(
root
,
δBtail
.
δZtail
,
δBtail
.
db
)
if
err
!=
nil
{
...
...
@@ -328,6 +340,7 @@ func (δBtail *ΔBtail) rebuild1(root zodb.Oid) error {
return
nil
}
// rebuild rebuilds ΔTtail taking trackNew requests into account.
//
// It returns:
...
...
@@ -338,7 +351,7 @@ func (δBtail *ΔBtail) rebuild1(root zodb.Oid) error {
//
// XXX place
func
(
δTtail
*
ΔTtail
)
rebuild
(
root
zodb
.
Oid
,
δZtail
*
zodb
.
ΔTail
,
db
*
zodb
.
DB
)
(
δtrackSet
blib
.
PPTreeSubSet
,
δrevSet
setTid
,
err
error
)
{
defer
xerr
.
Context
(
&
err
,
"ΔTtail rebuild"
)
defer
xerr
.
Context
f
(
&
err
,
"ΔTtail<%s> rebuild"
,
root
)
// XXX locking
tracefΔBtail
(
"
\n
Rebuild %s @%s .. @%s
\n
"
,
root
,
δZtail
.
Tail
(),
δZtail
.
Head
())
...
...
@@ -765,13 +778,18 @@ func (δBtail *ΔBtail) GetAt(ctx context.Context, root *Tree, key Key, at zodb.
// XXX key not tracked -> panic
// XXX at not ∈ (tail, head] -> panic
// XXX
dirty -> rebuild
// XXX
locking
rootAt
:=
root
.
PJar
()
.
At
()
if
rootAt
!=
δBtail
.
Head
()
{
panicf
(
"δBtail: root.at (@%s) != head (@%s)"
,
rootAt
,
δBtail
.
Head
())
}
err
=
δBtail
.
rebuild1IfNeeded
(
root
.
POid
())
if
err
!=
nil
{
return
}
δTtail
:=
δBtail
.
vδTbyRoot
[
root
.
POid
()]
if
δTtail
==
nil
{
panicf
(
"δBtail: root<%s> not tracked"
,
root
.
POid
())
...
...
@@ -842,7 +860,12 @@ func (δBtail *ΔBtail) GetAt(ctx context.Context, root *Tree, key Key, at zodb.
func
(
δBtail
*
ΔBtail
)
SliceByRootRev
(
root
zodb
.
Oid
,
lo
,
hi
zodb
.
Tid
)
/*readonly*/
[]
ΔTree
{
xtail
.
AssertSlice
(
δBtail
,
lo
,
hi
)
// XXX locking
// XXX rebuild
err
:=
δBtail
.
rebuild1IfNeeded
(
root
)
if
err
!=
nil
{
panic
(
err
)
// XXX
}
δTtail
,
ok
:=
δBtail
.
vδTbyRoot
[
root
]
if
!
ok
{
return
[]
ΔTree
{}
...
...
This diff is collapsed.
Click to expand it.
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