HEX
Server: LiteSpeed
System: Linux kapuas.iixcp.rumahweb.net 5.14.0-427.42.1.el9_4.x86_64 #1 SMP PREEMPT_DYNAMIC Fri Nov 1 14:58:02 EDT 2024 x86_64
User: mirz4654 (1666)
PHP: 8.1.33
Disabled: system,exec,escapeshellarg,escapeshellcmd,passthru,proc_close,proc_get_status,proc_nice,proc_open,proc_terminate,shell_exec,popen,pclose,dl,pfsockopen,leak,apache_child_terminate,posix_kill,posix_mkfifo,posix_setsid,posix_setuid,posix_setpgid,ini_alter,show_source,define_syslog_variables,symlink,syslog,openlog,openlog,closelog,ocinumcols,listen,chgrp,apache_note,apache_setenv,debugger_on,debugger_off,ftp_exec,dll,ftp,myshellexec,socket_bind,mail,posix_getwpuid
Upload Files
File: //usr/local/lib/python3.9/site-packages/kombu/transport/__pycache__/zookeeper.cpython-39.pyc
a

X>h��@sddZddlmZddlZddlZddlmZddlmZm	Z	ddl
mZmZddl
mZz�ddlZdd	lmZdd
lmZejjejjejjejjejjejjejjejjejjf	Zejjejj ejj!ejjejjejjejj"ejj#ejjejj$ejj%ejj&ejjejj'ej(fZ)Wn e*�y2dZdZZ)Yn0dZ+d
Z,Gdd�dej-�Z-Gdd�dej.�Z.dS)a�Zookeeper transport module for kombu.

Zookeeper based transport. This transport uses the built-in kazoo Zookeeper
based queue implementation.

**References**

- https://zookeeper.apache.org/doc/current/recipes.html#sc_recipes_Queues
- https://kazoo.readthedocs.io/en/latest/api/recipe/queue.html

**Limitations**
This queue does not offer reliable consumption.  An entry is removed from
the queue prior to being processed.  So if an error occurs, the consumer
has to re-queue the item or it will be lost.

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

Connection String
=================
Connects to a zookeeper node as:

.. code-block::

    zookeeper://SERVER:PORT/VHOST

The <vhost> becomes the base for all the other znodes.  So we can use
it like a vhost.


Transport Options
=================

�)�annotationsN)�Empty)�bytes_to_str�ensure_bytes)�dumps�loads�)�virtual)�KazooClient)�Queue�i�z!Mahendra M <[email protected]>cs�eZdZdZdZiZ�fdd�Zdd�Zdd�Zd	d
�Z	dd�Z
d
d�Zdd�Zdd�Z
dd�Zdd�Zdd�Zedd��Z�ZS)�ChannelzZookeeper Channel.Ncs4t�j|fi|��|jjj}d�|�d��|_dS)Nz/{}�/)�super�__init__�
connection�clientZvirtual_host�format�strip�_vhost)�selfr�kwargsZvhost��	__class__r�C/usr/local/lib/python3.9/site-packages/kombu/transport/zookeeper.pyris
zChannel.__init__cCstj�|j|�S�N)�os�path�joinr)r�
queue_namerrr�	_get_pathnszChannel._get_pathcCs>|j�|d�}|dur:t|j|�|��}||j|<t|�|Sr)�_queues�getrrr �len)rr�queuerrr�
_get_queueqs
zChannel._get_queuecKs&|�|�jtt|��|j|dd�d�S)NT)�reverse)�priority)r%�putrrZ_get_message_priority)rr$�messagerrrr�_put}s

�zChannel._putcCs,|�|�}|��}|dur t��tt|��Sr)r%r"rrr)rr$�msgrrr�_get�s

zChannel._getcCs.d}|�|�}|��}|dur q*|d7}q|S)Nrr)r%r")rr$�countr+rrr�_purge�s

zChannel._purgecOs*|�|�r&|�|�|j�|�|��dSr)�
_has_queuer.r�deleter )rr$�argsrrrr�_delete�s

zChannel._deletecCs|�|�}t|�Sr)r%r#�rr$rrr�_size�s
z
Channel._sizecKs|�|�s|�|�}dSr)r/r%)rr$rrrr�
_new_queue�s
zChannel._new_queuecCs|j�|�|��duSr)r�existsr r3rrrr/�szChannel._has_queuec	Cs�|jj}g}|jr�|jD]�}|�d�r6|td�d�}|s<qz |�dd�\}}|t|�f}Wn4ty�||jkr�||j	p~t
f}n|t
f}Yn0|�|�q|j|j	p�t
f}||vr�|�d|�d�
dd�|D��}t|�}|��|S)Nzzookeeper://�:rr�,cSsg|]\}}|�d|���qS)r7r)�.0�h�prrr�
<listcomp>��z!Channel._open.<locals>.<listcomp>)rrZalt�
startswithr#�split�int�
ValueError�hostname�port�DEFAULT_PORT�append�insertrr
�start)rZconninfo�hosts�	host_port�hostrCZconn_str�connrrr�_open�s.


z
Channel._opencCs|jdur|��|_|jSr)�_clientrL�rrrrr�s

zChannel.client)�__name__�
__module__�__qualname__�__doc__rMr!rr r%r*r,r.r2r4r5r/rL�propertyr�
__classcell__rrrrr
cs 	r
csTeZdZdZeZdZeZej	j
eZ
ej	je
ZdZdZ�fdd�Zdd�Z�ZS)	�	TransportzZookeeper Transport.rZ	zookeeper�kazoocs&tdurtd��t�j|i|��dS)Nz"The kazoo library is not installed)rV�ImportErrorrr)rr1rrrrr�szTransport.__init__cCstjSr)rV�__version__rNrrr�driver_version�szTransport.driver_version)rOrPrQrRr
Zpolling_intervalrD�default_portr	rUZconnection_errors�KZ_CONNECTION_ERRORSZchannel_errors�KZ_CHANNEL_ERRORSZdriver_typeZdriver_namerrYrTrrrrrU�s
�
�rU)/rR�
__future__rr�socketr$rZkombu.utils.encodingrrZkombu.utils.jsonrr�r	rVZkazoo.clientr
Zkazoo.recipe.queuer�
exceptionsZSystemErrorExceptionZConnectionLossExceptionZMarshallingErrorExceptionZUnimplementedExceptionZOperationTimeoutExceptionZNoAuthExceptionZInvalidACLExceptionZAuthFailedExceptionZSessionExpiredExceptionr[ZRuntimeInconsistencyExceptionZDataInconsistencyExceptionZBadArgumentsExceptionZApiErrorExceptionZNoNodeExceptionZNodeExistsExceptionZ NoChildrenForEphemeralsExceptionZNotEmptyExceptionZInvalidCallbackException�errorr\rWrD�
__author__r
rUrrrr�<module>sX)�
�f