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
fb56ebad
Commit
fb56ebad
authored
Jun 24, 2020
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
ce8d70fb
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
36 additions
and
24 deletions
+36
-24
wcfs/δbtail.go
wcfs/δbtail.go
+36
-24
No files found.
wcfs/δbtail.go
View file @
fb56ebad
...
...
@@ -280,7 +280,7 @@ func (δBtail *ΔBtail) Track(key Key, keyPresent bool, path []Node, flags Track
pathv
:=
[]
string
{}
for
_
,
node
:=
range
path
{
pathv
=
append
(
pathv
,
vnode
(
node
))
}
fmt
.
Print
f
(
"Track [%v] %s
\n
"
,
key
,
strings
.
Join
(
pathv
,
" -> "
))
trace
f
(
"Track [%v] %s
\n
"
,
key
,
strings
.
Join
(
pathv
,
" -> "
))
parent
:=
zodb
.
InvalidOid
var
track
nodeTrack
...
...
@@ -342,8 +342,8 @@ func (δBtail *ΔBtail) Update(δZ *zodb.EventCommit) (_ ΔB, err error) {
δBtail
.
δZtail
.
Append
(
δZ
.
Tid
,
δZ
.
Changev
)
fmt
.
Print
f
(
"
\n
Update δZ: %v
\n
"
,
δZ
.
Changev
)
fmt
.
Print
f
(
"trackIdx: %v
\n
"
,
δBtail
.
trackIdx
)
trace
f
(
"
\n
Update δZ: %v
\n
"
,
δZ
.
Changev
)
trace
f
(
"trackIdx: %v
\n
"
,
δBtail
.
trackIdx
)
δZTC
,
δtopsByRoot
:=
δBtail
.
δZConnectTracked
(
δZ
)
...
...
@@ -595,8 +595,8 @@ func treediff(ctx context.Context, root zodb.Oid, δtops SetOid, δZTC SetOid, t
defer
xerr
.
Contextf
(
&
err
,
"treediff %s..%s %s"
,
zconnOld
.
At
(),
zconnNew
.
At
(),
root
)
// XXX zconnX -> a, b ?
fmt
.
Print
f
(
"treediff %s δtops: %v δZTC: %v
\n
"
,
root
,
δtops
,
δZTC
)
defer
fmt
.
Print
f
(
"
\n
"
)
trace
f
(
"treediff %s δtops: %v δZTC: %v
\n
"
,
root
,
δtops
,
δZTC
)
defer
trace
f
(
"
\n
"
)
δT
=
map
[
Key
]
ΔValue
{}
...
...
@@ -618,7 +618,7 @@ func treediff(ctx context.Context, root zodb.Oid, δtops SetOid, δZTC SetOid, t
// -> assert that keys from different δtop do not overlap
// DEL k -> Tkextra += k
// +k -> Tkextra -= k
fmt
.
Print
f
(
"-> δtop: %v
\n
"
,
δtop
)
trace
f
(
"-> δtop: %v
\n
"
,
δtop
)
for
k
,
δv
:=
range
δtop
{
δT
[
k
]
=
δv
}
...
...
@@ -683,11 +683,11 @@ func diffX(ctx context.Context, a, b Node, δZTC SetOid, trackIdx map[zodb.Oid]n
//
// XXX trackIdx -> just pass δBtail?
func
diffT
(
ctx
context
.
Context
,
a
,
b
*
Tree
,
δZTC
SetOid
,
trackIdx
map
[
zodb
.
Oid
]
nodeTrack
)
(
δ
map
[
Key
]
ΔValue
,
err
error
)
{
fmt
.
Printf
(
"
T %s %s
\n
"
,
xidOf
(
a
),
xidOf
(
b
))
tracef
(
" diff
T %s %s
\n
"
,
xidOf
(
a
),
xidOf
(
b
))
defer
xerr
.
Contextf
(
&
err
,
"diffT %s %s"
,
xidOf
(
a
),
xidOf
(
b
))
δ
=
map
[
Key
]
ΔValue
{}
defer
fmt
.
Print
f
(
" -> δt: %v
\n
"
,
δ
)
defer
trace
f
(
" -> δt: %v
\n
"
,
δ
)
var
av
rangeSplit
// nodes expanded from a
var
bv
rangeSplit
// nodes expanded from b
...
...
@@ -790,9 +790,8 @@ 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
)
tracef
(
" av: %s
\n
"
,
av
)
tracef
(
" bv: %s
\n
"
,
bv
)
// phase 2: iterate through keys queued for A and B, delve into
// corresponding nodes, and merge diff generated from them into δ.
...
...
@@ -801,17 +800,21 @@ func diffT(ctx context.Context, a, b *Tree, δZTC SetOid, trackIdx map[zodb.Oid]
//
// XXX inefficient: 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
)
for
{
tracef
(
"
\n
"
)
tracef
(
" aq: %s
\n
"
,
Aqueue
)
tracef
(
" bq: %s
\n
"
,
Bqueue
)
if
len
(
Aqueue
)
==
0
&&
len
(
Bqueue
)
==
0
{
break
}
// B queue
// expand keys in new δA -> in B till buckets;
// process B buckets that cover new keys into δ+
Aqueue
=
SetKey
{}
for
k
:=
range
Bqueue
{
fmt
.
Print
f
(
" B [%v]
\n
"
,
k
)
trace
f
(
" B [%v]
\n
"
,
k
)
bnode
,
ok
,
err
:=
bv
.
GetToLeaf
(
ctx
,
k
)
if
err
!=
nil
{
return
nil
,
err
...
...
@@ -857,7 +860,7 @@ func diffT(ctx context.Context, a, b *Tree, δZTC SetOid, trackIdx map[zodb.Oid]
Bdone
.
Add
(
k
)
}
fmt
.
Print
f
(
" bv: %s
\n
"
,
bv
)
trace
f
(
" bv: %s
\n
"
,
bv
)
}
// FIXME update trackIdx
...
...
@@ -891,7 +894,7 @@ func diffT(ctx context.Context, a, b *Tree, δZTC SetOid, trackIdx map[zodb.Oid]
// A queue
Bqueue
=
SetKey
{}
for
k
:=
range
Aqueue
{
fmt
.
Print
f
(
" A [%v]
\n
"
,
k
)
trace
f
(
" A [%v]
\n
"
,
k
)
anode
,
ok
,
err
:=
av
.
GetToLeaf
(
ctx
,
k
)
if
err
!=
nil
{
return
nil
,
err
...
...
@@ -935,7 +938,7 @@ func diffT(ctx context.Context, a, b *Tree, δZTC SetOid, trackIdx map[zodb.Oid]
Adone
.
Add
(
k
)
}
fmt
.
Print
f
(
" av: %s
\n
"
,
av
)
trace
f
(
" av: %s
\n
"
,
av
)
}
}
...
...
@@ -946,8 +949,8 @@ 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
.
Print
f
(
" δmerge %v <- %v
\n
"
,
δ
,
δ2
)
defer
fmt
.
Print
f
(
" -> %v
\n
"
,
δ
)
trace
f
(
" δmerge %v <- %v
\n
"
,
δ
,
δ2
)
defer
trace
f
(
" -> %v
\n
"
,
δ
)
// merge δ <- δ2
for
k
,
δv2
:=
range
δ2
{
...
...
@@ -992,7 +995,7 @@ func δMerge(δ, δ2 map[Key]ΔValue) error {
δv
.
New
=
δv2
.
New
}
fmt
.
Print
f
(
" [%v] merge %s %s -> %s
\n
"
,
k
,
δv1
,
δv2
,
δv
)
trace
f
(
" [%v] merge %s %s -> %s
\n
"
,
k
,
δv1
,
δv2
,
δv
)
if
δv
.
Old
!=
δv
.
New
{
δ
[
k
]
=
δv
}
else
{
...
...
@@ -1007,7 +1010,7 @@ func δMerge(δ, δ2 map[Key]ΔValue) error {
// diffB computes difference in between two buckets.
// see diffX for details.
func
diffB
(
ctx
context
.
Context
,
a
,
b
*
Bucket
)
(
δ
map
[
Key
]
ΔValue
,
err
error
)
{
fmt
.
Printf
(
"
B %s %s
\n
"
,
xidOf
(
a
),
xidOf
(
b
))
tracef
(
" diff
B %s %s
\n
"
,
xidOf
(
a
),
xidOf
(
b
))
defer
xerr
.
Contextf
(
&
err
,
"diffB %s %s"
,
xidOf
(
a
),
xidOf
(
b
))
// XXX oid can be InvalidOid for T/B... (i.e. B is part of T and is not yet committed separately)
...
...
@@ -1028,7 +1031,7 @@ func diffB(ctx context.Context, a, b *Bucket) (δ map[Key]ΔValue, err error) {
//defer fmt.Println("< diffB")
δ
=
map
[
Key
]
ΔValue
{}
defer
fmt
.
Print
f
(
" -> δb: %v
\n
"
,
δ
)
defer
trace
f
(
" -> δb: %v
\n
"
,
δ
)
//fmt.Println("av:", av)
//fmt.Println("bv:", bv)
...
...
@@ -1256,3 +1259,12 @@ func (rn nodeInRange) String() string {
func
(
track
nodeTrack
)
String
()
string
{
return
fmt
.
Sprintf
(
"{p%s h%s}"
,
track
.
parent
,
track
.
holes
)
}
const
debug
=
true
func
tracef
(
format
string
,
argv
...
interface
{})
{
if
debug
{
fmt
.
Printf
(
format
,
argv
...
)
}
}
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