[ZODB-Dev] Same transaction object (re)-used for subsequent
requests?
Tim Peters
tim.peters at gmail.com
Tue May 1 17:46:57 EDT 2007
[Tim Peters]
>> ...
>> In any case, yes, the intent is that a new transaction object is used
>> for each transaction; but, no, seeing the same memory address does not
>> mean that isn't happening.
[Andreas Jung]
> I think you are right (as always).
Luckily for everyone, I'll die someday ;-)
> Then let me rephrase the question: how can one distinguish if two transaction
> objects represent the same or different transactions in such case where memory
> address is identical?
I expect you'd have to add another data attribute, holding a unique
(over time) ID. Memory address (id()) is unique only among objects
simultaneously alive. A tid (transaction ID) is unique over time, but
tids are created by storages (not by transaction objects), and a TO
has no idea what tid is associated with it.
I'm not sure what you're trying to accomplish. As a hack, you could
arrange to make transaction objects immortal (save a reference to one
in some global data structure; e.g., a dict mapping the id() of a TO
to the TO). Then id() would remain unique over time (at the cost of
hanging on to transaction objects forever).
More information about the ZODB-Dev
mailing list