Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
N
neoppod
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Levin Zimmermann
neoppod
Commits
aa5e9280
Commit
aa5e9280
authored
Aug 24, 2017
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
9033940f
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
21 additions
and
9 deletions
+21
-9
go/neo/client/cache.go
go/neo/client/cache.go
+1
-1
go/neo/client/cache_test.go
go/neo/client/cache_test.go
+20
-8
No files found.
go/neo/client/cache.go
View file @
aa5e9280
...
@@ -101,7 +101,7 @@ type revCacheEntry struct {
...
@@ -101,7 +101,7 @@ type revCacheEntry struct {
}
}
func
NewCache
(
loader
storLoader
)
*
Cache
{
func
NewCache
(
loader
storLoader
)
*
Cache
{
return
&
Cache
{
loader
:
loader
}
return
&
Cache
{
loader
:
loader
,
entryMap
:
make
(
map
[
zodb
.
Oid
]
*
oidCacheEntry
)
}
}
}
// newReveEntry creates new revCacheEntry with .before and inserts it into .revv @i
// newReveEntry creates new revCacheEntry with .before and inserts it into .revv @i
...
...
go/neo/client/cache_test.go
View file @
aa5e9280
...
@@ -20,6 +20,7 @@
...
@@ -20,6 +20,7 @@
package
client
package
client
import
(
import
(
"reflect"
"sort"
"sort"
"testing"
"testing"
...
@@ -116,15 +117,26 @@ func TestCache(t *testing.T) {
...
@@ -116,15 +117,26 @@ func TestCache(t *testing.T) {
// rcePrev + rce
// rcePrev + rce
// rcePrev + (rce + rceNext)
// rcePrev + (rce + rceNext)
ok1
:=
func
(
v
bool
)
{
t
.
Helper
();
if
!
v
{
t
.
Fatal
(
"!ok"
)
}
}
eq
:=
reflect
.
DeepEqual
c
:=
NewCache
(
tstor
)
c
:=
NewCache
(
tstor
)
c
.
Load
(
1
,
<
2
)
->
nil
,
0
,
&
zodb
.
ErrXidMissing
xid1
:=
zodb
.
Xid
{
Oid
:
1
,
XTid
:
zodb
.
XTid
{
Tid
:
2
,
TidBefore
:
true
}}
oce1
:=
c
.
entryMap
[
1
]
data
,
serial
,
err
:=
c
.
Load
(
xid1
)
// -> nil, 0, &zodb.ErrXidMissing{1,<2}
len
(
oce1
.
revv
)
==
1
ok1
(
data
==
nil
)
rce1_2
:=
oce1
.
revv
[
0
]
ok1
(
serial
==
0
)
rce1_2
.
before
==
2
ok1
(
eq
(
err
,
&
zodb
.
ErrXidMissing
{
xid1
}))
rce1_2
.
serial
==
0
rce1_2
.
err
==
zodb
.
ErrXidMissing
c
.
Load
(
1
,
<
3
)
->
nil
,
0
,
zodb
.
ErrXidMissing
oce1
:=
c
.
entryMap
[
1
]
ok1
(
len
(
oce1
.
revv
)
==
1
)
rce1_b2
:=
oce1
.
revv
[
0
]
ok1
(
rce1_b2
.
before
==
2
)
ok1
(
rce1_b2
.
serial
==
0
)
ok1
(
eq
(
rce1_b2
.
err
,
zodb
.
ErrXidMissing
{
xid1
}))
// XXX must be 1, ?0
xid1
.
Tid
=
3
c
.
Load
(
xid1
)
// -> nil, 0, zodb.ErrXidMissing{1,<3}
ok1
(
len
(
oce1
.
revv
)
==
1
)
ok1
(
oce1
.
revv
[
0
]
==
rce1_b2
)
}
}
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