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
abc32c71
Commit
abc32c71
authored
Sep 07, 2020
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
41eab70a
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
42 additions
and
3 deletions
+42
-3
wcfs/δbtail.go
wcfs/δbtail.go
+42
-3
No files found.
wcfs/δbtail.go
View file @
abc32c71
...
@@ -214,8 +214,42 @@ type δtrackIndex struct {
...
@@ -214,8 +214,42 @@ type δtrackIndex struct {
// panic("TODO")
// panic("TODO")
//}
//}
func
(
tidx
trackIndex
)
ApplyΔ
(
δtidx
*
δtrackIndex
)
{
// ApplyΔ applies δ to trackIdx. XXX
panic
(
"TODO"
)
func
(
tidx
trackIndex
)
ApplyΔ
(
δ
*
δtrackIndex
)
{
// remove leafs and thier parents
for
leaf
:=
range
δ
.
DelLeaf
{
t
,
present
:=
tidx
[
leaf
]
if
!
present
{
continue
// leaf already not there
}
delete
(
tidx
,
leaf
)
parent
:=
t
.
parent
for
parent
!=
zodb
.
InvalidOid
{
t
:=
tidx
[
parent
]
t
.
nchild
--
if
t
.
nchild
>
0
{
break
}
delete
(
tidx
,
parent
)
parent
=
t
.
parent
}
}
// process adds
δnchild
:=
map
[
zodb
.
Oid
]
int
{}
for
oid
,
δt
:=
range
δ
.
Add
{
_
,
already
:=
tidx
[
oid
]
if
already
{
continue
// object already tracked
}
tidx
[
oid
]
=
&
nodeTrack
{
parent
:
δt
.
parent
,
nchild
:
0
}
δnchild
[
δt
.
parent
]
+=
1
// remeber to nchild++ in parent
}
for
parent
,
δnc
:=
range
δnchild
{
tidx
[
parent
]
.
nchild
+=
δnc
}
}
}
// treeSetKey represents ordered set of keys.
// treeSetKey represents ordered set of keys.
...
@@ -803,8 +837,12 @@ func diffX(ctx context.Context, a, b Node, δZTC SetOid, trackIdx trackIndex, ho
...
@@ -803,8 +837,12 @@ func diffX(ctx context.Context, a, b Node, δZTC SetOid, trackIdx trackIndex, ho
if
isT
{
if
isT
{
return
diffT
(
ctx
,
aT
,
bT
,
δZTC
,
trackIdx
,
holeIdx
)
return
diffT
(
ctx
,
aT
,
bT
,
δZTC
,
trackIdx
,
holeIdx
)
}
else
{
}
else
{
var
δtrack
*
δtrackIndex
δ
,
err
:=
diffB
(
ctx
,
aB
,
bB
)
δ
,
err
:=
diffB
(
ctx
,
aB
,
bB
)
return
δ
,
/*δtrack*/
nil
,
err
// XXX ok?
if
δ
!=
nil
{
δtrack
=
&
δtrackIndex
{}
}
return
δ
,
δtrack
,
err
}
}
}
}
...
@@ -823,6 +861,7 @@ func diffT(ctx context.Context, A, B *Tree, δZTC SetOid, trackIdx trackIndex, h
...
@@ -823,6 +861,7 @@ func diffT(ctx context.Context, A, B *Tree, δZTC SetOid, trackIdx trackIndex, h
if
B
==
nil
{
panic
(
"B is nil"
)
}
if
B
==
nil
{
panic
(
"B is nil"
)
}
δ
=
map
[
Key
]
ΔValue
{}
δ
=
map
[
Key
]
ΔValue
{}
δtrack
=
&
δtrackIndex
{
DelLeaf
:
SetOid
{},
Add
:
trackIndex
{}}
defer
tracef
(
" -> δ: %v
\n
"
,
δ
)
defer
tracef
(
" -> δ: %v
\n
"
,
δ
)
// initial split ranges for A and B
// initial split ranges for A and B
...
...
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