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
c0e82d8b
Commit
c0e82d8b
authored
Jun 19, 2020
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
55f9e24e
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
8 deletions
+18
-8
wcfs/δbtail.go
wcfs/δbtail.go
+18
-8
No files found.
wcfs/δbtail.go
View file @
c0e82d8b
...
...
@@ -52,6 +52,12 @@ const VDEL = zodb.InvalidOid
type
Oid
=
zodb
.
Oid
type
SetKey
=
SetI64
// ΔValue represents change in value.
type
ΔValue
struct
{
Vold
Value
Vnew
Value
}
// ΔBtail represents tail of revisional changes to BTrees.
//
...
...
@@ -431,13 +437,15 @@ func diffX(ctx context.Context, a, b Node, δZTC SetOid) (δ map[Key]Value, err
//
// a, b point to top of the subtree @old and @new revisions.
// δZTC is connected set of objects covering δZT (objects changed in this tree in old..new).
func
diffT
(
ctx
context
.
Context
,
a
,
b
*
Tree
,
δZTC
SetOid
)
(
δ
map
[
Key
]
Value
,
err
error
)
{
func
diffT
(
ctx
context
.
Context
,
a
,
b
*
Tree
,
δZTC
SetOid
)
(
δ
map
[
Key
]
Δ
Value
,
err
error
)
{
fmt
.
Printf
(
" T %s %s
\n
"
,
xidOf
(
a
),
xidOf
(
b
))
defer
xerr
.
Contextf
(
&
err
,
"diffT %s %s"
,
xidOf
(
a
),
xidOf
(
b
))
/*
if (a != nil && b != nil) && (a.POid() != b.POid()) {
panic
(
"different trees"
)
// XXX wrong - tree object can be changed completely
panic("different trees") // XXX wrong - tree object can be changed completely
?
}
*/
var
av
[]
TreeEntry
var
bv
[]
TreeEntry
...
...
@@ -499,7 +507,7 @@ func diffT(ctx context.Context, a, b *Tree, δZTC SetOid) (δ map[Key]Value, err
return
nil
,
fmt
.
Errorf
(
"BUG or btree corrupt: [%v] has "
+
"duplicate entries: %v, %v"
,
k
,
vprev
,
v
)
}
delete
(
δ
,
k
)
delete
(
δ
,
k
)
// FIXME does not notice change in v on reflow
}
}
...
...
@@ -522,13 +530,15 @@ func diffT(ctx context.Context, a, b *Tree, δZTC SetOid) (δ map[Key]Value, err
// diffB computes difference in between two revisions of a bucket.
// see diffX for details.
func
diffB
(
ctx
context
.
Context
,
a
,
b
*
Bucket
)
(
δ
map
[
Key
]
Value
,
err
error
)
{
func
diffB
(
ctx
context
.
Context
,
a
,
b
*
Bucket
)
(
δ
map
[
Key
]
Δ
Value
,
err
error
)
{
fmt
.
Printf
(
" 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)
/*
if (a != nil && b != nil) && (a.POid() != b.POid()) {
panic
(
"different buckets"
)
// XXX wrong - bucket object can be changed completely
panic("different buckets") // XXX wrong - bucket object can be changed completely
?
}
*/
var
av
[]
BucketEntry
...
...
@@ -572,17 +582,17 @@ func diffB(ctx context.Context, a, b *Bucket) (δ map[Key]Value, err error) {
switch
{
case
ka
<
kb
:
// -a[0]
δ
[
ka
]
=
VDEL
δ
[
ka
]
=
ΔValue
{
va
,
VDEL
}
av
=
av
[
1
:
]
case
ka
>
kb
:
// +b[0]
δ
[
kb
]
=
vb
δ
[
kb
]
=
ΔValue
{
VDEL
,
vb
}
bv
=
bv
[
1
:
]
// ka == kb // va->vb
default
:
if
va
!=
vb
{
δ
[
ka
]
=
vb
δ
[
ka
]
=
ΔValue
{
va
,
vb
}
}
av
=
av
[
1
:
]
bv
=
bv
[
1
:
]
...
...
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