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
785acadf
Commit
785acadf
authored
Jul 19, 2018
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
873b5e4b
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
11 deletions
+10
-11
wcfs/zodb.go
wcfs/zodb.go
+6
-6
wcfs/zodbpy.go
wcfs/zodbpy.go
+4
-5
No files found.
wcfs/zodb.go
View file @
785acadf
...
...
@@ -105,7 +105,7 @@ type object struct {
mu
sync
.
Mutex
state
ObjectState
refcnt
int32
instance
Object
instance
Object
// object should be the base for the instance
loading
*
loadState
}
...
...
@@ -138,7 +138,7 @@ type Stateful interface {
SetState
(
state
*
mem
.
Buf
)
error
// GetState should return state of the in-RAM object as raw data.
//GetState() *mem.Buf
//GetState() *mem.Buf
TODO
}
...
...
@@ -206,7 +206,6 @@ type Connection struct {
objmu
sync
.
Mutex
objtab
map
[
zodb
.
Oid
]
*
WeakRef
// oid -> WeakRef(Object)
// hooks for application to influence live caching decisions.
cacheControl
LiveCacheControl
}
...
...
@@ -267,12 +266,13 @@ func (obj *object) PActivate(ctx context.Context) (err error) {
obj
.
serial
=
serial
// try to pass loaded state to object
if
err
==
nil
{
err
=
obj
.
instance
.
SetState
(
state
)
// XXX err ctx
state
.
Release
()
}
if
err
==
nil
{
obj
.
state
=
UPTODATE
if
err
==
nil
{
obj
.
state
=
UPTODATE
}
}
loading
.
err
=
err
...
...
wcfs/zodbpy.go
View file @
785acadf
...
...
@@ -31,7 +31,7 @@ type PyObject interface {
PyClass
()
pickle
.
Class
// python class of this object
// PyState() interface{} // object state. python passes this to pyclass.__new__().__setstate__()
// PyObject must be stateful
e
for persistency to work
// PyObject must be stateful for persistency to work
// XXX try to move out of PyObject? Rationale: we do not want e.g. PySetState to
// be available to user who holds PyObject interface: it is confusing to have
// both PActivate and PySetState at the same time.
...
...
@@ -50,15 +50,13 @@ func (pyobj *pyObject) PyClass() pickle.Class { return pyobj.pyclass }
// PyStateful is the interface describing in-RAM object whose data state can be
// exchanged as Python data.
type
PyStateful
interface
{
//Stateful XXX no need here?
// PySetState should set state of the in-RAM object from Python data.
// Analog of __setstate__() in Python.
PySetState
(
pystate
interface
{})
error
// PyGetState should return state of the in-RAM object as Python data.
// Analog of __getstate__() in Python.
//PyGetState() interface{}
XXX
//PyGetState() interface{}
TODO
}
// ---- pyObject <-> object state exchange ----
...
...
@@ -78,7 +76,7 @@ func (pyobj *pyObject) SetState(state *mem.Buf) error {
}
if
pyclass
!=
pyobj
.
pyclass
{
// complain pyclass changed
// complain
that
pyclass changed
// (both ref and object data use pyclass so it indeed can be different)
return
&
wrongClassError
{
want
:
pyobj
.
pyclass
,
have
:
pyclass
}
// XXX + err ctx
}
...
...
@@ -90,6 +88,7 @@ func (pyobj *pyObject) SetState(state *mem.Buf) error {
// ---- pyclass -> new ghost ----
// function representing new of a class.
type
pyClassNewFunc
func
(
base
*
pyObject
)
PyObject
// path(pyclass) -> new(pyobj)
...
...
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