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
124a8543
Commit
124a8543
authored
May 13, 2021
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
4b24bab6
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
30 additions
and
15 deletions
+30
-15
wcfs/δbtail.go
wcfs/δbtail.go
+30
-15
No files found.
wcfs/δbtail.go
View file @
124a8543
...
@@ -332,10 +332,10 @@ func (tidx trackIndex) verify() {
...
@@ -332,10 +332,10 @@ func (tidx trackIndex) verify() {
//
//
// In other words it removes B nodes from A while still maintaining A as P-connected.
// In other words it removes B nodes from A while still maintaining A as P-connected.
func
(
A
trackIndex
)
DifferenceInplace
(
B
trackIndex
)
{
func
(
A
trackIndex
)
DifferenceInplace
(
B
trackIndex
)
{
//
fmt.Printf("\n\nDifferenceInplace:\n")
fmt
.
Printf
(
"
\n\n
DifferenceInplace:
\n
"
)
//
fmt.Printf(" A: %s\n", A)
fmt
.
Printf
(
" A: %s
\n
"
,
A
)
//
fmt.Printf(" B: %s\n", B)
fmt
.
Printf
(
" B: %s
\n
"
,
B
)
//
defer fmt.Printf("->D: %s\n", A)
defer
fmt
.
Printf
(
"->D: %s
\n
"
,
A
)
A
.
verify
()
A
.
verify
()
B
.
verify
()
B
.
verify
()
...
@@ -402,10 +402,10 @@ func (A trackIndex) DifferenceInplace(B trackIndex) {
...
@@ -402,10 +402,10 @@ func (A trackIndex) DifferenceInplace(B trackIndex) {
//
//
// In other words it adds B nodes to A.
// In other words it adds B nodes to A.
func
(
A
trackIndex
)
UnionInplace
(
B
trackIndex
)
{
func
(
A
trackIndex
)
UnionInplace
(
B
trackIndex
)
{
//
fmt.Printf("\n\nUnionInplace:\n")
fmt
.
Printf
(
"
\n\n
UnionInplace:
\n
"
)
//
fmt.Printf(" A: %s\n", A)
fmt
.
Printf
(
" A: %s
\n
"
,
A
)
//
fmt.Printf(" B: %s\n", B)
fmt
.
Printf
(
" B: %s
\n
"
,
B
)
//
defer fmt.Printf("->U: %s\n", A)
defer
fmt
.
Printf
(
"->U: %s
\n
"
,
A
)
A
.
verify
()
A
.
verify
()
B
.
verify
()
B
.
verify
()
...
@@ -439,11 +439,11 @@ func (A trackIndex) UnionInplace(B trackIndex) {
...
@@ -439,11 +439,11 @@ func (A trackIndex) UnionInplace(B trackIndex) {
// 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(" A: %s\n", tidx)
fmt
.
Printf
(
" A: %s
\n
"
,
tidx
)
//
fmt.Printf(" -: %s\n", δ.Del)
fmt
.
Printf
(
" -: %s
\n
"
,
δ
.
Del
)
//
fmt.Printf(" +: %s\n", δ.Add)
fmt
.
Printf
(
" +: %s
\n
"
,
δ
.
Add
)
//
defer fmt.Printf("\n->B: %s\n", tidx)
defer
fmt
.
Printf
(
"
\n
->B: %s
\n
"
,
tidx
)
tidx
.
verify
()
tidx
.
verify
()
δ
.
Del
.
verify
()
δ
.
Del
.
verify
()
...
@@ -1414,9 +1414,11 @@ func diffT(ctx context.Context, A, B *Tree, δZTC SetOid, trackIdx trackIndex, h
...
@@ -1414,9 +1414,11 @@ func diffT(ctx context.Context, A, B *Tree, δZTC SetOid, trackIdx trackIndex, h
// adjust trackIdx since path to the node could have changed
// adjust trackIdx since path to the node could have changed
apath
:=
trackIdx
.
Path
(
acOid
)
apath
:=
trackIdx
.
Path
(
acOid
)
bpath
:=
BtrackIdx
.
Path
(
acOid
)
bpath
:=
BtrackIdx
.
Path
(
acOid
)
if
!
reflect
.
DeepEqual
(
apath
,
bpath
)
{
if
!
pathEqual
(
apath
,
bpath
)
{
δtrack
.
Del
.
AddPath
(
apath
)
δtrack
.
Add
.
AddPath
(
bpath
)
δtrack
.
Add
.
AddPath
(
bpath
)
δtrack
.
Del
.
AddPath
(
apath
)
// remove all nodes from under a XXX no
// XXX (a was not changed and nothing under a was changed) -> we just have to correct path till a.
}
}
/* XXX kill
/* XXX kill
...
@@ -1878,6 +1880,19 @@ func pop(nodeStk *[]*nodeInRange) *nodeInRange {
...
@@ -1878,6 +1880,19 @@ func pop(nodeStk *[]*nodeInRange) *nodeInRange {
return
top
return
top
}
}
// pathEqual returns whether two paths are the same.
func
pathEqual
(
patha
,
pathb
[]
zodb
.
Oid
)
bool
{
if
len
(
patha
)
!=
len
(
pathb
)
{
return
false
}
for
i
,
a
:=
range
patha
{
if
pathb
[
i
]
!=
a
{
return
false
}
}
return
true
}
const
debug
=
false
const
debug
=
false
func
tracef
(
format
string
,
argv
...
interface
{})
{
func
tracef
(
format
string
,
argv
...
interface
{})
{
...
...
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