Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
W
wendelin.core
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Labels
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
Kirill Smelkov
wendelin.core
Commits
39e27aa5
Commit
39e27aa5
authored
Jul 19, 2018
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
f0931de9
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
15 deletions
+20
-15
wcfs/zodb.go
wcfs/zodb.go
+20
-15
No files found.
wcfs/zodb.go
View file @
39e27aa5
...
...
@@ -361,6 +361,13 @@ func (conn *Connection) get(pyclass pickle.Class, oid zodb.Oid) (PyObject, error
}
// load loads object specified by oid.
//
// XXX must be called ... (XXX e.g. outside transaction boundary) so that there is no race on .at .
func
(
conn
*
Connection
)
load
(
ctx
context
.
Context
,
oid
zodb
.
Oid
)
(
_
*
mem
.
Buf
,
serial
zodb
.
Tid
,
_
error
)
{
return
conn
.
stor
.
Load
(
ctx
,
zodb
.
Xid
{
Oid
:
oid
,
At
:
conn
.
at
})
}
// loadpy loads object specified by oid and decodes it as a ZODB Python object.
//
// loadpy does not create any in-RAM object associated with Connection.
...
...
@@ -499,7 +506,7 @@ func (obj *object) invalidate() {
// PActivate implements Object.
func
(
obj
*
object
)
PActivate
(
ctx
context
.
Context
)
(
err
error
)
{
obj
.
mu
.
Lock
()
ob
.
refcnt
++
ob
j
.
refcnt
++
doload
:=
(
obj
.
refcnt
==
1
&&
obj
.
state
==
GHOST
)
defer
func
()
{
if
err
!=
nil
{
...
...
@@ -530,35 +537,33 @@ func (obj *object) PActivate(ctx context.Context) (err error) {
obj
.
mu
.
Unlock
()
// do the loading outside of obj lock
buf
,
serial
,
err
:=
obj
.
jar
.
load
(
ctx
,
obj
.
oid
)
state
,
serial
,
err
:=
obj
.
jar
.
load
(
ctx
,
obj
.
oid
)
if
err
==
nil
{
err
=
obj
.
instance
.
SetState
(
buf
)
// XXX err ctx
buf
.
Release
()
err
=
obj
.
instance
.
SetState
(
state
)
// XXX err ctx
state
.
Release
()
}
// relock the object
py
obj
.
mu
.
Lock
()
obj
.
mu
.
Lock
()
// XXX assert
py
obj.loading == loading
// XXX assert
py
obj.state == GHOST
// XXX assert obj.loading == loading
// XXX assert obj.state == GHOST
pyobj
.
serial
=
serial
// pyobj.pystate = pystate
obj
.
serial
=
serial
if
err
==
nil
{
err
=
pyobj
.
instance
.
PySetState
(
pystate
)
// XXX err ctx
err
=
obj
.
instance
.
SetState
(
state
)
// XXX err ctx
state
.
Release
()
}
if
err
!=
nil
{
py
obj
.
instance
.
DropState
()
// XXX already in deactivate
obj
.
instance
.
DropState
()
// XXX already in deactivate
}
else
{
py
obj
.
state
=
UPTODATE
obj
.
state
=
UPTODATE
}
loading
.
err
=
err
py
obj
.
mu
.
Unlock
()
obj
.
mu
.
Unlock
()
close
(
loading
.
ready
)
return
err
// XXX err ctx
...
...
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