mò Sã¸Ec@s[dZdklZdklZdZddZddZddZdfd„ƒYZ dS( sžTest the storage's implemenetation of the storage synchronization spec. The Synchronization spec http://www.zope.org/Documentation/Developer/Models/ZODB/ ZODB_Architecture_Storage_Interface_State_Synchronization_Diag.html It specifies two states committing and non-committing. A storage starts in the non-committing state. tpc_begin() transfers to the committting state; tpc_abort() and tpc_finish() transfer back to non-committing. Several other methods are only allowed in one state or another. Many methods allowed only in the committing state require that they apply to the currently committing transaction. The spec is silent on a variety of methods that don't appear to modify the state, e.g. load(), undoLog(), pack(). It's unclear whether there is a separate set of synchronization rules that apply to these methods or if the synchronization is implementation dependent, i.e. only what is need to guarantee a corrected implementation. The synchronization spec is also silent on whether there is any contract implied with the caller. If the storage can assume that a single client is single-threaded and that it will not call, e.g., store() until after it calls tpc_begin(), the implementation can be substantially simplified. New and/or unspecified methods: tpc_vote(): handled like tpc_abort undo(): how's that handled? Methods that have nothing to do with committing/non-committing: load(), loadSerial(), getName(), getSize(), __len__(), history(), undoLog(), modifiedInVersion(), versionEmpty(), versions(), pack(). Specific questions: The spec & docs say that undo() takes three arguments, the second being a transaction. If the specified arg isn't the current transaction, the undo() should raise StorageTransactionError. This isn't implemented anywhere. It looks like undo can be called at anytime. FileStorage does not allow undo() during a pack. How should this be tested? Is it a general restriction? (s Transaction(sStorageTransactionErrort testversiontitSynchronizedStoragecBs}tZd„Zd„Zd„Zd„Zd„Zd„Zd„Zd„Z d „Z d „Z d „Z d „Z d „ZRS(NcGs|it||ŒdS(N(tselft assertRaisestStorageTransactionErrortcallabletargs(RRR((t9/data/zmath/zope/lib/python/ZODB/tests/Synchronization.pytverifyNotCommittingNscGs@tƒ}|ii|ƒ|it||Œ|ii |ƒdS(N( t TransactionttRt_storaget tpc_beginRRRRt tpc_abort(RRRR ((RtverifyWrongTransQs cCs |i|iittƒƒdS(N(RR R t abortVersiontVERSIONR (R((RtcheckAbortVersionNotCommittingWscCs |i|iittƒƒdS(N(RRR RRR (R((RtcheckAbortVersionWrongTrans[scCs#|i|iitdtƒƒdS(Nt(RR R t commitVersionRR (R((RtcheckCommitVersionNotCommitting_scCs#|i|iitdtƒƒdS(NR(RRR RRR (R((RtcheckCommitVersionWrongTranscscCs)|i|iittddtƒƒdS(NR(RR R tstoretOIDtSERIALNOR (R((RtcheckStoreNotCommittinghscCs)|i|iittddtƒƒdS(NR(RRR RRRR (R((RtcheckStoreWrongTranslscCs|iitƒƒdS(N(RR RR (R((RtcheckAbortNotCommittingwscCs@tƒ}|ii|ƒ|iitƒƒ|ii|ƒdS(N(R R RR R R(RR ((RtcheckAbortWrongTranszs cCs-tƒ}|ii|ƒ|ii|ƒdS(N(R R RR t tpc_finishR(RR ((RtcheckFinishNotCommitting€s cCs@tƒ}|ii|ƒ|iitƒƒ|ii|ƒdS(N(R R RR R RR(RR ((RtcheckFinishWrongTrans…s cCs=tƒ}|ii|ƒ|ii|ƒ|ii|ƒdS(N(R R RR R R(RR ((RtcheckBeginCommitting‹s (t__name__t __module__R RRRRRRRRRR R!R"(((RRIs           N( t__doc__t transactionR tZODB.POSExceptionRRRRtTIDR(RR RRRRR(((Rt??s