Your IP : 172.28.240.42


Current Path : /usr/lib/python2.7/dist-packages/twisted/persisted/journal/
Upload File :
Current File : //usr/lib/python2.7/dist-packages/twisted/persisted/journal/rowjournal.pyc

ó
[³XMc@sddZddlmZddlmZddlZedƒ\ZZZ	dej
fd„ƒYZdS(sæJournal using twisted.enterprise.row RDBMS support.

You're going to need the following table in your database::

    | CREATE TABLE journalinfo
    | (
    |   commandIndex int
    | );
    | INSERT INTO journalinfo VALUES (0);

iÿÿÿÿ(t
nested_scopes(tdeferNit
RowJournalcBskeZdZd„Zd„Zd„Zd„Zddddd„Zd„Z	d„Z
d	„Zd
„ZRS(sÅJournal that stores data 'snapshot' in using twisted.enterprise.row.

    Use this as the reflector instead of the original reflector.

    It may block on creation, if it has to run recovery.
    cCs5||_g|_d|_tjj|||ƒdS(Ni(t	reflectortcommandstsyncingtbasetJournalt__init__(tselftlogtjournaledServiceR((sH/usr/lib/python2.7/dist-packages/twisted/persisted/journal/rowjournal.pyR's			cCs|jjt|fƒdS(s+Mark on object for updating when sync()ing.N(RtappendtUPDATE(R	tobj((sH/usr/lib/python2.7/dist-packages/twisted/persisted/journal/rowjournal.pyt	updateRow-scCs|jjt|fƒdS(s,Mark on object for inserting when sync()ing.N(RRtINSERT(R	R((sH/usr/lib/python2.7/dist-packages/twisted/persisted/journal/rowjournal.pyt	insertRow1scCs|jjt|fƒdS(s+Mark on object for deleting when sync()ing.N(RRtDELETE(R	R((sH/usr/lib/python2.7/dist-packages/twisted/persisted/journal/rowjournal.pyt	deleteRow5sics5ˆjƒ}|j‡‡‡‡‡‡fd†ƒ|S(s8Flush all objects to the database and then load objects.c
s(ˆjjˆdˆdˆdˆdˆƒS(Nt	parentRowtdatatwhereClauset
forceChildren(RtloadObjectsFrom(tresult(RR	t	tableNameRRR(sH/usr/lib/python2.7/dist-packages/twisted/persisted/journal/rowjournal.pyt<lambda><s	(tsynctaddCallback(R	RRRRRtd((RR	RRRRsH/usr/lib/python2.7/dist-packages/twisted/persisted/journal/rowjournal.pyR9s%cCs×|jrtd‚ni|jjt6|jjt6|jjt6}g}x.|j	D]#\}}|j
|||ƒƒqRWg|_	|rÆd|_|jjj|j
|j|ƒ}|j|jƒ|StjdƒSdS(sCommit changes to database.ssync already in progressiN(Rt
ValueErrorRtinsertRowSQLRtupdateRowSQLR
tdeleteRowSQLRRRtdbpooltrunInteractiont_synctlatestIndexRt	_syncDoneRtsucceed(R	t	comandMaptsqlCommandstkindRR((sH/usr/lib/python2.7/dist-packages/twisted/persisted/journal/rowjournal.pyRAs	
		!cCs3x|D]}|j|ƒqW|jd|ƒdS(s'Do the actual database synchronization.s(UPDATE journalinfo SET commandIndex = %dN(texecutetupdate(R	ttxntindexRtc((sH/usr/lib/python2.7/dist-packages/twisted/persisted/journal/rowjournal.pyR%Ts
cCs
d|_|S(Ni(R(R	R((sH/usr/lib/python2.7/dist-packages/twisted/persisted/journal/rowjournal.pyR'Zs	cCs=|jjjƒ}|jƒ}|jdƒ|jƒddS(s&Return command index of last snapshot.s$SELECT commandIndex FROM journalinfoi(RR#tconnecttcursorR,tfetchall(R	tconnR2((sH/usr/lib/python2.7/dist-packages/twisted/persisted/journal/rowjournal.pytgetLastSnapshot^s
N(
t__name__t
__module__t__doc__RRRRtNoneRRR%R'R5(((sH/usr/lib/python2.7/dist-packages/twisted/persisted/journal/rowjournal.pyRs							(R8t
__future__Rttwisted.internetRRtrangeRRR
RR(((sH/usr/lib/python2.7/dist-packages/twisted/persisted/journal/rowjournal.pyt<module>s