Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
N
neoppod
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Levin Zimmermann
neoppod
Commits
fa28e211
Commit
fa28e211
authored
Jan 23, 2019
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
c3964151
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
4 deletions
+15
-4
go/zodb/pydata.go
go/zodb/pydata.go
+11
-4
go/zodb/pydata_test.go
go/zodb/pydata_test.go
+4
-0
No files found.
go/zodb/pydata.go
View file @
fa28e211
...
...
@@ -61,12 +61,14 @@ func (d PyData) ClassName() string {
}
// encodePyData encodes Python class and state into raw ZODB python data.
//
// XXX -> pySerialize?
func
encodePyData
(
pyclass
pickle
.
Class
,
pystate
interface
{})
PyData
{
buf
:=
&
bytes
.
Buffer
{}
p
:=
pickle
.
NewEncoderWithConfig
(
buf
,
&
pickle
.
EncoderConfig
{
// allow pristine python2 to decode the pickle.
// TODO 2 -> 3 since ZODB switched to it and uses zodbpickle.
// TODO 2 -> 3 since ZODB
5
switched to it and uses zodbpickle.
Protocol
:
2
,
PersistentRef
:
persistentRef
,
})
...
...
@@ -89,7 +91,7 @@ func encodePyData(pyclass pickle.Class, pystate interface{}) PyData {
return
PyData
(
buf
.
Bytes
())
}
// TODO PyData.
referencesf
// TODO PyData.
References() (=referencesf in zodb/py)
// decode decodes raw ZODB python data into Python class and state.
//
...
...
@@ -129,9 +131,14 @@ func persistentRef(obj interface{}) *pickle.Ref {
}
// Persistent object - when encoding someone who references it - don't
// include obj state and just reference to obj.
// include obj state and use just reference to obj.
// XXX check obj.jar is the same as in referee
// XXX if not -> use multidb ref format?
return
&
pickle
.
Ref
{
Pid
:
pickle
.
Tuple
{
pobj
.
POid
(),
zpyclass
(
ClassOf
(
pobj
))},
// (oid, class)
// (oid, class)
Pid
:
pickle
.
Tuple
{
pobj
.
POid
(),
zpyclass
(
ClassOf
(
pobj
))},
}
}
...
...
go/zodb/pydata_test.go
View file @
fa28e211
...
...
@@ -46,3 +46,7 @@ func TestPyClassName(t *testing.T) {
func
TestPyDecode
(
t
*
testing
.
T
)
{
// XXX
}
func
TestPyEncode
(
t
*
testing
.
T
)
{
// XXX
}
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