Commit 14dee52f authored by Kirill Smelkov's avatar Kirill Smelkov

go/zodb: Require PModify to be called before actually changing an object

This will allow persistency layer to do kind of copy-on-write, if e.g.
there are many connections that are sharing object's state.
parent 7ade0133
...@@ -88,9 +88,11 @@ type IPersistent interface { ...@@ -88,9 +88,11 @@ type IPersistent interface {
// PModify marks in-RAM object state as modified. // PModify marks in-RAM object state as modified.
// //
// It informs persistency layer that object's data was changed and so // It informs persistency layer that object's data is going to be
// its state needs to be either saved back into database on transaction // changed and so its state will need to be either saved back into
// commit, or discarded on transaction abort. // database on transaction commit, or discarded on transaction abort.
//
// PModify must be called before object data is modified.
// //
// The object must be already activated. // The object must be already activated.
//PModify() TODO //PModify() TODO
......
...@@ -82,8 +82,8 @@ ...@@ -82,8 +82,8 @@
// //
// obj.xxx // use object. // obj.xxx // use object.
// if ... { // if ... {
// obj.xxx++ // change object. // obj.PModify() // let persistency layer know we are going to modifiy the object.
// obj.PModify() // let persistency layer know we modified the object. // obj.xxx++ // change the object.
// } // }
// //
// // tell persistency layer we no longer need obj's in-RAM data to be present. // // tell persistency layer we no longer need obj's in-RAM data to be present.
......
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