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
234f0bbc
Commit
234f0bbc
authored
Mar 11, 2019
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
6c7f41ba
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
52 additions
and
1 deletion
+52
-1
go/zodb/persistent_test.go
go/zodb/persistent_test.go
+52
-1
No files found.
go/zodb/persistent_test.go
View file @
234f0bbc
...
...
@@ -699,7 +699,7 @@ func testPersistentDB(t0 *testing.T, rawcache bool) {
t
.
checkObj
(
robj1
,
101
,
InvalidTid
,
GHOST
,
0
)
t
.
checkObj
(
robj2
,
102
,
at2
,
UPTODATE
,
0
,
"kitty"
)
// Resync ↓ (at
1
-> at0; to outside δtail coverage)
// Resync ↓ (at
2
-> at0; to outside δtail coverage)
t
.
Abort
()
assert
.
Equal
(
db
.
pool
,
[]
*
Connection
{
t1
.
conn
,
t2
.
conn
})
t
.
Resync
(
at0
)
...
...
@@ -730,6 +730,57 @@ func testPersistentDB(t0 *testing.T, rawcache bool) {
t
.
checkObj
(
robj2
,
102
,
InvalidTid
,
GHOST
,
0
)
}
// Test details of how LiveCache handles live caching policy.
func
TestLiveCache
(
t0
*
testing
.
T
)
{
tdb
:=
testdb
(
t0
,
/*rawcache=*/
false
)
defer
tdb
.
Close
()
tdb
.
Add
(
101
,
"мир"
)
tdb
.
Add
(
102
,
"труд"
)
tdb
.
Add
(
103
,
"май"
)
tdb
.
Commit
()
at1
:=
tdb
.
head
zcc
:=
&
zcacheControl
{
map
[
Oid
]
PCachePolicy
{
// obj1 - don't pin and don't keep state (default)
101
:
0
,
// obj2 - pin and keep state
102
:
PCachePinObject
|
PCacheKeepState
,
// obj3 - pin, but don't keep state
103
:
PCachePinObject
|
PCacheNonTemporal
,
}}
t
:=
tdb
.
Open
(
&
ConnOptions
{})
zcache
:=
t
.
conn
.
Cache
()
zcache
.
Lock
()
zcache
.
SetControl
(
zcc
)
zcache
.
Unlock
()
// get objects
obj1
:=
t
.
Get
(
101
)
obj2
:=
t
.
Get
(
102
)
obj3
:=
t
.
Get
(
103
)
t
.
checkObj
(
obj1
,
101
,
InvalidTid
,
GHOST
,
0
)
t
.
checkObj
(
obj2
,
102
,
InvalidTid
,
GHOST
,
0
)
t
.
checkObj
(
obj3
,
103
,
InvalidTid
,
GHOST
,
0
)
// activate * -> uptodate
t
.
PActivate
(
obj1
)
t
.
PActivate
(
obj2
)
t
.
PActivate
(
obj3
)
t
.
checkObj
(
obj1
,
101
,
at1
,
UPTODATE
,
1
,
"мир"
)
t
.
checkObj
(
obj2
,
102
,
at1
,
UPTODATE
,
1
,
"труд"
)
t
.
checkObj
(
obj3
,
103
,
at1
,
UPTODATE
,
1
,
"май"
)
// deactivate obj{1,3} drop state, obj2 is kept
obj1
.
PDeactivate
()
obj2
.
PDeactivate
()
obj3
.
PDeactivate
()
t
.
checkObj
(
obj1
,
101
,
InvalidTid
,
GHOST
,
0
)
t
.
checkObj
(
obj2
,
102
,
at1
,
UPTODATE
,
0
,
"труд"
)
t
.
checkObj
(
obj3
,
103
,
at1
,
UPTODATE
,
0
,
"май"
)
}
// TODO Map & List tests.
...
...
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