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
2e4a4546
Commit
2e4a4546
authored
Jan 30, 2019
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
4a5c217e
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
23 additions
and
12 deletions
+23
-12
go/zodb/import_x_test.go
go/zodb/import_x_test.go
+11
-1
go/zodb/persistent.go
go/zodb/persistent.go
+5
-4
go/zodb/zodbpy.go
go/zodb/zodbpy.go
+7
-7
No files found.
go/zodb/import_x_test.go
View file @
2e4a4546
...
...
@@ -20,6 +20,7 @@
package
zodb_test
import
(
"lab.nexedi.com/kirr/go123/mem"
"lab.nexedi.com/kirr/neo/go/zodb"
"lab.nexedi.com/kirr/neo/go/internal/xtesting"
...
...
@@ -41,12 +42,21 @@ func init() {
// The commit is performed via zodb/py.
func
ZPyCommit
(
zurl
string
,
at
zodb
.
Tid
,
objv
...
zodb
.
IPersistent
)
(
zodb
.
Tid
,
error
)
{
var
rawobjv
[]
xtesting
.
ZRawObject
// raw zodb objects data to commit
var
bufv
[]
*
mem
.
Buf
// buffers to release
defer
func
()
{
for
_
,
buf
:=
range
bufv
{
buf
.
Release
()
}
}()
for
_
,
obj
:=
range
objv
{
buf
:=
zodb
.
PSerialize
(
obj
)
rawobj
:=
xtesting
.
ZRawObject
{
Oid
:
obj
.
POid
(),
Data
:
zodb
.
PSerialize
(
obj
)
.
XData
(),
// not releasing buf, but its ok
Data
:
buf
.
Data
,
}
rawobjv
=
append
(
rawobjv
,
rawobj
)
bufv
=
append
(
bufv
,
buf
)
}
return
xtesting
.
ZPyCommitRaw
(
zurl
,
at
,
rawobjv
...
)
...
...
go/zodb/persistent.go
View file @
2e4a4546
...
...
@@ -108,21 +108,22 @@ type Ghostable interface {
type
Stateful
interface
{
// GetState should return state of the in-RAM object as raw data.
//
//
GetState is called only by persistent machinery and only when object
//
has its state - in other words only on non-ghost objects
.
//
It is called by persistency machinery only on non-ghost objects,
//
i.e. when the object has its in-RAM state
.
//
// XXX buf ownership?
GetState
()
*
mem
.
Buf
// SetState should set state of the in-RAM object from raw data.
//
// It is called by persistency machinery only on ghost objects, i.e.
// when the objects does not yet have its in-RAM state.
//
// state ownership is not passed to SetState, so if state needs to be
// retained after SetState returns it needs to be incref'ed.
//
// The error returned does not need to have object/setstate prefix -
// persistent machinery is adding such prefix automatically.
//
// XXX SetState is called only on ghost.
SetState
(
state
*
mem
.
Buf
)
error
}
...
...
go/zodb/zodbpy.go
View file @
2e4a4546
...
...
@@ -30,22 +30,22 @@ import (
// exchanged as Python data.
type
PyStateful
interface
{
// PyGetState should return state of the in-RAM object as Python data.
// Analog of __getstate__() in Python.
//
// PyGetState is called only by persistent machinery and only when
// object has its state - in other words only on non-ghost objects.
// It is analog of __getstate__() in Python.
//
// XXX state ownership?
// It is called by persistency machinery only on non-ghost objects,
// i.e. when the object has its in-RAM state.
PyGetState
()
interface
{}
// PySetState should set state of the in-RAM object from Python data.
//
// It is analog of __setstate__() in Python.
//
//
The error returned does not need to have object/setstate prefix -
//
persistent machinery is adding such prefix automatically
.
//
It is called by persistency machinery only on ghost objects, i.e.
//
when the objects does not yet have its in-RAM state
.
//
// XXX PySetState is called only on ghost.
// The error returned does not need to have object/setstate prefix -
// persistency machinery is adding such prefix automatically.
PySetState
(
pystate
interface
{})
error
}
...
...
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