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
57fc1eb2
Commit
57fc1eb2
authored
Jun 19, 2020
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
c0e82d8b
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
24 additions
and
10 deletions
+24
-10
wcfs/δbtail.go
wcfs/δbtail.go
+24
-10
No files found.
wcfs/δbtail.go
View file @
57fc1eb2
...
@@ -54,8 +54,8 @@ type SetKey = SetI64
...
@@ -54,8 +54,8 @@ type SetKey = SetI64
// ΔValue represents change in value.
// ΔValue represents change in value.
type
ΔValue
struct
{
type
ΔValue
struct
{
Vo
ld
Value
O
ld
Value
Vn
ew
Value
N
ew
Value
}
}
...
@@ -496,21 +496,34 @@ func diffT(ctx context.Context, a, b *Tree, δZTC SetOid) (δ map[Key]ΔValue, e
...
@@ -496,21 +496,34 @@ func diffT(ctx context.Context, a, b *Tree, δZTC SetOid) (δ map[Key]ΔValue, e
}
}
// merge δ <- δc
// merge δ <- δc
for
k
,
v
:=
range
δc
{
for
k
,
δv1
:=
range
δc
{
vprev
,
already
:=
δ
[
k
]
δv2
,
already
:=
δ
[
k
]
if
!
already
{
if
!
already
{
δ
[
k
]
=
v
δ
[
k
]
=
δv1
}
else
{
continue
}
// both δ and δc has [k] - it can be that key
// both δ and δc has [k] - it can be that key
// entry migrated from one bucket into another.
// entry migrated from one bucket into another.
if
(
vprev
==
VDEL
&&
v
==
VDEL
)
||
(
vprev
!=
VDEL
&&
v
!=
VDEL
)
{
if
!
(
(
δv2
.
New
==
VDEL
&&
δv1
.
Old
==
VDEL
)
||
(
δv2
.
Old
==
VDEL
&&
δv1
.
New
==
VDEL
)
)
{
return
nil
,
fmt
.
Errorf
(
"BUG or btree corrupt: [%v] has "
+
return
nil
,
fmt
.
Errorf
(
"BUG or btree corrupt: [%v] has "
+
"duplicate entries: %v, %v"
,
k
,
vprev
,
v
)
"duplicate entries: %v, %v"
,
k
,
δv1
,
δv2
)
}
}
delete
(
δ
,
k
)
// FIXME does not notice change in v on reflow
δv
:=
ΔValue
{}
if
δv1
.
New
==
VDEL
{
δv
.
Old
=
δv1
.
Old
δv
.
New
=
δv2
.
New
}
else
{
δv
.
Old
=
δv2
.
Old
δv
.
New
=
δv1
.
New
}
}
δ
[
k
]
=
δv
}
}
/*
// merge Tkdel <- δc
// merge Tkdel <- δc
for k, v := range δc {
for k, v := range δc {
if v == VDEL {
if v == VDEL {
...
@@ -519,6 +532,7 @@ func diffT(ctx context.Context, a, b *Tree, δZTC SetOid) (δ map[Key]ΔValue, e
...
@@ -519,6 +532,7 @@ func diffT(ctx context.Context, a, b *Tree, δZTC SetOid) (δ map[Key]ΔValue, e
delete(Tkdel, k)
delete(Tkdel, k)
}
}
}
}
*/
// XXX process keys from δ outside of already tracked nodes
// XXX process keys from δ outside of already tracked nodes
// XXX only deleted keys - no - delete can be from untracked
// XXX only deleted keys - no - delete can be from untracked
...
@@ -557,7 +571,7 @@ func diffB(ctx context.Context, a, b *Bucket) (δ map[Key]ΔValue, err error) {
...
@@ -557,7 +571,7 @@ func diffB(ctx context.Context, a, b *Bucket) (δ map[Key]ΔValue, err error) {
//fmt.Println("> diffB", a.POid())
//fmt.Println("> diffB", a.POid())
//defer fmt.Println("< diffB")
//defer fmt.Println("< diffB")
δ
=
map
[
Key
]
Value
{}
δ
=
map
[
Key
]
Δ
Value
{}
//fmt.Println("av:", av)
//fmt.Println("av:", av)
//fmt.Println("bv:", bv)
//fmt.Println("bv:", bv)
...
...
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