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/__pycache__/clocks.cpython-39.pyc
a

X>h��@sjdZddlmZddlmZddlmZddlmZddl	m
Z
dZdZGd	d
�d
e
�ZGdd�d�Zd
S)z#Logical Clocks and Synchronization.�)�annotations)�islice)�
itemgetter)�Lock)�Any)�LamportClock�	timetuplez0_lamport(clock={0}, timestamp={1}, id={2} {3!r})c@s�eZdZdZdZddddddd�d	d
�Zdd�dd
�Zdd�dd�Zddd�dd�Zddd�dd�Z	ddd�dd�Z
ddd�dd�Zee
d��Zee
d��Zee
d��Zee
d��ZdS) ra`Tuple of event clock information.

    Can be used as part of a heap to keep events ordered.

    Arguments:
    ---------
        clock (Optional[int]):  Event clock value.
        timestamp (float): Event UNIX timestamp value.
        id (str): Event host id (e.g. ``hostname:pid``).
        obj (Any): Optional obj to associate with this event.
    �Nz
int | None�float�strr)�clock�	timestamp�id�obj�returncCst�|||||f�S�N)�tuple�__new__)�clsrr
rrr	r	�6/usr/local/lib/python3.9/site-packages/kombu/clocks.pyrsztimetuple.__new__�rcCs
tj|�Sr)�R_CLOCK�format��selfr	r	r�__repr__#sztimetuple.__repr__rcCst|�Sr)rrr	r	r�__getnewargs__&sztimetuple.__getnewargs__�bool��otherrcCslzP|d|d}}|r@|r@||kr6|d|dkWS||kWS|d|dkWStyftYS0dS)Nr��)�
IndexError�NotImplemented)rr�A�Br	r	r�__lt__)s
ztimetuple.__lt__cCs||kSrr	�rrr	r	r�__gt__6sztimetuple.__gt__cCs
||kSrr	r'r	r	r�__le__9sztimetuple.__le__cCs
||kSrr	r'r	r	r�__ge__<sztimetuple.__ge__rr!r �)N)�__name__�
__module__�__qualname__�__doc__�	__slots__rrrr&r(r)r*�propertyrrr
rrr	r	r	rrs�
rc@sveZdZdZdZdefdddd�dd�Zddd	�d
d�Zdd�d
d�Zddd�dd�Z	dd�dd�Z
dd�dd�ZdS)ra�Lamport's logical clock.

    From Wikipedia:

    A Lamport logical clock is a monotonically incrementing software counter
    maintained in each process.  It follows some simple rules:

        * A process increments its counter before each event in that process;
        * When a process sends a message, it includes its counter value with
          the message;
        * On receiving a message, the receiver process sets its counter to be
          greater than the maximum of its own value and the received value
          before it considers the message received.

    Conceptually, this logical clock can be thought of as a clock that only
    has meaning in relation to messages moving between processes.  When a
    process receives a message, it resynchronizes its logical clock with
    the sender.

    See Also
    --------
        * `Lamport timestamps`_

        * `Lamports distributed mutex`_

    .. _`Lamport Timestamps`: https://en.wikipedia.org/wiki/Lamport_timestamps
    .. _`Lamports distributed mutex`: https://bit.ly/p99ybE

    *Usage*

    When sending a message use :meth:`forward` to increment the clock,
    when receiving a message use :meth:`adjust` to sync with
    the time stamp of the incoming message.

    r�intz
type[Lock]�None)�
initial_valuerrcCs||_|�|_dSr)�value�mutex)rr4rr	r	r�__init__mszLamportClock.__init__rcCsD|j�*t|j|�d}|_|Wd�S1s60YdS�Nr!)r6�maxr5)rrr5r	r	r�adjustsszLamportClock.adjustrcCs>|j�$|jd7_|jWd�S1s00YdSr8)r6r5rr	r	r�forwardxszLamportClock.forwardzlist[tuple[int, str]]ztuple[int, str])�hrcCsz|dd|ddkrrg}t|t|dd��D].}|dd|ddkrNq^|�|d�q.t|dd�d�dS|dS)aSort heap of events.

        List of tuples containing at least two elements, representing
        an event, where the first element is the event's scalar clock value,
        and the second element is the id of the process (usually
        ``"hostname:pid"``): ``sh([(clock, processid, ...?), (...)])``

        The list must already be sorted, which is why we refer to it as a
        heap.

        The tuple will not be unpacked, so more than two elements can be
        present.

        Will return the latest event.
        rr!NcSs|dSr8r	)�eventr	r	r�<lambda>��z(LamportClock.sort_heap.<locals>.<lambda>)�key)�zipr�append�sorted)rr<ZsameZPNr	r	r�	sort_heap}szLamportClock.sort_heaprcCs
t|j�Sr)rr5rr	r	r�__str__�szLamportClock.__str__cCsd|j�d�S)Nz<LamportClock: �>)r5rr	r	rr�szLamportClock.__repr__N)r,r-r.r/r5rr7r:r;rDrErr	r	r	rrEs%�rN)r/�
__future__r�	itertoolsr�operatorr�	threadingr�typingr�__all__rrrrr	r	r	r�<module>s6