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
1233d221
Commit
1233d221
authored
Jun 24, 2020
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
51fb2628
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
5 deletions
+14
-5
wcfs/δbtail.go
wcfs/δbtail.go
+14
-5
No files found.
wcfs/δbtail.go
View file @
1233d221
...
...
@@ -571,7 +571,7 @@ func (prs *rangeSplit) Expand(rnode *nodeInRange) (children rangeSplit) {
// [len(ev)].Key = +∞ ; should be assumed so
tree
:=
rnode
.
node
.
(
*
Tree
)
treev
:=
tree
.
Entryv
()
fmt
.
Printf
(
"E treev: %v
\n
"
,
treev
)
//
fmt.Printf("E treev: %v\n", treev)
children
=
make
(
rangeSplit
,
0
,
len
(
treev
)
+
1
)
for
i
:=
range
treev
{
lo
:=
rnode
.
lo
...
...
@@ -586,7 +586,7 @@ func (prs *rangeSplit) Expand(rnode *nodeInRange) (children rangeSplit) {
children
=
append
(
children
,
&
nodeInRange
{
lo
,
hi_
,
treev
[
i
]
.
Child
()})
}
fmt
.
Printf
(
"E children: %s
\n
"
,
children
)
//
fmt.Printf("E children: %s\n", children)
// del[i]; insert(@i, children)
*
prs
=
append
(
rs
[
:
i
],
append
(
children
,
rs
[
i
+
1
:
]
...
)
...
)
...
...
@@ -666,6 +666,7 @@ func treediff(ctx context.Context, root zodb.Oid, δtops SetOid, δZTC SetOid, t
// FIXME -> merge (VDEL vs add)
// XXX no - not needed here - keys cannot migrate in between two disconnected subtrees
// -> assert that keys from different δtop do not overlap
// DEL k -> Tkextra += k
// +k -> Tkextra -= k
fmt
.
Printf
(
"-> δtop: %v
\n
"
,
δtop
)
...
...
@@ -677,6 +678,7 @@ func treediff(ctx context.Context, root zodb.Oid, δtops SetOid, δZTC SetOid, t
return
δT
,
nil
}
// XXX kill (goes away after diffT rework)
// diffX computes difference in between two revisions of a tree's subtree.
//
// a, b point to top of the subtree @old and @new revisions and must be of the
...
...
@@ -755,7 +757,6 @@ func diffT(ctx context.Context, a, b *Tree, δZTC SetOid, trackIdx map[zodb.Oid]
// initial phase: expand changed nodes in a till buckets;
// XXX changed buckets -> δ-
if
a
!=
nil
{
// XXX kill (always !nil) ?
fmt
.
Println
(
"ZZZ"
)
// XXX maybe walk till a from root to get more precise initial range?
atop
:=
&
nodeInRange
{
lo
:
KeyMin
,
hi_
:
KeyMax
,
node
:
a
}
// [-∞, ∞)
av
=
rangeSplit
{
atop
}
...
...
@@ -768,8 +769,8 @@ func diffT(ctx context.Context, a, b *Tree, δZTC SetOid, trackIdx map[zodb.Oid]
defer
arn
.
node
.
PDeactivate
()
children
:=
av
.
Expand
(
arn
)
fmt
.
Printf
(
"Y children: %s
\n
"
,
children
)
fmt
.
Printf
(
"Y av: %s
\n
"
,
av
)
//
fmt.Printf("Y children: %s\n", children)
//
fmt.Printf("Y av: %s\n", av)
for
_
,
rchild
:=
range
children
{
coid
:=
rchild
.
node
.
POid
()
if
!
(
δZTC
.
Has
(
coid
)
||
...
...
@@ -815,6 +816,7 @@ func diffT(ctx context.Context, a, b *Tree, δZTC SetOid, trackIdx map[zodb.Oid]
fmt
.
Printf
(
" av: %s
\n
"
,
av
)
fmt
.
Printf
(
" bv: %s
\n
"
,
bv
)
fmt
.
Printf
(
" bq: %s
\n
"
,
Bqueue
)
// phase 2: iterate through keys queued for A and B, delve into
// corresponding nodes, and merge diff generated from them into δ.
...
...
@@ -824,6 +826,10 @@ func diffT(ctx context.Context, a, b *Tree, δZTC SetOid, trackIdx map[zodb.Oid]
// XXX inneficient: we process each key separately, while they can be
// processed in sorted batches.
for
len
(
Aqueue
)
>
0
||
len
(
Bqueue
)
>
0
{
fmt
.
Printf
(
"
\n
"
)
fmt
.
Printf
(
" aq: %s
\n
"
,
Aqueue
)
fmt
.
Printf
(
" bq: %s
\n
"
,
Bqueue
)
// B queue
// expand keys in new δA -> in B till buckets;
// process B buckets that cover new keys into δ+
...
...
@@ -898,6 +904,9 @@ func diffT(ctx context.Context, a, b *Tree, δZTC SetOid, trackIdx map[zodb.Oid]
// δMerge merges changes from δ2 into δ.
// δ is total-building diff, while δ2 is diff from comparing some subnodes.
func
δMerge
(
δ
,
δ2
map
[
Key
]
ΔValue
)
error
{
fmt
.
Printf
(
" δmerge %v <- %v
\n
"
,
δ
,
δ2
)
defer
fmt
.
Printf
(
" -> %v
\n
"
,
δ
)
// merge δ <- δ2
for
k
,
δv2
:=
range
δ2
{
δv1
,
already
:=
δ
[
k
]
...
...
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