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
2db00f78
Commit
2db00f78
authored
May 14, 2021
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
c0422b6f
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
26 additions
and
3 deletions
+26
-3
wcfs/δbtail.go
wcfs/δbtail.go
+22
-2
wcfs/δbtail_test.go
wcfs/δbtail_test.go
+4
-1
No files found.
wcfs/δbtail.go
View file @
2db00f78
...
...
@@ -412,6 +412,21 @@ func (A trackIndex) xDifferenceInplace(B trackIndex) {
δnchild
:=
map
[
zodb
.
Oid
]
int
{}
/* XXX kill
// remove (A^B).leafs and thier parents
// we have to start (A^B).leafs - not from B.leafs - because B can
// contain non-leaf to remove from A, with that non-leaf having
// children in B, that are not present in A:
//
// c c
// | |
// 11 11
// | |
// 14 14
// | \
// 15 16
AB := B.Intersect(A)
*/
// remove B.leafs and thier parents
for
oid
,
t2
:=
range
B
{
if
t2
.
nchild
!=
0
{
...
...
@@ -433,6 +448,7 @@ func (A trackIndex) xDifferenceInplace(B trackIndex) {
}
delete
(
A
,
oid
)
// XXX + return A.nchild in removedNonLeafs {} oid -> nchild ? (probably no)
if
t
.
parent
!=
zodb
.
InvalidOid
{
δnchild
[
t
.
parent
]
-=
1
}
...
...
@@ -483,10 +499,13 @@ func (A trackIndex) xUnionInplace(B trackIndex) {
// fixup performs scheduled δnchild adjustment.
// XXX place
func
(
A
trackIndex
)
fixup
(
δnchild
map
[
zodb
.
Oid
]
int
)
{
A
.
xfixup
(
+
1
,
δnchild
)
}
func
(
A
trackIndex
)
xfixup
(
sign
int
,
δnchild
map
[
zodb
.
Oid
]
int
)
{
gcq
:=
[]
zodb
.
Oid
{}
for
oid
,
δnc
:=
range
δnchild
{
t
:=
A
[
oid
]
// XXX t can be nil -> XXX no must be there as A is connected
t
.
nchild
+=
δnc
t
.
nchild
+=
sign
*
δnc
if
t
.
nchild
==
0
&&
/* not root node */
t
.
parent
!=
zodb
.
InvalidOid
{
gcq
=
append
(
gcq
,
oid
)
}
...
...
@@ -560,9 +579,10 @@ func (tidx trackIndex) ApplyΔ(δ *δtrackIndex) {
δ
.
Add
.
verify
()
defer
tidx
.
verify
()
tidx
.
xfixup
(
-
1
,
δ
.
δnchildNonLeafs
)
tidx
.
xDifferenceInplace
(
δ
.
Del
)
tidx
.
xUnionInplace
(
δ
.
Add
)
tidx
.
fixup
(
δ
.
δnchildNonLeafs
)
tidx
.
xfixup
(
+
1
,
δ
.
δnchildNonLeafs
)
}
// treeSetKey represents ordered set of keys.
...
...
wcfs/δbtail_test.go
View file @
2db00f78
...
...
@@ -1430,7 +1430,7 @@ func TestΔBTail(t *testing.T) {
"T2,5/B1:a-B2:b,4:d-B8:h"
,
// XXX add A
// found by AllStructs ([1] is not changed, but because B1 is
// unlinked and 1 migrates to othe bucket, changes in that
// unlinked and 1 migrates to othe
r
bucket, changes in that
// other bucket must be included into δT)
"T1,2/B0:e-B1:d-B2:g,3:a"
,
"T1/B0:d-B1:d,2:d"
,
...
...
@@ -1485,6 +1485,9 @@ func TestΔBTail(t *testing.T) {
"T/T1/T-T2/B0:e-B1:f-B2:g"
,
// ApplyΔ -> xunion: node is reachable from multiple parents
// ( because xdifference did not remove common non-leaf node
// under which there were also other changed, but not initially
// tracked, node )
"T4/T1-T/T-T2-B4:c/T-T-T/B0:f-B1:h-B2:g,3:b"
,
"T1/T-T/T-T2/T-T-T/B0:f-B1:h-B2:f"
,
// ----//----
...
...
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