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
660ba040
Commit
660ba040
authored
Jul 27, 2018
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
9254fac5
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
1 addition
and
66 deletions
+1
-66
go/zodb/pydata.go
go/zodb/pydata.go
+0
-12
go/zodb/zodbpy.go
go/zodb/zodbpy.go
+1
-54
No files found.
go/zodb/pydata.go
View file @
660ba040
...
@@ -40,13 +40,6 @@ import (
...
@@ -40,13 +40,6 @@ import (
// PyData can be decoded into PyObject.
// PyData can be decoded into PyObject.
type
PyData
[]
byte
type
PyData
[]
byte
//type PyClass struct {
// Module string
// Name string
//}
// XXX + String = Module + "." + Name
// Decode decodes raw ZODB python data into Python class and state.
// Decode decodes raw ZODB python data into Python class and state.
func
(
d
PyData
)
Decode
()
(
pyclass
pickle
.
Class
,
pystate
interface
{},
_
error
)
{
func
(
d
PyData
)
Decode
()
(
pyclass
pickle
.
Class
,
pystate
interface
{},
_
error
)
{
...
@@ -130,8 +123,3 @@ func normPyClass(xklass interface{}) (pickle.Class, error) {
...
@@ -130,8 +123,3 @@ func normPyClass(xklass interface{}) (pickle.Class, error) {
return
pickle
.
Class
{},
errInvalidPyClass
return
pickle
.
Class
{},
errInvalidPyClass
}
}
// // PyClass returns Python class of the object.
// func (pyobj *PyObject) PyClass() pickle.Class {
// return pyobj.pyClass
// }
go/zodb/zodbpy.go
View file @
660ba040
...
@@ -65,7 +65,7 @@ type PyStateful interface {
...
@@ -65,7 +65,7 @@ type PyStateful interface {
// pyinstance returns .instance upcasted to IPyPersistent.
// pyinstance returns .instance upcasted to IPyPersistent.
//
//
// this should be always safe because we always create pyObjects via
// this should be always safe because we always create pyObjects via
// newGhost which passes IPyPersistent as instance to IPersistent.
// newGhost which passes IPyPersistent as instance to IPersistent.
XXX no longer true
func
(
pyobj
*
PyPersistent
)
pyinstance
()
IPyPersistent
{
func
(
pyobj
*
PyPersistent
)
pyinstance
()
IPyPersistent
{
return
pyobj
.
instance
.
(
IPyPersistent
)
return
pyobj
.
instance
.
(
IPyPersistent
)
}
}
...
@@ -88,59 +88,6 @@ func (pyobj *PyPersistent) SetState(state *mem.Buf) error {
...
@@ -88,59 +88,6 @@ func (pyobj *PyPersistent) SetState(state *mem.Buf) error {
// TODO PyPersistent.GetState
// TODO PyPersistent.GetState
/*
// ---- pyclass -> new ghost ----
// function representing new of a class.
type pyClassNewFunc func(base *PyPersistent) IPyPersistent
// path(pyclass) -> new(pyobj)
var pyClassTab = make(map[string]pyClassNewFunc)
// PyRegisterClass registers python class to be transformed to Go instance
// created via classNew.
//
// must be called from global init().
func PyRegisterClass(pyClassPath string, classNew pyClassNewFunc) {
pyClassTab[pyClassPath] = classNew
// XXX + register so that PyData decode handles pyClassPath
}
// newGhost creates new ghost object corresponding to pyclass and oid.
func (conn *Connection) newGhost(pyclass pickle.Class, oid Oid) IPyPersistent {
pyobj := &PyPersistent{
Persistent: Persistent{jar: conn, oid: oid, serial: 0, state: GHOST},
pyclass: pyclass,
}
// switch on pyclass and transform e.g. "zodb.BTree.Bucket" -> *ZBucket
classNew := pyClassTab[pyclass.Module + "." + pyclass.Name]
var instance IPyPersistent
if classNew != nil {
instance = classNew(pyobj)
} else {
instance = &dummyPyInstance{PyPersistent: pyobj}
}
pyobj.instance = instance
return instance
}
// dummyPyInstance is used for python classes that were not registered.
type dummyPyInstance struct {
*PyPersistent
pystate interface{}
}
func (d *dummyPyInstance) DropState() {
d.pystate = nil
}
func (d *dummyPyInstance) PySetState(pystate interface{}) error {
d.pystate = pystate
return nil
}
*/
// ----------------------------------------
// ----------------------------------------
...
...
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