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
d7bd43d7
Commit
d7bd43d7
authored
Jun 19, 2020
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
85e32cdc
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
18 additions
and
16 deletions
+18
-16
wcfs/δbtail.go
wcfs/δbtail.go
+2
-1
wcfs/δbtail_test.go
wcfs/δbtail_test.go
+16
-15
No files found.
wcfs/δbtail.go
View file @
d7bd43d7
...
...
@@ -29,6 +29,7 @@ import (
"context"
"fmt"
"math"
"reflect"
"lab.nexedi.com/kirr/go123/xerr"
"lab.nexedi.com/kirr/neo/go/transaction"
...
...
@@ -648,7 +649,7 @@ func vOid(xvalue interface{}) (zodb.Oid, error) {
// xidOf return string representation of object xid.
func
xidOf
(
obj
zodb
.
IPersistent
)
string
{
if
obj
==
nil
{
if
obj
==
nil
||
reflect
.
ValueOf
(
obj
)
.
IsNil
()
{
return
"ø"
}
xid
:=
zodb
.
Xid
{
At
:
obj
.
PJar
()
.
At
(),
Oid
:
obj
.
POid
()}
...
...
wcfs/δbtail_test.go
View file @
d7bd43d7
...
...
@@ -505,7 +505,7 @@ func xverifyΔBTail1(t *testing.T, subj string, db *zodb.DB, treeRoot zodb.Oid,
X
:=
exc
.
Raiseif
var
kadjTracked
SetKey
=
nil
var
δT
map
[
Key
]
Δstring
=
nil
var
δT
,
δTok
map
[
Key
]
Δstring
=
nil
,
nil
// badf queues error message to be reported on return.
var
badv
[]
string
...
...
@@ -515,7 +515,7 @@ func xverifyΔBTail1(t *testing.T, subj string, db *zodb.DB, treeRoot zodb.Oid,
defer
func
()
{
if
badv
!=
nil
{
emsg
:=
fmt
.
Sprintf
(
"%s ; tracked=%v :
\n\n
"
,
subj
,
initialTrackedKeys
)
emsg
+=
fmt
.
Sprintf
(
"d12: %v
\n
δT
: %v
\n\n
"
,
d12
,
δT
)
emsg
+=
fmt
.
Sprintf
(
"d12: %v
\n
δT
ok: %v
\n
δT: %v
\n\n
"
,
d12
,
δTok
,
δT
)
emsg
+=
fmt
.
Sprintf
(
"kadj[Tracked]: %v
\n
kadj: %v
\n\n
"
,
kadjTracked
,
kadj
)
emsg
+=
strings
.
Join
(
badv
,
"
\n
"
)
emsg
+=
"
\n
"
...
...
@@ -570,10 +570,10 @@ func xverifyΔBTail1(t *testing.T, subj string, db *zodb.DB, treeRoot zodb.Oid,
// k ∈ δT <=>
// k ∈ U kadj[·]
// ·∈tracking
inδTOK
:=
SetKey
{}
// all keys that should be present in δT
for
k
:=
range
d12
{
δTok
=
map
[
Key
]
Δstring
{}
// d12[all keys that should be present in δT]
for
k
,
δv
:=
range
d12
{
if
kadjTracked
.
Has
(
k
)
{
inδTOK
.
Add
(
k
)
δTok
[
k
]
=
δv
}
}
...
...
@@ -589,10 +589,10 @@ func xverifyΔBTail1(t *testing.T, subj string, db *zodb.DB, treeRoot zodb.Oid,
// XXX verify δbtail index consistency against @at2
// assert δB.ByRoot == {treeRoot -> ...} if
inδTOK
!= ø
// == ø if
inδTOK
== ø
// assert δB.ByRoot == {treeRoot -> ...} if
δTok
!= ø
// == ø if
δTok
== ø
rootsOK
:=
SetOid
{}
if
len
(
inδTOK
)
>
0
{
if
len
(
δTok
)
>
0
{
rootsOK
.
Add
(
treeRoot
)
}
roots
:=
SetOid
{}
...
...
@@ -600,7 +600,7 @@ func xverifyΔBTail1(t *testing.T, subj string, db *zodb.DB, treeRoot zodb.Oid,
roots
.
Add
(
root
)
}
if
!
reflect
.
DeepEqual
(
roots
,
rootsOK
)
{
badf
(
"δB: roots != rootsOK ;
inδTOK=%v roots=%v rootsOK=%v"
,
inδTOK
,
roots
,
rootsOK
)
badf
(
"δB: roots != rootsOK ;
roots=%v rootsOK=%v"
,
roots
,
rootsOK
)
return
}
...
...
@@ -618,7 +618,7 @@ func xverifyΔBTail1(t *testing.T, subj string, db *zodb.DB, treeRoot zodb.Oid,
for
_
,
k
:=
range
sortedKeys
(
δT
)
{
_
,
ind12
:=
d12
[
k
]
if
!
ind12
{
badf
(
"δT
: [%v] is not in
d12"
,
k
)
badf
(
"δT
[%v] ∉
d12"
,
k
)
}
}
...
...
@@ -626,17 +626,18 @@ func xverifyΔBTail1(t *testing.T, subj string, db *zodb.DB, treeRoot zodb.Oid,
// k ∉ tracked set -> may be present in δT (kadj gives exact answer)
for
_
,
k
:=
range
sortedKeys
(
d12
)
{
_
,
inδT
:=
δT
[
k
]
if
inδT
&&
!
inδTOK
.
Has
(
k
)
{
badf
(
"δT: [%v] is extra"
,
k
)
_
,
inδTok
:=
δTok
[
k
]
if
inδT
&&
!
inδTok
{
badf
(
"δT[%v] ∉ δTok"
,
k
)
}
if
!
inδT
&&
inδT
OK
.
Has
(
k
)
{
badf
(
"δT
: [%v] is missing
"
,
k
)
if
!
inδT
&&
inδT
ok
{
badf
(
"δT
∌ δTok[%v]
"
,
k
)
}
if
inδT
{
if
δT
[
k
]
!=
d12
[
k
]
{
badf
(
"δT[%v]
!= d12
[%v]"
,
k
,
k
)
badf
(
"δT[%v]
≠ δTok
[%v]"
,
k
,
k
)
}
}
}
...
...
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