Commit f1b89b31 authored by Kirill Smelkov's avatar Kirill Smelkov

.

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