Commit 6273f533 authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent f295ddd8
package main
// XXX -> pyObject.SetState
/*
pyclass, pystate, serial, err := pyobj.jar.loadpy(ctx, pyobj.oid)
if err == nil && pyclass != pyobj.pyclass {
// complain pyclass changed
// (both ref and object data uses pyclass so it indeed can be different)
err = &wrongClassError{want: pyobj.pyclass, have: pyclass} // XXX + err ctx
pystate = nil
}
*/
/*
conn.objmu.Lock() // XXX -> rlock
objentry := conn.objtab[oid]
......
......@@ -59,6 +59,25 @@ type PyStateful interface {
//PyGetState() interface{} XXX
}
// ---- pyObject <-> object state exchange ----
func (pyobj *pyObject) SetState(state *mem.Buf) error {
pyclass, pystate, err = zodb.PyData(state.Data).Decode()
if err != nil {
return err // XXX err ctx
}
if pyclass != pyobj.pyclass {
// complain pyclass changed
// (both ref and object data use pyclass so it indeed can be different)
return &wrongClassError{want: pyobj.pyclass, have: pyclass} // XXX + err ctx
}
return pyobj.instance.PySetState(pystate) // XXX err ctx = ok?
}
// TODO pyObject.GetState
// ---- pyclass -> new ghost ----
// path(pyclass) -> new(pyobj)
......
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