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
6e76f540
Commit
6e76f540
authored
Jul 30, 2018
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
bad3a76c
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
5 deletions
+10
-5
go/zodb/persistent.go
go/zodb/persistent.go
+8
-5
go/zodb/persistent_test.go
go/zodb/persistent_test.go
+2
-0
No files found.
go/zodb/persistent.go
View file @
6e76f540
...
...
@@ -37,7 +37,7 @@ type IPersistent interface {
POid
()
Oid
// object ID in the database.
// object serial in the database as of particular Connection (PJar) view.
// 0 (invalid tid) if not yet loaded
(XXX ok?)
// 0 (invalid tid) if not yet loaded
.
PSerial
()
Tid
...
...
@@ -313,7 +313,7 @@ func (obj *Persistent) istate() Ghostable {
// ---- class <-> type; new ghost ----
// zclass describes one ZODB class in relation to Go type.
// zclass describes one ZODB class in relation to
a
Go type.
type
zclass
struct
{
class
string
typ
reflect
.
Type
// application go type corresponding to class
...
...
@@ -404,9 +404,11 @@ func RegisterClass(class string, typ, stateType reflect.Type) {
// newGhost creates new ghost object corresponding to class, oid and jar.
//
//
r
eturned object's PJar is set to provided jar. However the object is not
//
R
eturned object's PJar is set to provided jar. However the object is not
// registered to jar in any way. The caller must complete created object
// registration to jar by himself.
//
// If class was not registered, a Broken object is returned.
func
newGhost
(
class
string
,
oid
Oid
,
jar
*
Connection
)
IPersistent
{
// switch on class and transform e.g. "BTrees.Bucket" -> btree.Bucket
var
xpobj
reflect
.
Value
// *typ
...
...
@@ -419,11 +421,12 @@ func newGhost(class string, oid Oid, jar *Connection) IPersistent {
base
:=
&
Persistent
{
jar
:
jar
,
oid
:
oid
,
serial
:
0
,
state
:
GHOST
}
xobj
:=
xpobj
.
Elem
()
// typ
xobjBase
:=
xobj
.
FieldByName
(
"IPersistent"
)
xobjBase
:=
xobj
.
FieldByName
(
"IPersistent"
)
// FIXME -> Persistent
xobjBase
.
Set
(
reflect
.
ValueOf
(
base
))
obj
:=
xpobj
.
Interface
()
base
.
instance
=
obj
.
(
interface
{
IPersistent
;
Ghostable
;
Stateful
})
//base.instance = obj.(interface{IPersistent; Ghostable; Stateful})
base
.
instance
=
obj
.
(
IPersistent
)
return
base
.
instance
}
...
...
go/zodb/persistent_test.go
0 → 100644
View file @
6e76f540
package
zodb
// TODO
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