Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
N
neo
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Labels
Merge Requests
2
Merge Requests
2
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Jobs
Commits
Open sidebar
Kirill Smelkov
neo
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
Show 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