Zopesters, Do zope objects have oid's at some low level? I believe I remember seeing it somewhere on how to retrieve them. I am curious as to how the ZODB knows the given state of an object. Does is ask the storage for the oid? In looking at the current implementation in DB.py, I imagine that only one storage is allowed. Would it be possible to load a single storage that was actually a python object used for the root that maintained a collection of files? BTW, I have been looking for the RelationalStorage/MultiFileStorage Wiki to no avail. It's not at WikiCentral. -- Jason Spisak 444@hiretechs.com
Jason Spisak wrote:
Zopesters,
Do zope objects have oid's at some low level? I believe I remember seeing it somewhere on how to retrieve them. I am curious as to how the ZODB knows the given state of an object. Does is ask the storage for the oid? In looking at the current implementation in DB.py, I imagine that only one storage is allowed. Would it be possible to load a single storage that was actually a python object used for the root that maintained a collection of files?
Yep. You can get the oid of an object from python oid = object._p_oid I'm not sure how to answer the rest of your questions...
BTW, I have been looking for the RelationalStorage/MultiFileStorage Wiki to no avail. It's not at WikiCentral.
Whoops. I'll add it. It's at http://www.zope.org/Members/jim/ZODB
-- Jason Spisak 444@hiretechs.com
_______________________________________________ Zope-Dev maillist - Zope-Dev@zope.org http://lists.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope )
-- Chris McDonough Digital Creations Publishers of Zope - http://www.zope.org
Chris McDonough writes:
Jason Spisak wrote:
Zopesters,
Do zope objects have oid's at some low level? I believe I remember seeing it somewhere on how to retrieve them. I am curious as to how the ZODB knows the given state of an object. Does is ask the storage for the oid? In looking at the current implementation in DB.py, I imagine that only one storage is allowed. Would it be possible to load a single storage that was actually a python object used for the root that maintained a collection of files?
Yep. You can get the oid of an object from python
oid = object._p_oid
Is this unique for the interpretor session? Or is this oid constant for that object and stroed in the FileStorage?
I'm not sure how to answer the rest of your questions...
But they're so simple? Not.
BTW, I have been looking for the RelationalStorage/MultiFileStorage Wiki to no avail. It's not at WikiCentral.
Whoops. I'll add it. It's at http://www.zope.org/Members/jim/ZODB
Thank you, thank you, thank you.
-- Jason Spisak 444@hiretechs.com
_______________________________________________ Zope-Dev maillist - Zope-Dev@zope.org http://lists.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope )
-- Chris McDonough Digital Creations Publishers of Zope - http://www.zope.org
All my best, Jason Spisak CIO HireTechs.com 6151 West Century Boulevard Suite 900 Los Angeles, CA 90045 P. 310.665.3444 F. 310.665.3544 Under US Code Title 47, Sec.227(b)(1)(C), Sec.227(a)(2)(B) This email address may not be added to any commercial mail list with out my permission. Violation of my privacy with advertising or SPAM will result in a suit for a MINIMUM of $500 damages/incident, $1500 for repeats.
oid = object._p_oid
Is this unique for the interpretor session? Or is this oid constant for that object and stroed in the FileStorage?
Yes, yes, and yes.
I'm not sure how to answer the rest of your questions...
But they're so simple? Not.
You could implement a storage object that did anything you wanted on the back end. Keep in mind that when you store an object, you only know essentially the oid, the timestamp of the transaction, and a pickle of the data you're storing. You could in theory unpickle the data and use some mechanism for determining where you want to store it. Problem is when you load an object, you only know the oid, so you need some other mechanism of determining where to load the object from based on oid alone. Also, as Jim has mentioned, handling undo and versions with multiple storages is a 'tricky' problem. ;) --jfarr
Jonothan Farr writes:
oid = object._p_oid
Is this unique for the interpretor session? Or is this oid constant for that object and stroed in the FileStorage?
Yes, yes, and yes.
I'm not sure how to answer the rest of your questions...
But they're so simple? Not.
You could implement a storage object that did anything you wanted on the back end. Keep in mind that when you store an object, you only know essentially the oid, the timestamp of the transaction, and a pickle of the data you're storing. You could in theory unpickle the data and use some mechanism for determining where you want to store it. Problem is when you load an object, you only know the oid, so you need some other mechanism of determining where to load the object from based on oid alone. Also, as Jim has mentioned, handling undo and versions with multiple storages is a 'tricky' problem. ;)
--jfarr
I'm curious, does a transaction in the FileStorage contain all the oid's to be effected by that transaction? Is it split-up (appended) by transaction or oid? Transaction, I believe. All my best, Jason Spisak CIO HireTechs.com 6151 West Century Boulevard Suite 900 Los Angeles, CA 90045 P. 310.665.3444 F. 310.665.3544 Under US Code Title 47, Sec.227(b)(1)(C), Sec.227(a)(2)(B) This email address may not be added to any commercial mail list with out my permission. Violation of my privacy with advertising or SPAM will result in a suit for a MINIMUM of $500 damages/incident, $1500 for repeats.
I'm curious, does a transaction in the FileStorage contain all the oid's to be effected by that transaction? Is it split-up (appended) by transaction or oid? Transaction, I believe.
FileStorage contains transaction records, which themselves contain data records. The data records contain the oid's. The basic procedure for a write goes something like this: tpc_begin() : start the transaction by setting up the tempfile where data records are written before the final commit store() : called for each object to be stored, writes the data record for the object to the temp file tpc_finish() : commits the transaction by writing the transaction record header, the data records from the temp file, then the transaction record footer Then load() just retrieves the latest data record for the object, it doesn't need to know about transactions. Hope this helps, --jfarr "Perl is worse than Python because people wanted it worse." Larry Wall, 14 Oct 1998
Jonothan Farr writes:
I'm curious, does a transaction in the FileStorage contain all the oid's to be effected by that transaction? Is it split-up (appended) by transaction or oid? Transaction, I believe.
FileStorage contains transaction records, which themselves contain data records. The data records contain the oid's.
The basic procedure for a write goes something like this:
tpc_begin() : start the transaction by setting up the tempfile where data records are written before the final commit
store() : called for each object to be stored, writes the data record for the object to the temp file
tpc_finish() : commits the transaction by writing the transaction record header, the data records from the temp file, then the transaction record footer
Then load() just retrieves the latest data record for the object, it doesn't need to know about transactions.
Hope this helps,
Very much so. I was reading the source, but there is a lot of stuff in there. Thanks again, Jason Spisak CIO HireTechs.com 6151 West Century Boulevard Suite 900 Los Angeles, CA 90045 P. 310.665.3444 F. 310.665.3544 Under US Code Title 47, Sec.227(b)(1)(C), Sec.227(a)(2)(B) This email address may not be added to any commercial mail list with out my permission. Violation of my privacy with advertising or SPAM will result in a suit for a MINIMUM of $500 damages/incident, $1500 for repeats.
Very much so. I was reading the source, but there is a lot of stuff in there.
Check out DemoStorage.py and MappingStorage.py in the ZODB directory. I found those very zenlightening. ;) --jfarr "Perl is worse than Python because people wanted it worse." Larry Wall, 14 Oct 1998
Jonothan Farr writes:
Very much so. I was reading the source, but there is a lot of stuff in there.
Check out DemoStorage.py and MappingStorage.py in the ZODB directory. I found those very zenlightening. ;)
I checked those out before I read "Learning Python" & "Programming Python" so I think their Zen slipped by me. ;)
--jfarr
"Perl is worse than Python because people wanted it worse." Larry Wall, 14 Oct 1998
Thanks for your clear explanation. I put a MultipleSimultaneousStorage page on the ZODB wiki. Just to flush out my thoughts in public. (I could get arested for that) All my best, Jason Spisak CIO HireTechs.com 6151 West Century Boulevard Suite 900 Los Angeles, CA 90045 P. 310.665.3444 F. 310.665.3544 Under US Code Title 47, Sec.227(b)(1)(C), Sec.227(a)(2)(B) This email address may not be added to any commercial mail list with out my permission. Violation of my privacy with advertising or SPAM will result in a suit for a MINIMUM of $500 damages/incident, $1500 for repeats.
Chris McDonough writes:
Jason Spisak wrote:
Zopesters,
Do zope objects have oid's at some low level? I believe I remember seeing it somewhere on how to retrieve them. I am curious as to how the ZODB knows the given state of an object. Does is ask the storage for the oid? In looking at the current implementation in DB.py, I imagine that only one storage is allowed. Would it be possible to load a single storage that was actually a python object used for the root that maintained a collection of files?
Yep. You can get the oid of an object from python
oid = object._p_oid
What is this supposed to return? str() on it returns a one-character long string.
I'm not sure how to answer the rest of your questions...
BTW, I have been looking for the RelationalStorage/MultiFileStorage Wiki to no avail. It's not at WikiCentral.
Whoops. I'll add it. It's at http://www.zope.org/Members/jim/ZODB
All my best, Jason Spisak CIO HireTechs.com 6151 West Century Boulevard Suite 900 Los Angeles, CA 90045 P. 310.665.3444 F. 310.665.3544 Under US Code Title 47, Sec.227(b)(1)(C), Sec.227(a)(2)(B) This email address may not be added to any commercial mail list with out my permission. Violation of my privacy with advertising or SPAM will result in a suit for a MINIMUM of $500 damages/incident, $1500 for repeats.
On 12 May 2000, Jason Spisak said:
oid = object._p_oid
What is this supposed to return? str() on it returns a one-character long string.
Try repr() on that string -- it's actually an eight-character string, but most of the characters are zero unless you have a *lot* of objects in your database. I assume that it's just a 64-bit number represented as an 8-byte string. (Now, somebody slap me for conflating bytes and characters...sigh...) Greg -- Greg Ward - software developer gward@mems-exchange.org MEMS Exchange / CNRI voice: +1-703-262-5376 Reston, Virginia, USA fax: +1-703-262-5367
Greg Ward writes:
On 12 May 2000, Jason Spisak said:
oid = object._p_oid
What is this supposed to return? str() on it returns a one-character long string.
Try repr() on that string -- it's actually an eight-character string, but most of the characters are zero unless you have a *lot* of objects in your database. I assume that it's just a 64-bit number represented as an 8-byte string.
That's what was needed. Thanks.
(Now, somebody slap me for conflating bytes and characters...sigh...)
Let him who has never conflated make the first slap. ;)
Greg -- Greg Ward - software developer gward@mems-exchange.org MEMS Exchange / CNRI voice: +1-703-262-5376 Reston, Virginia, USA fax: +1-703-262-5367
All my best, Jason Spisak CIO HireTechs.com 6151 West Century Boulevard Suite 900 Los Angeles, CA 90045 P. 310.665.3444 F. 310.665.3544 Under US Code Title 47, Sec.227(b)(1)(C), Sec.227(a)(2)(B) This email address may not be added to any commercial mail list with out my permission. Violation of my privacy with advertising or SPAM will result in a suit for a MINIMUM of $500 damages/incident, $1500 for repeats.
participants (4)
-
Chris McDonough -
Greg Ward -
Jason Spisak -
Jonothan Farr