%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /lib/python3/dist-packages/twisted/spread/__pycache__/
Upload File :
Create Path :
Current File : //lib/python3/dist-packages/twisted/spread/__pycache__/publish.cpython-312.pyc

�

Ϫ�f,���dZddlZddlmZddlmZmZmZGd�dej�Z	Gd�dej�Zd	�Zd
�Z
y)z]
Persistently cached objects for PB.

Maintainer: Glyph Lefkowitz

Future Plans: None known.
�N)�defer)�banana�flavors�jellyc�4�eZdZdZd�Zd�Zd�Zd�Zd�Zd�Z	y)	�Publishablez6An object whose cached state persists across sessions.c�2�|j�||_y)N)�	republish�publishedID)�selfrs  �8/usr/lib/python3/dist-packages/twisted/spread/publish.py�__init__zPublishable.__init__s������&���c�6�tj�|_y)z=Set the timestamp to current and (TODO) update all observers.N)�time�	timestamp�rs r
r
zPublishable.republishs�������rc�$�|j|�S)�
(internal))�getStateToPublishFor�r�perspectives  r
�view_getStateToPublishz"Publishable.view_getStateToPublishs���(�(��5�5rc�"�|j�S)z:Implement me to special-case your state for a perspective.)�getStateToPublishrs  r
rz Publishable.getStateToPublishFor#s���%�%�'�'rc�2�td|jz��)zBImplement me to return state to copy as part of the publish phase.z%s.getStateToPublishFor)�NotImplementedError�	__class__rs r
rzPublishable.getStateToPublish's��!�";�d�n�n�"L�M�Mrc��|r'|j}|j�j}nd}d}tj||�|j
|||jd�S)z6Get all necessary metadata to keep a clientside cache.�None)�remoterr�servicer)�perspectiveName�
getService�serviceNamer�	ViewPointrr)rr�observer�pname�snames     r
�getStateToCacheAndObserveForz(Publishable.getStateToCacheAndObserveFor+s`����/�/�E��*�*�,�8�8�E��E��E��'�'��T�:��+�+� �����
�	
rN)
�__name__�
__module__�__qualname__�__doc__rr
rrrr*�rr
rrs$��@�'�%�6�(�N�
rrc�>�eZdZdZdZdZd
d�Zd�Zd�Zd�Z	d�Z
d�Zy	)�RemotePublishedz6The local representation of remote Publishable object.rc�x�dj|j|jt|j�|�S)Nz{}-{}-{}.{})�formatr"r�strr)r�exts  r
�getFileNamezRemotePublished.getFileNameCs6���#�#��L�L������ � �!��	
�	
rc��|jj|�g|_	t|j	�d�5}|j�}ddd�t
jtj��}|j|jk(}|r#|jj�d|_
y|jjd�j!|j�y#1swY��xYw#t$rd}Y�swxYw)N�rbr�r)�__dict__�update�_activationListeners�openr6�readr�unjellyr�decoder�OSError�_cbGotUpdate�_wasCleanWhenLoadedr!�
callRemote�addCallbacks)r�state�dataFile�data�newself�recents      r
�setCopyableStatez RemotePublished.setCopyableStateKs����
�
���U�#�$&��!�	9��d�&�&�(�$�/�
'�8��}�}���
'�
�m�m�F�M�M�$�$7�8�G��&�&�$�.�.�8�F�����g�.�.�/�'(�D�$��K�K�"�"�#6�7�D�D�T�EV�EV�W�
'�
'���	��F�	�s(�C>�C2�C>�2C;�7C>�>D�Dc�X�|jj�}|d=|d=|d=|d=|d=|S)N�brokerr!�luidr<�isActivated)r:�copy)r�others  r
�__getstate__zRemotePublished.__getstate__\s?���
�
�"�"�$���(�O��(�O��&�M��(�)��-� ��rc�t�|jj|�d|_|jD]
}||��g|_|j	�t|j
�d�5}|jtjtj|���ddd�y#1swYyxYw)Nr9�wb)r:r;rOr<�	activatedr=r6�writer�encoder)r�newState�listenerrGs    r
rBzRemotePublished._cbGotUpdategs����
�
���X�&�����1�1�	�H��T�N�	�$&��!�����
�$�"�"�$�d�
+�	=�x��N�N�6�=�=����T�):�;�<�	=�	=�	=�s�-8B.�.B7c��y)znImplement this method if you want to be notified when your
        publishable subclass is activated.
        Nr/rs r
rUzRemotePublished.activatedrs�rc�d�|jr	||�y|jj|�y)zZExternally register for notification when this publishable has received all relevant data.N)rOr<�append)r�callbacks  r
�callWhenActivatedz!RemotePublished.callWhenActivatedws&������T�N��%�%�,�,�X�6rN)�pub)r+r,r-r.rOrCr6rKrRrBrUr^r/rr
r1r1=s/��@��K���
�X�"	�	=��
7rr1c�t�tj�}|jt|j|f��|S)aD
    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)
    )�callbackArgs)r�DeferredrE�	_pubReady�errback)�d�d2s  r
�	whenReadyrgs-��
���	�B��N�N�9�b�j�j��u�N�=�
�Irc�:�|j|j�y)rN)r^r])�resultrfs  r
rcrc�s��
���R�[�[�)r)r.r�twisted.internetr�twisted.spreadrrr�	Cacheabler�RemoteCacher1rgrcr/rr
�<module>rnsH��
��"�1�1�&
�'�#�#�&
�R?7�g�)�)�?7�D�*r

Zerion Mini Shell 1.0