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
f6f34f76
Commit
f6f34f76
authored
Sep 22, 2021
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
d37f8481
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
35 additions
and
36 deletions
+35
-36
wcfs/internal/xbtree/δbtail.go
wcfs/internal/xbtree/δbtail.go
+35
-36
No files found.
wcfs/internal/xbtree/δbtail.go
View file @
f6f34f76
...
@@ -420,42 +420,6 @@ func (δTtail *_ΔTtail) rebuild(root zodb.Oid, δZtail *zodb.ΔTail, db *zodb.D
...
@@ -420,42 +420,6 @@ func (δTtail *_ΔTtail) rebuild(root zodb.Oid, δZtail *zodb.ΔTail, db *zodb.D
return
trackNew
,
δrevSet
,
nil
return
trackNew
,
δrevSet
,
nil
}
}
// widenTrackNew widens trackNew to cover δtkeycov.
func
widenTrackNew
(
trackNew
blib
.
PPTreeSubSet
,
δtkeycov
*
blib
.
RangedKeySet
,
root
zodb
.
Oid
,
at
zodb
.
Tid
,
db
*
zodb
.
DB
)
(
err
error
)
{
// XXX errctx, debug
defer
xerr
.
Contextf
(
&
err
,
"widenTrackNew tree<%s> @%s +%s"
,
root
,
at
,
δtkeycov
)
txn
,
ctx
:=
transaction
.
New
(
context
.
TODO
())
// XXX
defer
txn
.
Abort
()
zhead
,
err
:=
db
.
Open
(
ctx
,
&
zodb
.
ConnOptions
{
At
:
at
});
/*X*/
if
err
!=
nil
{
return
err
}
xtree
,
err
:=
zgetNodeOrNil
(
ctx
,
zhead
,
root
);
/*X*/
if
err
!=
nil
{
return
err
}
if
xtree
==
nil
{
// root deleted -> root node covers [-∞,∞)
trackNew
.
AddPath
([]
zodb
.
Oid
{
root
})
return
nil
}
tree
:=
xtree
.
(
*
Tree
)
// must succeed
top
:=
&
nodeInRange
{
prefix
:
nil
,
keycov
:
blib
.
KeyRange
{
KeyMin
,
KeyMax
},
node
:
tree
}
V
:=
rangeSplit
{
top
}
for
_
,
r
:=
range
δtkeycov
.
AllRanges
()
{
lo
:=
r
.
Lo
for
{
b
,
err
:=
V
.
GetToLeaf
(
ctx
,
lo
);
/*X*/
if
err
!=
nil
{
return
err
}
trackNew
.
AddPath
(
b
.
Path
())
// continue with next right bucket until r coverage is complete
if
r
.
Hi_
<=
b
.
keycov
.
Hi_
{
break
}
lo
=
b
.
keycov
.
Hi_
+
1
}
}
return
nil
}
// rebuild1 rebuilds δT for single δZ.
// rebuild1 rebuilds δT for single δZ.
//
//
// δtrackNew/δtkeycov represents how trackNew changes when going through `atPrev <- δZ.Rev` .
// δtrackNew/δtkeycov represents how trackNew changes when going through `atPrev <- δZ.Rev` .
...
@@ -548,6 +512,41 @@ func (δTtail *_ΔTtail) rebuild1(atPrev zodb.Tid, δZ zodb.ΔRevEntry, trackNew
...
@@ -548,6 +512,41 @@ func (δTtail *_ΔTtail) rebuild1(atPrev zodb.Tid, δZ zodb.ΔRevEntry, trackNew
return
δtrack
,
δtkeycov
,
newRevEntry
,
nil
return
δtrack
,
δtkeycov
,
newRevEntry
,
nil
}
}
// widenTrackNew widens trackNew to cover δtkeycov.
func
widenTrackNew
(
trackNew
blib
.
PPTreeSubSet
,
δtkeycov
*
blib
.
RangedKeySet
,
root
zodb
.
Oid
,
at
zodb
.
Tid
,
db
*
zodb
.
DB
)
(
err
error
)
{
defer
xerr
.
Contextf
(
&
err
,
"widenTrackNew tree<%s> @%s +%s"
,
root
,
at
,
δtkeycov
)
debugfΔBtail
(
"
\n
widenTrackNew %s @%s +%s"
,
root
,
at
,
δtkeycov
)
txn
,
ctx
:=
transaction
.
New
(
context
.
TODO
())
// XXX
defer
txn
.
Abort
()
zhead
,
err
:=
db
.
Open
(
ctx
,
&
zodb
.
ConnOptions
{
At
:
at
});
/*X*/
if
err
!=
nil
{
return
err
}
xtree
,
err
:=
zgetNodeOrNil
(
ctx
,
zhead
,
root
);
/*X*/
if
err
!=
nil
{
return
err
}
if
xtree
==
nil
{
// root deleted -> root node covers [-∞,∞)
trackNew
.
AddPath
([]
zodb
.
Oid
{
root
})
return
nil
}
tree
:=
xtree
.
(
*
Tree
)
// must succeed
top
:=
&
nodeInRange
{
prefix
:
nil
,
keycov
:
blib
.
KeyRange
{
KeyMin
,
KeyMax
},
node
:
tree
}
V
:=
rangeSplit
{
top
}
for
_
,
r
:=
range
δtkeycov
.
AllRanges
()
{
lo
:=
r
.
Lo
for
{
b
,
err
:=
V
.
GetToLeaf
(
ctx
,
lo
);
/*X*/
if
err
!=
nil
{
return
err
}
trackNew
.
AddPath
(
b
.
Path
())
// continue with next right bucket until r coverage is complete
if
r
.
Hi_
<=
b
.
keycov
.
Hi_
{
break
}
lo
=
b
.
keycov
.
Hi_
+
1
}
}
return
nil
}
// Update updates δB with object-level ZODB changes.
// Update updates δB with object-level ZODB changes.
//
//
...
...
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