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
ec7b9c09
Commit
ec7b9c09
authored
Jun 19, 2020
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
e092f7c9
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
22 additions
and
17 deletions
+22
-17
wcfs/δbtail.go
wcfs/δbtail.go
+22
-17
No files found.
wcfs/δbtail.go
View file @
ec7b9c09
...
@@ -330,38 +330,27 @@ func (δBtail *ΔBtail) treediff(ctx context.Context, root zodb.Oid, δZT SetOid
...
@@ -330,38 +330,27 @@ func (δBtail *ΔBtail) treediff(ctx context.Context, root zodb.Oid, δZT SetOid
fmt
.
Printf
(
"treediff %s δZT: %v
\n
"
,
root
,
δZT
)
fmt
.
Printf
(
"treediff %s δZT: %v
\n
"
,
root
,
δZT
)
// XXX δZT -> δZT
*
(all changed nodes are connected)
// XXX δZT -> δZT
C
(all changed nodes are connected)
// e.g. t₀->t₁->b₂ δZ={t₀ b₂} -> δZ
*
=δZ+{t₁}
// e.g. t₀->t₁->b₂ δZ={t₀ b₂} -> δZ
C
=δZ+{t₁}
δZTC
:=
δZT
// FIXME stub
δZTC
:=
δZT
// FIXME stub
δT
=
map
[
Key
]
Value
{}
δT
=
map
[
Key
]
Value
{}
for
top
:=
range
δZT
{
// XXX ->
for each top-level nodes in δZT*
for
top
:=
range
δZT
{
// XXX ->
sorted?
xa
,
err1
:=
zconnOld
.
Get
(
ctx
,
top
)
a
,
err1
:=
zgetNode
(
ctx
,
zconnOld
,
top
)
xb
,
err2
:=
zconnNew
.
Get
(
ctx
,
top
)
b
,
err2
:=
zgetNode
(
ctx
,
zconnNew
,
top
)
err
:=
xerr
.
Merge
(
err1
,
err2
)
err
:=
xerr
.
Merge
(
err1
,
err2
)
if
err
!=
nil
{
if
err
!=
nil
{
return
nil
,
err
return
nil
,
err
}
}
a
,
ok
:=
xa
.
(
Node
)
if
!
ok
{
return
nil
,
fmt
.
Errorf
(
"object %s@%s: type unexpected: %s"
,
top
,
zconnOld
.
At
(),
zodb
.
ClassOf
(
xa
))
}
b
,
ok
:=
xb
.
(
Node
)
if
!
ok
{
return
nil
,
fmt
.
Errorf
(
"object %s@%s: type unexpected: %s"
,
top
,
zconnNew
.
At
(),
zodb
.
ClassOf
(
xb
))
}
δtop
,
err
:=
diffX
(
ctx
,
a
,
b
,
δZTC
)
δtop
,
err
:=
diffX
(
ctx
,
a
,
b
,
δZTC
)
if
err
!=
nil
{
if
err
!=
nil
{
return
nil
,
err
return
nil
,
err
}
}
// FIXME -> merge (VDEL vs add)
// FIXME -> merge (VDEL vs add)
// XXX no - not needed here - changes cannot migrate in between two disconnected subtrees
for
k
,
v
:=
range
δtop
{
for
k
,
v
:=
range
δtop
{
δT
[
k
]
=
v
δT
[
k
]
=
v
}
}
...
@@ -564,6 +553,22 @@ func diffB(ctx context.Context, a, b *Bucket) (δ map[Key]Value, err error) {
...
@@ -564,6 +553,22 @@ func diffB(ctx context.Context, a, b *Bucket) (δ map[Key]Value, err error) {
return
δ
,
nil
return
δ
,
nil
}
}
// zgetNode returns btree node corresponding to zconn.Get(oid)
func
zgetNode
(
ctx
context
.
Context
,
zconn
*
zodb
.
Connection
,
oid
zodb
.
Oid
)
(
_
Node
,
err
error
)
{
defer
xerr
.
Contextf
(
&
err
,
"getnode %s@%s"
,
oid
,
zconn
.
At
())
xnode
,
err
:=
zconn
.
Get
(
ctx
,
oid
)
if
err
!=
nil
{
return
nil
,
err
}
node
,
ok
:=
xnode
.
(
Node
)
if
!
ok
{
return
nil
,
fmt
.
Errorf
(
"unexpected type: %s"
,
zodb
.
ClassOf
(
xnode
))
}
return
node
,
nil
}
// vOid returns OID of a value object.
// vOid returns OID of a value object.
// it is an error if value is not persistent object.
// it is an error if value is not persistent object.
func
vOid
(
xvalue
interface
{})
(
zodb
.
Oid
,
error
)
{
func
vOid
(
xvalue
interface
{})
(
zodb
.
Oid
,
error
)
{
...
...
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