
    Ihd	                        d Z ddlmZ ddlmZ ddlmZ ddlmZm	Z	  G d de	j                        Z
 G d	 d
e	j                        Zy)a  In-memory transport module for Kombu.

Simple transport using memory for storing messages.
Messages can be passed only between threads.

Features
========
* Type: Virtual
* Supports Direct: Yes
* Supports Topic: Yes
* Supports Fanout: No
* Supports Priority: No
* Supports TTL: Yes

Connection String
=================
Connection string is in the following format:

.. code-block::

    memory://

    )annotations)defaultdict)Queue   )basevirtualc                       e Zd ZdZ ee      Zi ZdZdZ	d Z
d ZddZd Zd Zdd	Zd
 Zd Zd Zd Z fdZd Z xZS )ChannelzIn-memory Channel.FTc                    || j                   v S N)queuesselfqueuekwargss      O/var/www/html/planif/env/lib/python3.12/site-packages/kombu/transport/memory.py
_has_queuezChannel._has_queue)   s    ##    c                P    || j                   vrt               | j                   |<   y y r   r   r   r   s      r   
_new_queuezChannel._new_queue,   s#    #!&DKK $r   c                D    | j                  |      j                  d      S )NF)block)
_queue_forget)r   r   timeouts      r   _getzChannel._get0   s    u%)))66r   c                j    || j                   vrt               | j                   |<   | j                   |   S r   r   r   r   s     r   r   zChannel._queue_for3   s-    #!&DKK{{5!!r   c                     y r    )r   argss     r   _queue_bindzChannel._queue_bind8       r   c                r    | j                  ||      D ]"  }| j                  |      j                  |       $ y r   )_lookupr   put)r   exchangemessagerouting_keyr   r   s         r   _put_fanoutzChannel._put_fanout;   s3    \\(K8 	0EOOE"&&w/	0r   c                D    | j                  |      j                  |       y r   )r   r'   )r   r   r)   r   s       r   _putzChannel._put?   s    ""7+r   c                @    | j                  |      j                         S r   )r   qsizer   s     r   _sizezChannel._sizeB   s    u%++--r   c                <    | j                   j                  |d        y r   )r   pop)r   r   r"   r   s       r   _deletezChannel._deleteE   s    t$r   c                |    | j                  |      }|j                         }|j                  j                          |S r   )r   r/   r   clear)r   r   qsizes       r   _purgezChannel._purgeH   s-    OOE"wwy	r   c                    t         |           | j                  j                         D ]  }|j	                           i | _        y r   )supercloser   valuesempty)r   r   	__class__s     r   r;   zChannel.closeN   s8    [['') 	EKKM	r   c                     y r   r!   r   s     r   after_reply_message_receivedz$Channel.after_reply_message_receivedT   r$   r   r   )__name__
__module____qualname____doc__r   seteventsr   
do_restoresupports_fanoutr   r   r   r   r#   r+   r-   r0   r3   r8   r;   r@   __classcell__r>   s   @r   r
   r
   !   s[    FFJO$)7"
0,.%r   r
   c                       e Zd ZdZeZ ej                         Zej                  j                  Z
dZdZ fdZd Z xZS )	TransportzIn-memory Transport.memoryc                H    t        |   |fi | | j                  | _        y r   )r:   __init__global_statestate)r   clientr   r>   s      r   rO   zTransport.__init__e   s"    *6*&&
r   c                     y)NzN/Ar!   )r   s    r   driver_versionzTransport.driver_versioni   s    r   )rA   rB   rC   rD   r
   r   BrokerStaterP   r   rL   
implementsdriver_typedriver_namerO   rT   rI   rJ   s   @r   rL   rL   X   s@    G '7&&(L**JKK'r   rL   N)rD   
__future__r   collectionsr   r   r    r   r   r
   rL   r!   r   r   <module>r\      s;   0 # #  4goo 4n!! r   