Commit 753d82f5 authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent 6fbf83f5
...@@ -16,14 +16,10 @@ package main ...@@ -16,14 +16,10 @@ package main
import ( import (
"context" "context"
"fmt"
"sync" "sync"
// "sync/atomic"
"lab.nexedi.com/kirr/go123/mem" "lab.nexedi.com/kirr/go123/mem"
"lab.nexedi.com/kirr/neo/go/zodb" "lab.nexedi.com/kirr/neo/go/zodb"
pickle "github.com/kisielk/og-rek"
) )
// XXX make methods private, e.g. _pJar ? // XXX make methods private, e.g. _pJar ?
...@@ -230,11 +226,7 @@ func (obj *object) PActivate(ctx context.Context) (err error) { ...@@ -230,11 +226,7 @@ func (obj *object) PActivate(ctx context.Context) (err error) {
doload := (obj.refcnt == 1 && obj.state == GHOST) doload := (obj.refcnt == 1 && obj.state == GHOST)
defer func() { defer func() {
if err != nil { if err != nil {
// no need to check for drop - the state is already obj.PDeactivate()
// dropped - we just need to decref here.
//
// XXX locking
obj.deactivate() // XXX -> drop?
} }
}() }()
if !doload { if !doload {
...@@ -275,9 +267,7 @@ func (obj *object) PActivate(ctx context.Context) (err error) { ...@@ -275,9 +267,7 @@ func (obj *object) PActivate(ctx context.Context) (err error) {
err = obj.instance.SetState(state) // XXX err ctx err = obj.instance.SetState(state) // XXX err ctx
state.Release() state.Release()
} }
if err != nil { if err == nil {
obj.instance.DropState() // XXX already in deactivate
} else {
obj.state = UPTODATE obj.state = UPTODATE
} }
...@@ -289,7 +279,6 @@ func (obj *object) PActivate(ctx context.Context) (err error) { ...@@ -289,7 +279,6 @@ func (obj *object) PActivate(ctx context.Context) (err error) {
return err // XXX err ctx return err // XXX err ctx
} }
// PDeactivate implements Object. // PDeactivate implements Object.
func (obj *object) PDeactivate() { func (obj *object) PDeactivate() {
obj.mu.Lock() obj.mu.Lock()
......
...@@ -14,6 +14,15 @@ ...@@ -14,6 +14,15 @@
package main package main
// Bits that should be in ZODB XXX -> zodb // Bits that should be in ZODB XXX -> zodb
import (
"context"
"fmt"
"lab.nexedi.com/kirr/neo/go/zodb"
pickle "github.com/kisielk/og-rek"
)
// PyObject is the interface that every in-RAM object representing Python ZODB object implements. // PyObject is the interface that every in-RAM object representing Python ZODB object implements.
type PyObject interface { type PyObject interface {
Object Object
......
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