Commit f1b89b31 authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent 41db5fd6
...@@ -96,8 +96,8 @@ const ( ...@@ -96,8 +96,8 @@ const (
// no STICKY - we pin objects in RAM with PActivate // no STICKY - we pin objects in RAM with PActivate
) )
// object is common base implementation for in-RAM representation of ZODB objects. // Persistent is common base implementation for in-RAM representation of ZODB objects.
type object struct { type Persistent struct {
jar *Connection jar *Connection
oid zodb.Oid oid zodb.Oid
serial zodb.Tid serial zodb.Tid
...@@ -105,13 +105,13 @@ type object struct { ...@@ -105,13 +105,13 @@ type object struct {
mu sync.Mutex mu sync.Mutex
state ObjectState state ObjectState
refcnt int32 refcnt int32
instance IPersistent // object should be the base for the instance instance IPersistent // Persistent should be the base for the instance
loading *loadState loading *loadState
} }
func (obj *object) PJar() *Connection { return obj.jar } func (obj *Persistent) PJar() *Connection { return obj.jar }
func (obj *object) POid() zodb.Oid { return obj.oid } func (obj *Persistent) POid() zodb.Oid { return obj.oid }
func (obj *object) PSerial() zodb.Tid { return obj.serial } func (obj *Persistent) PSerial() zodb.Tid { return obj.serial }
// loadState indicates object's load state/result. // loadState indicates object's load state/result.
// //
...@@ -227,7 +227,7 @@ type LiveCacheControl interface { ...@@ -227,7 +227,7 @@ type LiveCacheControl interface {
// ---- activate/deactivate/invalidate ---- // ---- activate/deactivate/invalidate ----
// PActivate implements IPersistent. // PActivate implements IPersistent.
func (obj *object) PActivate(ctx context.Context) (err error) { func (obj *Persistent) PActivate(ctx context.Context) (err error) {
obj.mu.Lock() obj.mu.Lock()
obj.refcnt++ obj.refcnt++
doload := (obj.refcnt == 1 && obj.state == GHOST) doload := (obj.refcnt == 1 && obj.state == GHOST)
...@@ -284,7 +284,7 @@ func (obj *object) PActivate(ctx context.Context) (err error) { ...@@ -284,7 +284,7 @@ func (obj *object) PActivate(ctx context.Context) (err error) {
} }
// PDeactivate implements IPersistent. // PDeactivate implements IPersistent.
func (obj *object) PDeactivate() { func (obj *Persistent) PDeactivate() {
obj.mu.Lock() obj.mu.Lock()
defer obj.mu.Unlock() defer obj.mu.Unlock()
...@@ -314,7 +314,7 @@ func (obj *object) PDeactivate() { ...@@ -314,7 +314,7 @@ func (obj *object) PDeactivate() {
} }
// PInvalidate() implements IPersistent. // PInvalidate() implements IPersistent.
func (obj *object) PInvalidate() { func (obj *Persistent) PInvalidate() {
obj.mu.Lock() obj.mu.Lock()
defer obj.mu.Unlock() defer obj.mu.Unlock()
......
...@@ -40,7 +40,7 @@ type IPyPersistent interface { ...@@ -40,7 +40,7 @@ type IPyPersistent interface {
// pyObject is common base implementation for in-RAM representation of ZODB Python objects. // pyObject is common base implementation for in-RAM representation of ZODB Python objects.
type pyObject struct { type pyObject struct {
object Persistent
pyclass pickle.Class pyclass pickle.Class
} }
...@@ -59,7 +59,7 @@ type PyStateful interface { ...@@ -59,7 +59,7 @@ type PyStateful interface {
//PyGetState() interface{} TODO //PyGetState() interface{} TODO
} }
// ---- pyObject <-> object state exchange ---- // ---- pyObject <-> Persistent state exchange ----
// pyinstance returns .instance upcasted to IPyPersistent. // pyinstance returns .instance upcasted to IPyPersistent.
// //
...@@ -106,7 +106,7 @@ func registerPyClass(pyClassPath string, classNew pyClassNewFunc) { ...@@ -106,7 +106,7 @@ func registerPyClass(pyClassPath string, classNew pyClassNewFunc) {
// newGhost creates new ghost object corresponding to pyclass and oid. // newGhost creates new ghost object corresponding to pyclass and oid.
func (conn *Connection) newGhost(pyclass pickle.Class, oid zodb.Oid) IPyPersistent { func (conn *Connection) newGhost(pyclass pickle.Class, oid zodb.Oid) IPyPersistent {
pyobj := &pyObject{ pyobj := &pyObject{
object: object{jar: conn, oid: oid, serial: 0, state: GHOST}, Persistent: Persistent{jar: conn, oid: oid, serial: 0, state: GHOST},
pyclass: pyclass, pyclass: pyclass,
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment