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
1
Issues
1
List
Boards
Labels
Milestones
Merge Requests
2
Merge Requests
2
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
neoppod
Commits
adb2ada3
Commit
adb2ada3
authored
Mar 12, 2019
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
go/zodb: Cosmetics
More comments, typos, ...
parent
1e6aeeee
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
18 additions
and
11 deletions
+18
-11
go/zodb/connection.go
go/zodb/connection.go
+5
-1
go/zodb/persistent_test.go
go/zodb/persistent_test.go
+9
-6
go/zodb/storage.go
go/zodb/storage.go
+4
-4
No files found.
go/zodb/connection.go
View file @
adb2ada3
...
...
@@ -125,7 +125,10 @@ type LiveCache struct {
}
// LiveCacheControl is the interface that allows applications to influence
// Connection's decisions with respect to Connection's live cache.
// Connection's decisions with respect to Connection's LiveCache.
//
// See Connection.Cache and LiveCache.SetControl for how to install
// LiveCacheControl on a connection's live cache.
type
LiveCacheControl
interface
{
// PCacheClassify is called to classify an object and returns live
// cache policy that should be used for this object.
...
...
@@ -210,6 +213,7 @@ func (e *wrongClassError) Error() string {
// Get lookups object corresponding to oid in the cache.
//
// If object is found, it is guaranteed to stay in live cache while the caller keeps reference to it.
// LiveCacheControl can be used to extend that guarantee.
func
(
cache
*
LiveCache
)
Get
(
oid
Oid
)
IPersistent
{
// 1. lookup in pinned objects (likely hottest ones)
obj
:=
cache
.
pinned
[
oid
]
...
...
go/zodb/persistent_test.go
View file @
adb2ada3
...
...
@@ -229,9 +229,9 @@ type tConnection struct {
*
testing
.
T
// a transaction and DB connection opened under it
txn
transaction
.
Transaction
ctx
context
.
Context
conn
*
Connection
txn
transaction
.
Transaction
ctx
context
.
Context
conn
*
Connection
}
// testdb creates and initializes new test database.
...
...
@@ -597,8 +597,8 @@ func testPersistentDB(t0 *testing.T, rawcache bool) {
t
.
checkObj
(
obj2
,
102
,
InvalidTid
,
GHOST
,
0
)
// obj2 data should be new
t
.
PActivate
(
obj1
)
;
t
.
PActivate
(
obj2
)
;
t
.
PActivate
(
obj1
)
t
.
PActivate
(
obj2
)
t
.
checkObj
(
obj1
,
101
,
at1
,
UPTODATE
,
1
,
"hello"
)
t
.
checkObj
(
obj2
,
102
,
at2
,
UPTODATE
,
1
,
"kitty"
)
...
...
@@ -613,6 +613,9 @@ func testPersistentDB(t0 *testing.T, rawcache bool) {
t2
.
Abort
()
assert
.
Equal
(
db
.
pool
,
[]
*
Connection
{
t1
.
conn
,
t2
.
conn
})
// ---- Resync ----
// open new connection in nopool mode to verify resync
t4
:=
tdb
.
Open
(
&
ConnOptions
{
NoPool
:
true
})
t
=
t4
...
...
@@ -685,7 +688,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
)
...
...
go/zodb/storage.go
View file @
adb2ada3
...
...
@@ -118,7 +118,7 @@ func Open(ctx context.Context, zurl string, opt *OpenOptions) (IStorage, error)
cache
=
NewCache
(
storDriver
,
128
*
4
*
1024
)
// FIXME teach cache for watching and remove vvv
log
.
Printf
(
"zodb: FIXME: open %s: cache is not ready for invalidations"
+
log
.
Printf
(
"zodb: FIXME: open %s:
raw
cache is not ready for invalidations"
+
" -> NoCache forced"
,
zurl
)
cache
=
nil
}
...
...
@@ -135,7 +135,7 @@ func Open(ctx context.Context, zurl string, opt *OpenOptions) (IStorage, error)
watchCancel
:
make
(
map
[
chan
<-
Event
]
chan
struct
{}),
}
go
stor
.
watcher
()
// stoped on close
go
stor
.
watcher
()
// stop
p
ed on close
return
stor
,
nil
}
...
...
@@ -145,7 +145,7 @@ func Open(ctx context.Context, zurl string, opt *OpenOptions) (IStorage, error)
// storage represents storage opened via Open.
//
// it provides a small cache on top of raw storage driver to implement prefetch
// and other storage-independe
d
higher-level functionality.
// and other storage-independe
nt
higher-level functionality.
type
storage
struct
{
driver
IStorageDriver
l1cache
*
Cache
// can be =nil, if opened with NoCache
...
...
@@ -281,7 +281,7 @@ func (s *storage) _watcher() error {
req
.
ack
<-
s
.
head
}
// close all subscribers's watchq on watcher shutdow
// close all subscribers's watchq on watcher shutdow
n
defer
func
()
{
addqFlush
()
for
watchq
:=
range
s
.
watchTab
{
...
...
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