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
b34819df
Commit
b34819df
authored
Jun 23, 2020
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
74fc8bb8
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
26 deletions
+15
-26
wcfs/δbtail.go
wcfs/δbtail.go
+15
-26
No files found.
wcfs/δbtail.go
View file @
b34819df
...
...
@@ -716,28 +716,11 @@ func diffT(ctx context.Context, a, b *Tree, δZTC SetOid, trackIdx map[zodb.Oid]
fmt
.
Printf
(
" T %s %s
\n
"
,
xidOf
(
a
),
xidOf
(
b
))
defer
xerr
.
Contextf
(
&
err
,
"diffT %s %s"
,
xidOf
(
a
),
xidOf
(
b
))
/*
var av []TreeEntry
var bv []TreeEntry
if a != nil {
err = a.PActivate(ctx); if err != nil { return nil, err }
defer a.PDeactivate()
av = a.Entryv() // key↑
}
if b != nil {
err = b.PActivate(ctx); if err != nil { return nil, err }
defer b.PDeactivate()
bv = b.Entryv() // key↑
}
fmt.Printf(" av: %s\n", vtree(av))
fmt.Printf(" bv: %v\n", vtree(bv))
*/
δ
=
map
[
Key
]
ΔValue
{}
defer
fmt
.
Printf
(
" -> δt: %v
\n
"
,
δ
)
var
av
rangeSplit
var
bv
rangeSplit
var
av
rangeSplit
// nodes expanded from a
var
bv
rangeSplit
// nodes expanded from b
// initial phase: expand changed nodes in a till buckets;
// XXX changed buckets -> δ-
...
...
@@ -768,8 +751,11 @@ func diffT(ctx context.Context, a, b *Tree, δZTC SetOid, trackIdx map[zodb.Oid]
return
nil
,
err
}
// XXX δ <- δA
// δ <- δA
δMerge
(
δ
,
δA
)
// XXX AKeysDone <- δA
// XXX Bqueue <- δA
}
}
}
...
...
@@ -792,13 +778,15 @@ func diffT(ctx context.Context, a, b *Tree, δZTC SetOid, trackIdx map[zodb.Oid]
// XXX check bucket for already "done" (i.e. taken into account)
bbucket
.
node
.
(
*
Bucket
)
δB
,
err
:=
diffB
(
ctx
,
nil
,
bbucket
.
node
.
(
*
Bucket
))
if
err
!=
nil
{
return
nil
,
err
}
// XXX δ <- δB
// δ <- δB
δMerge
(
δ
,
δB
)
// XXX Aqueue <- δB
for
k
,
δv
:=
range
δ
{
if
!
AKeysDone
.
Has
(
k
)
{
Akeysq
.
Add
(
k
)
...
...
@@ -881,7 +869,7 @@ func diffT(ctx context.Context, a, b *Tree, δZTC SetOid, trackIdx map[zodb.Oid]
}
// merge δ <- δc
δ
mergeInto
(
δ
,
δc
)
δ
Merge
(
δ
,
δc
)
// update δc -> tracked keys
...
...
@@ -915,9 +903,9 @@ func diffT(ctx context.Context, a, b *Tree, δZTC SetOid, trackIdx map[zodb.Oid]
}
// δ
mergeInto
merges changes from δ2 into δ.
//
Usually δ is total-building δ
, while δ2 is diff from comparing some subnodes.
func
δ
mergeInto
(
δ
,
δ2
map
[
Key
]
ΔValue
)
{
// δ
Merge
merges changes from δ2 into δ.
//
δ is total-building diff
, while δ2 is diff from comparing some subnodes.
func
δ
Merge
(
δ
,
δ2
map
[
Key
]
ΔValue
)
{
// merge δ <- δ2
for
k
,
δv2
:=
range
δ2
{
δv1
,
already
:=
δ
[
k
]
...
...
@@ -928,6 +916,7 @@ func δmergeInto(δ, δ2 map[Key]ΔValue) {
// both δ and δ2 has [k] - it can be that key
// entry migrated from one bucket into another.
// XXX also handle ø->ø + ø->c i.e. [k] was hole and become value
if
!
(
(
δv1
.
New
==
VDEL
&&
δv2
.
Old
==
VDEL
)
||
(
δv1
.
Old
==
VDEL
&&
δv2
.
New
==
VDEL
)
)
{
return
nil
,
fmt
.
Errorf
(
"BUG or btree corrupt: [%v] has "
+
...
...
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