mň .á¸Ec@sŮdZddd!ZdklZdklZdklZdkl Z dk l Z l Z d k Z d kZd Zd Zd Zed ƒZd eifd„ƒYZdeifd„ƒYZd e e fd„ƒYZd S(sK A storage implementation which uses RAM to persist objects, much like MappingStorage. Unlike MappingStorage, it needs not be packed to get rid of non-cyclic garbage and it does rudimentary conflict resolution. This is a ripoff of Jim's Packless bsddb3 storage. $Id: TemporaryStorage.py 41192 2006-01-08 10:25:23Z andreasjung $ s$Revision: 1.1.2.2 $i iţ˙˙˙(s getLogger(s referencesf(s POSException(s BaseStorage(sConflictResolvingStoragesResolvedSerialNi<iČtTemporaryStoragetReferenceCountErrorcBstZdZRS(sƒ An error occured while decrementing a reference to an object in the commit phase. The object's reference count was below zero.(t__name__t __module__t__doc__(((t;/data/zmath/zope/lib/python/tempstorage/TemporaryStorage.pyR*s tTemporaryStorageErrorcBstZdZRS(sä A Temporary Storage exception occurred. This probably indicates that there is a low memory condition or a tempfile space shortage. Check available tempfile space and RAM consumption and restart the server process.(RRR(((RR.s cBsŒtZdd„Zd„Zd„Zd„Zd„Zd„Zd„Zd „Z gd „Z d „Z d „Z d „Z d„Zd„ZRS(NRcCs†ti||ƒh|_h|_h|_h|_g|_h|_ d|_ g}t t ƒD] }|dq`~|_d|_dS(sű index -- mapping of oid to current serial referenceCount -- mapping of oid to count oreferences -- mapping of oid to a sequence of its referenced oids opickle -- mapping of oid to pickle _tmp -- used by 'store' to collect changes before finalization _conflict_cache -- cache of recently-written object revisions _last_cache_gc -- last time that conflict cache was garbage collected _recently_gc_oids -- a queue of recently gc'ed oids itN(t BaseStoraget__init__tselftnamet_indext_referenceCountt _oreferencest_opicklet_tmpt_conflict_cachet_last_cache_gct_[1]trangetRECENTLY_GC_OIDS_LENtxtNonet_recently_gc_oidst_oid(R R RR((RR 6s        *cCs|iS(s5 Return tid for last committed transaction (for ZEO) N(R t_ltid(R ((RtlastTransactionMscCs t|iƒS(N(tlenR R (R ((Rt__len__QscCsdS(Ni((R ((RtgetSizeTscCs…tiƒ}||itjoXxH|iiƒD]7\}}|\}}||t jo|i|=q0q0W||_ng|_ dS(N( ttimetnowR RtCONFLICT_CACHE_GCEVERYRtitemstktvtdatatttCONFLICT_CACHE_MAXAGER(R R&R$R R%R#((Rt _clear_tempWs    cCsdS(s# Close the storage N((R ((RtcloseascCs‡|iƒzky(|i|}|i|}||fSWn<tj o0||ijot i d|ƒ‚qt‚nXWd|i ƒXdS(Ntoid( R t _lock_acquireR R*tsRtptKeyErrorRt POSExceptiont ConflictErrort _lock_release(R R*tversionR-R,((Rtloadfs     cCs'|i||ƒ}|d|ddfS(Niit(R R3R*R2R%(R R*R2R%((RtloadEx…scCsf|iƒzJ|ii||f|ƒ}||joti d|ƒ‚n |dSWd|i ƒXdS(s› this is only useful to make conflict resolution work. It does not actually implement all the semantics that a revisioning storage needs! R*iN( R R+RtgetR*tserialtmarkerR%R/R0R1(R R*R7R8R%((Rt loadSerialŒs   c Csü|iƒzŕg}|iD]$\}} ||jo || qq~}|p t|‚n|i ƒt i ||ƒd}|djodSn||} |d}|t|ƒjodSn ||}|i|| ƒ} | | |fSWd|iƒXdS(sTReturn most recent revision of oid before tid committed (for MVCC) .ii˙˙˙˙N(R R+RRtsoidtstidR*ttidsR.tsorttbisectt bisect_leftttidtiRt start_tidtjRtend_tidR9R%R1( R R*R@R:RCRDR<RARRBR%R;((Rt loadBeforeœs& ;      c Cs||ij oti||ƒ‚n|otidƒn|iƒzĂ|i i |ƒoo|i |}||joQ|i||||ƒ}|p(tid|d||fd|ƒ‚qÉ|}qÓn|}|i}|ii||fƒ||jo|ptSWd|iƒXdS(NsXversions in use with TemporaryStorage although Temporary Storage doesnt support versionsR*tserialsR%(t transactionR t _transactionR/tStorageTransactionErrorR2tLOGtdebugR+R thas_keyR*toserialR7ttryToResolveConflictR%tnewdataR0t_tidt newserialRtappendtResolvedSerialR1( R R*R7R%R2RGRMRORQ((Rtstoreľs*      cCs™h} |i}|i}|i} |i} |i } |i }||_x|iD]ö}|\}}g} t|| ƒh}x| D]}d||R'R!RRJtPOSErrorRRR(R'RRJR!R>RSRRRqRRR]RRvRoR/((Rt?s