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
52972b18
Commit
52972b18
authored
May 14, 2021
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
99cc03b5
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
28 additions
and
9 deletions
+28
-9
wcfs/δbtail.go
wcfs/δbtail.go
+28
-9
No files found.
wcfs/δbtail.go
View file @
52972b18
...
@@ -242,6 +242,8 @@ type nodeTrack struct {
...
@@ -242,6 +242,8 @@ type nodeTrack struct {
// δtrackIndex represents change to trackIndex. XXX name
// δtrackIndex represents change to trackIndex. XXX name
//
//
// XXX refer to trackIndex.ApplyΔ
//
// The result B of applying δ to A is:
// The result B of applying δ to A is:
//
//
// B = A.xDifference(δ.Del).xUnion(δ.Add) (*)
// B = A.xDifference(δ.Del).xUnion(δ.Add) (*)
...
@@ -368,6 +370,11 @@ func (A trackIndex) DifferenceInplace(B trackIndex) {
...
@@ -368,6 +370,11 @@ func (A trackIndex) DifferenceInplace(B trackIndex) {
δnchild
:=
map
[
zodb
.
Oid
]
int
{}
δnchild
:=
map
[
zodb
.
Oid
]
int
{}
A
.
xDifferenceInplace
(
B
,
δnchild
)
A
.
fixup
(
δnchild
)
}
func
(
A
trackIndex
)
xDifferenceInplace
(
B
trackIndex
,
δnchild
map
[
zodb
.
Oid
]
int
)
{
// remove B.leafs and thier parents
// remove B.leafs and thier parents
for
oid
,
t2
:=
range
B
{
for
oid
,
t2
:=
range
B
{
if
t2
.
nchild
!=
0
{
if
t2
.
nchild
!=
0
{
...
@@ -386,18 +393,19 @@ func (A trackIndex) DifferenceInplace(B trackIndex) {
...
@@ -386,18 +393,19 @@ func (A trackIndex) DifferenceInplace(B trackIndex) {
δnchild
[
t
.
parent
]
-=
1
δnchild
[
t
.
parent
]
-=
1
}
}
}
}
}
/* XXX kill
func
(
A
trackIndex
)
xUnionInplace
(
B
trackIndex
,
δnchild
map
[
zodb
.
Oid
]
int
)
{
// process adds
// process add
ition
s
for oid,
δt := range δ.Add
{
for
oid
,
t2
:=
range
B
{
t
,
already
:=
A
[
oid
]
t
,
already
:=
A
[
oid
]
if
already
{
if
already
{
if
t
.
parent
!=
zodb
.
InvalidOid
{
if
t
.
parent
!=
zodb
.
InvalidOid
{
δnchild
[
t
.
parent
]
-=
1
δnchild
[
t
.
parent
]
-=
1
t.parent =
δt
.parent
t
.
parent
=
t2
.
parent
}
}
}
else
{
}
else
{
t = &nodeTrack{parent:
δt
.parent, nchild: 0}
t
=
&
nodeTrack
{
parent
:
t2
.
parent
,
nchild
:
0
}
A
[
oid
]
=
t
A
[
oid
]
=
t
}
}
...
@@ -405,9 +413,11 @@ func (A trackIndex) DifferenceInplace(B trackIndex) {
...
@@ -405,9 +413,11 @@ func (A trackIndex) DifferenceInplace(B trackIndex) {
δnchild
[
t
.
parent
]
+=
1
// remeber to nchild++ in parent
δnchild
[
t
.
parent
]
+=
1
// remeber to nchild++ in parent
}
}
}
}
*/
}
// perform scheduled δnchild adjustment
// fixup performs scheduled δnchild adjustment.
// XXX place
func
(
A
trackIndex
)
fixup
(
δnchild
map
[
zodb
.
Oid
]
int
)
{
gcq
:=
[]
zodb
.
Oid
{}
gcq
:=
[]
zodb
.
Oid
{}
for
oid
,
δnc
:=
range
δnchild
{
for
oid
,
δnc
:=
range
δnchild
{
t
:=
A
[
oid
]
// XXX t can be nil -> XXX no must be there as A is connected
t
:=
A
[
oid
]
// XXX t can be nil -> XXX no must be there as A is connected
...
@@ -436,6 +446,10 @@ func (A trackIndex) UnionInplace(B trackIndex) {
...
@@ -436,6 +446,10 @@ func (A trackIndex) UnionInplace(B trackIndex) {
B
.
verify
()
B
.
verify
()
defer
A
.
verify
()
defer
A
.
verify
()
δnchild
:=
map
[
zodb
.
Oid
]
int
{}
A
.
xUnionInplace
(
B
,
δnchild
)
A
.
fixup
(
δnchild
)
/*
for oid, t2 := range B {
for oid, t2 := range B {
t, already := A[oid]
t, already := A[oid]
if !already {
if !already {
...
@@ -460,6 +474,7 @@ func (A trackIndex) UnionInplace(B trackIndex) {
...
@@ -460,6 +474,7 @@ func (A trackIndex) UnionInplace(B trackIndex) {
}
}
}
}
}
}
*/
}
}
// ApplyΔ applies δ to trackIdx. XXX
// ApplyΔ applies δ to trackIdx. XXX
...
@@ -475,8 +490,12 @@ func (tidx trackIndex) ApplyΔ(δ *δtrackIndex) {
...
@@ -475,8 +490,12 @@ func (tidx trackIndex) ApplyΔ(δ *δtrackIndex) {
δ
.
Add
.
verify
()
δ
.
Add
.
verify
()
defer
tidx
.
verify
()
defer
tidx
.
verify
()
tidx
.
DifferenceInplace
(
δ
.
Del
)
δnchild
:=
map
[
zodb
.
Oid
]
int
{}
tidx
.
UnionInplace
(
δ
.
Add
)
tidx
.
xDifferenceInplace
(
δ
.
Del
,
δnchild
)
tidx
.
xUnionInplace
(
δ
.
Add
,
δnchild
)
tidx
.
fixup
(
δnchild
)
}
}
// treeSetKey represents ordered set of keys.
// treeSetKey represents ordered set of keys.
...
...
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