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 {
...
@@ -105,7 +105,7 @@ type object struct {
mu
sync
.
Mutex
mu
sync
.
Mutex
state
ObjectState
state
ObjectState
refcnt
int32
refcnt
int32
instance
Object
instance
Object
// object should be the base for the instance
loading
*
loadState
loading
*
loadState
}
}
...
@@ -138,7 +138,7 @@ type Stateful interface {
...
@@ -138,7 +138,7 @@ type Stateful interface {
SetState
(
state
*
mem
.
Buf
)
error
SetState
(
state
*
mem
.
Buf
)
error
// GetState should return state of the in-RAM object as raw data.
// 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 {
...
@@ -206,7 +206,6 @@ type Connection struct {
objmu
sync
.
Mutex
objmu
sync
.
Mutex
objtab
map
[
zodb
.
Oid
]
*
WeakRef
// oid -> WeakRef(Object)
objtab
map
[
zodb
.
Oid
]
*
WeakRef
// oid -> WeakRef(Object)
// hooks for application to influence live caching decisions.
// hooks for application to influence live caching decisions.
cacheControl
LiveCacheControl
cacheControl
LiveCacheControl
}
}
...
@@ -267,12 +266,13 @@ func (obj *object) PActivate(ctx context.Context) (err error) {
...
@@ -267,12 +266,13 @@ func (obj *object) PActivate(ctx context.Context) (err error) {
obj
.
serial
=
serial
obj
.
serial
=
serial
// try to pass loaded state to object
if
err
==
nil
{
if
err
==
nil
{
err
=
obj
.
instance
.
SetState
(
state
)
// XXX err ctx
err
=
obj
.
instance
.
SetState
(
state
)
// XXX err ctx
state
.
Release
()
state
.
Release
()
}
if
err
==
nil
{
if
err
==
nil
{
obj
.
state
=
UPTODATE
obj
.
state
=
UPTODATE
}
}
}
loading
.
err
=
err
loading
.
err
=
err
...
...
wcfs/zodbpy.go
View file @
785acadf
...
@@ -31,7 +31,7 @@ type PyObject interface {
...
@@ -31,7 +31,7 @@ type PyObject interface {
PyClass
()
pickle
.
Class
// python class of this object
PyClass
()
pickle
.
Class
// python class of this object
// PyState() interface{} // object state. python passes this to pyclass.__new__().__setstate__()
// 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
// 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
// be available to user who holds PyObject interface: it is confusing to have
// both PActivate and PySetState at the same time.
// both PActivate and PySetState at the same time.
...
@@ -50,15 +50,13 @@ func (pyobj *pyObject) PyClass() pickle.Class { return pyobj.pyclass }
...
@@ -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
// PyStateful is the interface describing in-RAM object whose data state can be
// exchanged as Python data.
// exchanged as Python data.
type
PyStateful
interface
{
type
PyStateful
interface
{
//Stateful XXX no need here?
// PySetState should set state of the in-RAM object from Python data.
// PySetState should set state of the in-RAM object from Python data.
// Analog of __setstate__() in Python.
// Analog of __setstate__() in Python.
PySetState
(
pystate
interface
{})
error
PySetState
(
pystate
interface
{})
error
// PyGetState should return state of the in-RAM object as Python data.
// PyGetState should return state of the in-RAM object as Python data.
// Analog of __getstate__() in Python.
// Analog of __getstate__() in Python.
//PyGetState() interface{}
XXX
//PyGetState() interface{}
TODO
}
}
// ---- pyObject <-> object state exchange ----
// ---- pyObject <-> object state exchange ----
...
@@ -78,7 +76,7 @@ func (pyobj *pyObject) SetState(state *mem.Buf) error {
...
@@ -78,7 +76,7 @@ func (pyobj *pyObject) SetState(state *mem.Buf) error {
}
}
if
pyclass
!=
pyobj
.
pyclass
{
if
pyclass
!=
pyobj
.
pyclass
{
// complain pyclass changed
// complain
that
pyclass changed
// (both ref and object data use pyclass so it indeed can be different)
// (both ref and object data use pyclass so it indeed can be different)
return
&
wrongClassError
{
want
:
pyobj
.
pyclass
,
have
:
pyclass
}
// XXX + err ctx
return
&
wrongClassError
{
want
:
pyobj
.
pyclass
,
have
:
pyclass
}
// XXX + err ctx
}
}
...
@@ -90,6 +88,7 @@ func (pyobj *pyObject) SetState(state *mem.Buf) error {
...
@@ -90,6 +88,7 @@ func (pyobj *pyObject) SetState(state *mem.Buf) error {
// ---- pyclass -> new ghost ----
// ---- pyclass -> new ghost ----
// function representing new of a class.
type
pyClassNewFunc
func
(
base
*
pyObject
)
PyObject
type
pyClassNewFunc
func
(
base
*
pyObject
)
PyObject
// path(pyclass) -> new(pyobj)
// 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