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
5d69ba25
Commit
5d69ba25
authored
Jan 18, 2019
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
7a036b15
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
10 deletions
+4
-10
go/zodb/connection.go
go/zodb/connection.go
+4
-10
No files found.
go/zodb/connection.go
View file @
5d69ba25
...
...
@@ -61,10 +61,9 @@ type Connection struct {
//
// but does not hold strong reference to cached objects.
//
// LiveCache is safe to access for multiple-readers / single-writer.
// To do so the caller must explicitly serialize access with e.g. .Lock() .
// LiveCache is not safe to use from multiple goroutines simultaneously.
//
//
XXX try to hide locking from user?
//
Use .Lock() / .Unlock() to serialize access.
type
LiveCache
struct
{
// rationale for using weakref:
//
...
...
@@ -196,18 +195,13 @@ func (cache *LiveCache) SetControl(c LiveCacheControl) {
// Use-case: in ZODB references are (pyclass, oid), so new ghost is created
// without further loading anything.
func
(
conn
*
Connection
)
get
(
class
string
,
oid
Oid
)
(
IPersistent
,
error
)
{
checkClass
:=
true
conn
.
cache
.
Lock
()
// XXX -> rlock?
obj
:=
conn
.
cache
.
Get
(
oid
)
checkClass
:=
false
if
obj
==
nil
{
obj
=
newGhost
(
class
,
oid
,
conn
)
//if obj == nil {
// conn.cache.Unlock()
// return nil, fmt.Errorf("get %s: class %q not supported", Xid{conn.at, oid}, class)
//}
conn
.
cache
.
objtab
[
oid
]
=
weak
.
NewRef
(
obj
)
}
else
{
checkClass
=
true
checkClass
=
false
}
conn
.
cache
.
Unlock
()
...
...
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