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
231a8e52
Commit
231a8e52
authored
Sep 09, 2020
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
fe540a04
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
19 additions
and
9 deletions
+19
-9
wcfs/δbtail.go
wcfs/δbtail.go
+18
-8
wcfs/δbtail_test.go
wcfs/δbtail_test.go
+1
-1
No files found.
wcfs/δbtail.go
View file @
231a8e52
...
@@ -212,9 +212,9 @@ type δtrackIndex struct {
...
@@ -212,9 +212,9 @@ type δtrackIndex struct {
// ApplyΔ applies δ to trackIdx. XXX
// ApplyΔ applies δ to trackIdx. XXX
func
(
tidx
trackIndex
)
ApplyΔ
(
δ
*
δtrackIndex
)
{
func
(
tidx
trackIndex
)
ApplyΔ
(
δ
*
δtrackIndex
)
{
//
fmt.Printf("\n\nApplyΔ\n")
fmt
.
Printf
(
"
\n\n
ApplyΔ
\n
"
)
//
fmt.Printf("\tDelLeaf: %v\n", δ.DelLeaf)
fmt
.
Printf
(
"
\t
DelLeaf: %v
\n
"
,
δ
.
DelLeaf
)
//
fmt.Printf("\tAdd: %v\n", δ.Add)
fmt
.
Printf
(
"
\t
Add: %v
\n
"
,
δ
.
Add
)
// remove leafs and thier parents
// remove leafs and thier parents
for
leaf
:=
range
δ
.
DelLeaf
{
for
leaf
:=
range
δ
.
DelLeaf
{
...
@@ -949,8 +949,6 @@ func diffT(ctx context.Context, A, B *Tree, δZTC SetOid, trackIdx trackIndex, h
...
@@ -949,8 +949,6 @@ func diffT(ctx context.Context, A, B *Tree, δZTC SetOid, trackIdx trackIndex, h
// XXX -> trackIndex
// XXX -> trackIndex
BtrackIdx
:=
map
[
zodb
.
Oid
]
nodeTrack
{
B
.
POid
()
:
nodeTrack
{
parent
:
trackIdx
[
B
.
POid
()]
.
parent
}}
BtrackIdx
:=
map
[
zodb
.
Oid
]
nodeTrack
{
B
.
POid
()
:
nodeTrack
{
parent
:
trackIdx
[
B
.
POid
()]
.
parent
}}
// trackAdd := SetNode{} // leaf nodes to be added to trackIdx after treediff
// phase 1: expand A top->down driven by δZTC.
// phase 1: expand A top->down driven by δZTC.
// by default a node contributes to δ-
// by default a node contributes to δ-
// a node ac does not contribute to δ- and can be skipped, if:
// a node ac does not contribute to δ- and can be skipped, if:
...
@@ -1031,7 +1029,7 @@ func diffT(ctx context.Context, A, B *Tree, δZTC SetOid, trackIdx trackIndex, h
...
@@ -1031,7 +1029,7 @@ func diffT(ctx context.Context, A, B *Tree, δZTC SetOid, trackIdx trackIndex, h
bcOid
:=
bc
.
node
.
POid
()
bcOid
:=
bc
.
node
.
POid
()
BtrackIdx
[
bcOid
]
=
nodeTrack
{
parent
:
blo
.
node
.
POid
()}
BtrackIdx
[
bcOid
]
=
nodeTrack
{
parent
:
blo
.
node
.
POid
()}
if
acOid
==
bcOid
{
if
acOid
==
bcOid
{
found
=
true
found
=
true
}
}
}
}
if
found
{
if
found
{
...
@@ -1042,6 +1040,19 @@ func diffT(ctx context.Context, A, B *Tree, δZTC SetOid, trackIdx trackIndex, h
...
@@ -1042,6 +1040,19 @@ func diffT(ctx context.Context, A, B *Tree, δZTC SetOid, trackIdx trackIndex, h
if
found
{
if
found
{
// ac can be skipped
// ac can be skipped
// XXX Bkqueue <- holes(ac.range \ bc.range) XXX test for this
// XXX Bkqueue <- holes(ac.range \ bc.range) XXX test for this
// adjust trackIdx since path to the node could have changed
oid
:=
acOid
for
oid
!=
zodb
.
InvalidOid
{
told
:=
trackIdx
[
oid
]
tnew
:=
BtrackIdx
[
oid
]
if
told
.
parent
!=
tnew
.
parent
{
δtrack
.
Add
[
oid
]
=
&
tnew
// XXX adjust nchildren
}
oid
=
tnew
.
parent
}
continue
continue
}
}
}
}
...
@@ -1096,7 +1107,6 @@ func diffT(ctx context.Context, A, B *Tree, δZTC SetOid, trackIdx trackIndex, h
...
@@ -1096,7 +1107,6 @@ func diffT(ctx context.Context, A, B *Tree, δZTC SetOid, trackIdx trackIndex, h
// δ <- δB
// δ <- δB
err
=
δMerge
(
δ
,
δB
);
/*X*/
if
err
!=
nil
{
return
nil
,
nil
,
err
}
err
=
δMerge
(
δ
,
δB
);
/*X*/
if
err
!=
nil
{
return
nil
,
nil
,
err
}
δtrack
.
Add
.
AddPath
(
b
.
Path
())
δtrack
.
Add
.
AddPath
(
b
.
Path
())
// trackAdd.Add(b)
// Akqueue <- δB
// Akqueue <- δB
for
k_
:=
range
δB
{
for
k_
:=
range
δB
{
...
@@ -1476,7 +1486,7 @@ func pop(nodeStk *[]*nodeInRange) *nodeInRange {
...
@@ -1476,7 +1486,7 @@ func pop(nodeStk *[]*nodeInRange) *nodeInRange {
}
}
const
debug
=
fals
e
const
debug
=
tru
e
func
tracef
(
format
string
,
argv
...
interface
{})
{
func
tracef
(
format
string
,
argv
...
interface
{})
{
if
debug
{
if
debug
{
fmt
.
Printf
(
format
,
argv
...
)
fmt
.
Printf
(
format
,
argv
...
)
...
...
wcfs/δbtail_test.go
View file @
231a8e52
...
@@ -1054,7 +1054,7 @@ func TestΔBTail(t *testing.T) {
...
@@ -1054,7 +1054,7 @@ func TestΔBTail(t *testing.T) {
"T2/T1-T/B0:g-B1:b-T/B2:b,3:a"
,
"T2/T1-T/B0:g-B1:b-T/B2:b,3:a"
,
"T2/T1-T/T-T-B2:a/B0:c-B1:g"
,
"T2/T1-T/T-T-B2:a/B0:c-B1:g"
,
// found by AllStructs (
XXX
)
// found by AllStructs (
unchanged node is reparented
)
"T1/B0:c-B1:f"
,
"T1/B0:c-B1:f"
,
"T1/T-T/B0:c-T/B1:h"
,
"T1/T-T/B0:c-T/B1:h"
,
}
}
...
...
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