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
2b697d13
Commit
2b697d13
authored
Jun 19, 2020
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
57fc1eb2
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
9 deletions
+9
-9
wcfs/δbtail.go
wcfs/δbtail.go
+8
-8
wcfs/δbtail_test.go
wcfs/δbtail_test.go
+1
-1
No files found.
wcfs/δbtail.go
View file @
2b697d13
...
@@ -130,7 +130,7 @@ type ΔBtail struct {
...
@@ -130,7 +130,7 @@ type ΔBtail struct {
// ΔB represents a change in BTrees space.
// ΔB represents a change in BTrees space.
type
ΔB
struct
{
type
ΔB
struct
{
Rev
zodb
.
Tid
Rev
zodb
.
Tid
ByRoot
map
[
zodb
.
Oid
]
map
[
Key
]
Value
// {} root -> {}(key,
value)
ByRoot
map
[
zodb
.
Oid
]
map
[
Key
]
ΔValue
// {} root -> {}(key, δ
value)
}
}
/*
/*
...
@@ -291,7 +291,7 @@ func (δBtail *ΔBtail) Update(δZ *zodb.EventCommit) (_ ΔB, err error) {
...
@@ -291,7 +291,7 @@ func (δBtail *ΔBtail) Update(δZ *zodb.EventCommit) (_ ΔB, err error) {
}
}
fmt
.
Println
(
"δZByRoot:"
,
δZByRoot
)
fmt
.
Println
(
"δZByRoot:"
,
δZByRoot
)
δB
:=
ΔB
{
Rev
:
δZ
.
Tid
,
ByRoot
:
make
(
map
[
zodb
.
Oid
]
map
[
Key
]
Value
)}
δB
:=
ΔB
{
Rev
:
δZ
.
Tid
,
ByRoot
:
make
(
map
[
zodb
.
Oid
]
map
[
Key
]
Δ
Value
)}
// skip opening DB connections if there is no change to any tree node
// skip opening DB connections if there is no change to any tree node
if
len
(
δZByRoot
)
==
0
{
if
len
(
δZByRoot
)
==
0
{
...
@@ -347,7 +347,7 @@ func (δBtail *ΔBtail) Update(δZ *zodb.EventCommit) (_ ΔB, err error) {
...
@@ -347,7 +347,7 @@ func (δBtail *ΔBtail) Update(δZ *zodb.EventCommit) (_ ΔB, err error) {
//
//
// XXX only for tracked
// XXX only for tracked
// δZT is δZ/T - subset of δZ(old..new) that touches tracked nodes of T.
// δZT is δZ/T - subset of δZ(old..new) that touches tracked nodes of T.
func
treediff
(
ctx
context
.
Context
,
root
zodb
.
Oid
,
δZT
SetOid
,
zconnOld
,
zconnNew
*
zodb
.
Connection
)
(
δT
map
[
Key
]
Value
,
err
error
)
{
func
treediff
(
ctx
context
.
Context
,
root
zodb
.
Oid
,
δZT
SetOid
,
zconnOld
,
zconnNew
*
zodb
.
Connection
)
(
δT
map
[
Key
]
Δ
Value
,
err
error
)
{
defer
xerr
.
Contextf
(
&
err
,
"treediff %s..%s %s"
,
zconnOld
.
At
(),
zconnNew
.
At
(),
root
)
defer
xerr
.
Contextf
(
&
err
,
"treediff %s..%s %s"
,
zconnOld
.
At
(),
zconnNew
.
At
(),
root
)
// XXX zconnX -> a, b ?
// XXX zconnX -> a, b ?
...
@@ -357,7 +357,7 @@ func treediff(ctx context.Context, root zodb.Oid, δZT SetOid, zconnOld, zconnNe
...
@@ -357,7 +357,7 @@ func treediff(ctx context.Context, root zodb.Oid, δZT SetOid, zconnOld, zconnNe
// e.g. t₀->t₁->b₂ δZ={t₀ b₂} -> δZC=δZ+{t₁}
// e.g. t₀->t₁->b₂ δZ={t₀ b₂} -> δZC=δZ+{t₁}
δZTC
:=
δZT
// FIXME stub
δZTC
:=
δZT
// FIXME stub
δT
=
map
[
Key
]
Value
{}
δT
=
map
[
Key
]
Δ
Value
{}
for
top
:=
range
δZT
{
// XXX -> sorted?
for
top
:=
range
δZT
{
// XXX -> sorted?
a
,
err1
:=
zgetNode
(
ctx
,
zconnOld
,
top
)
a
,
err1
:=
zgetNode
(
ctx
,
zconnOld
,
top
)
...
@@ -376,8 +376,8 @@ func treediff(ctx context.Context, root zodb.Oid, δZT SetOid, zconnOld, zconnNe
...
@@ -376,8 +376,8 @@ func treediff(ctx context.Context, root zodb.Oid, δZT SetOid, zconnOld, zconnNe
// XXX no - not needed here - keys cannot migrate in between two disconnected subtrees
// XXX no - not needed here - keys cannot migrate in between two disconnected subtrees
// DEL k -> Tkextra += k
// DEL k -> Tkextra += k
// +k -> Tkextra -= k
// +k -> Tkextra -= k
for
k
,
v
:=
range
δtop
{
for
k
,
δ
v
:=
range
δtop
{
δT
[
k
]
=
v
δT
[
k
]
=
δ
v
}
}
}
}
...
@@ -392,7 +392,7 @@ func treediff(ctx context.Context, root zodb.Oid, δZT SetOid, zconnOld, zconnNe
...
@@ -392,7 +392,7 @@ func treediff(ctx context.Context, root zodb.Oid, δZT SetOid, zconnOld, zconnNe
// δZTC is connected set of objects covering δZT (objects changed in this tree in old..new).
// δZTC is connected set of objects covering δZT (objects changed in this tree in old..new).
//
//
// a/b can be nil; a=nil means addition, b=nil means deletion.
// a/b can be nil; a=nil means addition, b=nil means deletion.
func
diffX
(
ctx
context
.
Context
,
a
,
b
Node
,
δZTC
SetOid
)
(
δ
map
[
Key
]
Value
,
err
error
)
{
func
diffX
(
ctx
context
.
Context
,
a
,
b
Node
,
δZTC
SetOid
)
(
δ
map
[
Key
]
Δ
Value
,
err
error
)
{
if
a
==
nil
&&
b
==
nil
{
if
a
==
nil
&&
b
==
nil
{
panic
(
"BUG: both a & b == nil"
)
panic
(
"BUG: both a & b == nil"
)
}
}
...
@@ -460,7 +460,7 @@ func diffT(ctx context.Context, a, b *Tree, δZTC SetOid) (δ map[Key]ΔValue, e
...
@@ -460,7 +460,7 @@ func diffT(ctx context.Context, a, b *Tree, δZTC SetOid) (δ map[Key]ΔValue, e
bv
=
b
.
Entryv
()
// key↑
bv
=
b
.
Entryv
()
// key↑
}
}
δ
=
map
[
Key
]
Value
{}
δ
=
map
[
Key
]
Δ
Value
{}
// [i].Key ≤ [i].Child.*.Key < [i+1].Key i ∈ [0, len([]))
// [i].Key ≤ [i].Child.*.Key < [i+1].Key i ∈ [0, len([]))
//
//
...
...
wcfs/δbtail_test.go
View file @
2b697d13
...
@@ -596,7 +596,7 @@ func xverifyΔBTail1(t *testing.T, subj string, db *zodb.DB, treeRoot zodb.Oid,
...
@@ -596,7 +596,7 @@ func xverifyΔBTail1(t *testing.T, subj string, db *zodb.DB, treeRoot zodb.Oid,
// δT <- δB
// δT <- δB
δToid
:=
δB
.
ByRoot
[
treeRoot
]
// {} k -> oid
δToid
:=
δB
.
ByRoot
[
treeRoot
]
// {} k ->
δ
oid
δT
=
XGetKV
(
db
,
at2
,
δToid
)
// {} k -> ZBlk(oid).data
δT
=
XGetKV
(
db
,
at2
,
δToid
)
// {} k -> ZBlk(oid).data
// δT must be subset of d12.
// δT must be subset of d12.
...
...
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