Your IP : 172.28.240.42


Current Path : /usr/lib/python2.7/dist-packages/twisted/spread/
Upload File :
Current File : //usr/lib/python2.7/dist-packages/twisted/spread/publish.pyc

ó
[³XMc@s†dZddlZddlmZddlmZmZmZdejfd„ƒYZ	dej
fd„ƒYZd	„Zd
„Z
dS(s]
Persistently cached objects for PB.

Maintainer: Glyph Lefkowitz

Future Plans: None known.
iÿÿÿÿN(tdefer(tbananatjellytflavorstPublishablecBsDeZdZd„Zd„Zd„Zd„Zd„Zd„ZRS(s;An object whose cached state persists across sessions.
    cCs|jƒ||_dS(N(t	republishtpublishedID(tselfR((s:/usr/lib/python2.7/dist-packages/twisted/spread/publish.pyt__init__s
cCstjƒ|_dS(sFSet the timestamp to current and (TODO) update all observers.
        N(ttimet	timestamp(R((s:/usr/lib/python2.7/dist-packages/twisted/spread/publish.pyRscCs
|j|ƒS(s
(internal)(tgetStateToPublishFor(Rtperspective((s:/usr/lib/python2.7/dist-packages/twisted/spread/publish.pytview_getStateToPublishscCs
|jƒS(sCImplement me to special-case your state for a perspective.
        (tgetStateToPublish(RR((s:/usr/lib/python2.7/dist-packages/twisted/spread/publish.pyR#scCstd|jƒ‚dS(sKImplement me to return state to copy as part of the publish phase.
        s%s.getStateToPublishForN(tNotImplementedErrort	__class__(R((s:/usr/lib/python2.7/dist-packages/twisted/spread/publish.pyR(scCsf|r!|j}|jƒj}nd}d}itj||ƒd6|jd6|d6|d6|jd6S(s?Get all necessary metadata to keep a clientside cache.
        tNonetremoteRRtserviceR
(tperspectiveNamet
getServicetserviceNameRt	ViewPointRR
(RRtobservertpnametsname((s:/usr/lib/python2.7/dist-packages/twisted/spread/publish.pytgetStateToCacheAndObserveFor-s	
(	t__name__t
__module__t__doc__RRR
RRR(((s:/usr/lib/python2.7/dist-packages/twisted/spread/publish.pyRs					tRemotePublishedcBsSeZdZdZdZdd„Zd„Zd„Zd„Zd„Z	d„Z
RS(	s;The local representation of remote Publishable object.
    itpubcCs#d|j|jt|jƒ|fS(Ns%s-%s-%s.%s(RRtstrR(Rtext((s:/usr/lib/python2.7/dist-packages/twisted/spread/publish.pytgetFileNameBscCsÎ|jj|ƒg|_y/t|jƒdƒ}|jƒ}|jƒWntk
rad}n+Xtj	t
j|ƒƒ}|j|jk}|r®|j
|jƒd|_n|jjdƒj|j
ƒdS(NtrbiiR(t__dict__tupdatet_activationListenerstfileR#treadtclosetIOErrorRtunjellyRtdecodeR
t_cbGotUpdatet_wasCleanWhenLoadedRt
callRemotetaddCallbacks(RtstatetdataFiletdatatrecenttnewself((s:/usr/lib/python2.7/dist-packages/twisted/spread/publish.pytsetCopyableStateFs	

cCs6|jjƒ}|d=|d=|d=|d=|d=|S(NtbrokerRtluidR'tisActivated(R%tcopy(Rtother((s:/usr/lib/python2.7/dist-packages/twisted/spread/publish.pyt__getstate__XscCsŒ|jj|ƒd|_x|jD]}||ƒq#Wg|_|jƒt|jƒdƒ}|jtj	t
j
|ƒƒƒ|jƒdS(Nitwb(R%R&R:R't	activatedR(R#twriteRtencodeRR*(RtnewStatetlistenerR3((s:/usr/lib/python2.7/dist-packages/twisted/spread/publish.pyR.cs		
cCsdS(snImplement this method if you want to be notified when your
        publishable subclass is activated.
        N((R((s:/usr/lib/python2.7/dist-packages/twisted/spread/publish.pyR?pscCs*|jr||ƒn|jj|ƒdS(scExternally register for notification when this publishable has received all relevant data.
        N(R:R'tappend(Rtcallback((s:/usr/lib/python2.7/dist-packages/twisted/spread/publish.pytcallWhenActivatedus	
(RRRR:R/R#R7R=R.R?RF(((s:/usr/lib/python2.7/dist-packages/twisted/spread/publish.pyR=s			
	cCs,tjƒ}|jt|jd|fƒ|S(sD
    Wrap a deferred returned from a pb method in another deferred that
    expects a RemotePublished as a result.  This will allow you to wait until
    the result is really available.

    Idiomatic usage would look like::

        publish.whenReady(serverObject.getMeAPublishable()).addCallback(lookAtThePublishable)
    tcallbackArgs(RtDeferredR1t	_pubReadyterrback(tdtd2((s:/usr/lib/python2.7/dist-packages/twisted/spread/publish.pyt	whenReady}s

cCs|j|jƒdS(s
(internal)N(RFRE(tresultRL((s:/usr/lib/python2.7/dist-packages/twisted/spread/publish.pyRIŒs(RR	ttwisted.internetRttwisted.spreadRRRt	CacheableRtRemoteCacheRRMRI(((s:/usr/lib/python2.7/dist-packages/twisted/spread/publish.pyt<module>s*@