§
    d«  ã                   ób   — d dl mZ  G d„ de¦  «        Z G d„ d¦  «        Z G d„ d¦  «        ZdS )	é   )ÚErrorc                   ó"   ‡ — e Zd ZdZˆ fd„Zˆ xZS )Ú
StableDictz,A dict subclass with stable items() orderingc                 ó^   •— t          t          ¦   «                              ¦   «         ¦  «        S ©N)ÚsortedÚsuperÚitems)ÚselfÚ	__class__s    €ú9/usr/lib/python3/dist-packages/borg/helpers/datastruct.pyr
   zStableDict.items   s   ø€ Ý•e‘g”g—m’m‘o”oÑ&Ô&Ð&ó    )Ú__name__Ú
__module__Ú__qualname__Ú__doc__r
   Ú__classcell__)r   s   @r   r   r      s>   ø€ € € € € Ø6Ð6ð'ð 'ð 'ð 'ð 'ð 'ð 'ð 'ð 'r   r   c                   óN   — e Zd ZdZ G d„ dee¦  «        Zdd„Zd„ Zdd	„Z	dd
„Z
dS )ÚBufferz/
    Provides a managed, resizable buffer.
    c                   ó   — e Zd ZdZdS )úBuffer.MemoryLimitExceededz2Requested buffer size {} is above the limit of {}.N©r   r   r   r   © r   r   ÚMemoryLimitExceededr      s   € € € € € Ø@Ð@Ð@Ð@r   r   é   Nc                 ó¦   — t          |¦  «        s
J d¦   «         ‚|�||k    s
J d¦   «         ‚|| _        || _        |                      |d¬¦  «         dS )z–
        Initialize the buffer: use allocator(size) call to allocate a buffer.
        Optionally, set the upper <limit> for the buffer size.
        z-must give alloc(size) function as first paramNzinitial size must be <= limitT)Úinit)ÚcallableÚ	allocatorÚlimitÚresize)r   r   Úsizer    s       r   Ú__init__zBuffer.__init__   sc   € õ
 ˜	Ñ"Ô"ÐSÐSÐ$SÑSÔSÐSØˆ} ¨¢  Ð/N¡¤ Ø"ˆŒØˆŒ
Ø�Š�D˜tˆÑ$Ô$Ð$Ð$Ð$r   c                 ó*   — t          | j        ¦  «        S r   )ÚlenÚbuffer©r   s    r   Ú__len__zBuffer.__len__   s   € Ý�4”;ÑÔÐr   Fc                 óê   — t          |¦  «        }| j        �+|| j        k    r t                               || j        ¦  «        ‚|st	          | ¦  «        |k     r|                      |¦  «        | _        dS dS )a$  
        resize the buffer - to avoid frequent reallocation, we usually always grow (if needed).
        giving init=True it is possible to first-time initialize or shrink the buffer.
        if a buffer size beyond the limit is requested, raise Buffer.MemoryLimitExceeded (OSError).
        N)Úintr    r   r   r%   r   r&   ©r   r"   r   s      r   r!   zBuffer.resize    sr   € õ �4‰yŒyˆØŒ:Ð! d¨T¬ZÒ&7Ð&7Ý×,Ò,¨T°4´:Ñ>Ô>Ð>Øð 	/•3�t‘9”9˜tÒ#Ð#ØŸ.š.¨Ñ.Ô.ˆDŒKˆKˆKð $Ð#r   c                 ó@   — |�|                       ||¦  «         | j        S )z¯
        return a buffer of at least the requested size (None: any current size).
        init=True can be given to trigger shrinking of the buffer to the given size.
        )r!   r&   r+   s      r   Úgetz
Buffer.get,   s&   € ð
 ÐØ�KŠK˜˜dÑ#Ô#Ð#ØŒ{Ðr   )r   N)F)NF)r   r   r   r   r   ÚOSErrorr   r#   r(   r!   r-   r   r   r   r   r   
   s�   € € € € € ðð ðAð Að Að Að A˜e Wñ Aô Að Að	%ð 	%ð 	%ð 	%ð ð  ð  ð
/ð 
/ð 
/ð 
/ðð ð ð ð ð r   r   c                   óR   — e Zd ZdZ G d„ de¦  «        Zd„ Zd„ Zd„ Zd„ Z	d„ Z
d	„ Zd
S )ÚEfficientCollectionQueuezL
    An efficient FIFO queue that splits received elements into chunks.
    c                   ó   — e Zd ZdZdS )ú&EfficientCollectionQueue.SizeUnderflowzHCould not pop_front first {} elements, collection only has {} elements..Nr   r   r   r   ÚSizeUnderflowr2   ;   s   € € € € € ØVÐVÐVÐVr   r3   c                 ó>   — g | _         d| _        || _        || _        dS )z¶
        Initializes empty queue.
        Requires split_size to define maximum chunk size.
        Requires member_type to be type defining what base collection looks like.
        é    N)Úbuffersr"   Ú
split_sizeÚmember_type)r   r7   r8   s      r   r#   z!EfficientCollectionQueue.__init__>   s'   € ð ˆŒØˆŒ	Ø$ˆŒØ&ˆÔÐÐr   c                 óV   — | j         s|                      ¦   «         S | j         d         }|S )zÅ
        Returns first chunk from queue without removing it.
        Returned collection will have between 1 and split_size length.
        Returns empty collection when nothing is queued.
        r5   )r6   r8   )r   r&   s     r   Ú
peek_frontz#EfficientCollectionQueue.peek_frontI   s0   € ð Œ|ð 	&Ø×#Ò#Ñ%Ô%Ð%Ø”˜a”ˆØˆr   c                 ó4  — || j         k    r t                               || j         ¦  «        ‚|dk    rf| j        d         }t	          |t          |¦  «        ¦  «        }||d…         }|r|| j        d<   n| j        d= ||z  }| xj         |z  c_         |dk    °ddS dS )z~
        Removes first size elements from queue.
        Throws if requested removal size is larger than whole queue.
        r5   N)r"   r0   r3   r6   Úminr%   )r   r"   r&   Ú	to_removes       r   Ú	pop_frontz"EfficientCollectionQueue.pop_frontT   s«   € ð
 �$”)ÒÐÝ*×8Ò8¸¸t¼yÑIÔIÐIØ�QŠhˆhØ”\ !”_ˆFÝ˜D¥# f¡+¤+Ñ.Ô.ˆIØ˜I˜J˜JÔ'ˆFØð $Ø"(�”˜Q‘�à”L �OØ�IÑˆDØˆIŒI˜Ñ"ˆIŒIð �QŠhˆhˆhˆhˆhˆhr   c                 óÀ  — | j         s|                      ¦   «         g| _         |rº| j         d         }t          |¦  «        | j        k    r.|                      ¦   «         }| j                              |¦  «         t          t          |¦  «        | j        t          |¦  «        z
  ¦  «        }||d|…         z  }||d…         }|| j         d<   | xj        |z  c_        |°¸dS dS )zm
        Adds data at end of queue.
        Takes care to chunk data into split_size sized elements.
        éÿÿÿÿN)r6   r8   r%   r7   Úappendr<   r"   )r   Údatar&   Úto_adds       r   Ú	push_backz"EfficientCollectionQueue.push_backf   sí   € ð
 Œ|ð 	0Ø ×,Ò,Ñ.Ô.Ð/ˆDŒLØð 
	 Ø”\ "Ô%ˆFÝ�6‰{Œ{˜dœoÒ-Ð-Ø×)Ò)Ñ+Ô+�Ø”×#Ò# FÑ+Ô+Ð+å�˜T™œ D¤Oµc¸&±k´kÑ$AÑBÔBˆFØ�d˜7˜F˜7”mÑ#ˆFØ˜˜˜”=ˆDØ%ˆDŒL˜ÑØˆIŒI˜ÑˆIŒIð ð 
	 ð 
	 ð 
	 ð 
	 ð 
	 r   c                 ó   — | j         S )zF
        Current queue length for all elements in all chunks.
        ©r"   r'   s    r   r(   z EfficientCollectionQueue.__len__y   s   € ð ŒyÐr   c                 ó   — | j         dk    S )z4
        Returns true if queue isn't empty.
        r5   rF   r'   s    r   Ú__bool__z!EfficientCollectionQueue.__bool__   s   € ð Œy˜AŠ~Ðr   N)r   r   r   r   r   r3   r#   r:   r>   rD   r(   rH   r   r   r   r0   r0   6   sª   € € € € € ðð ðWð Wð Wð Wð W˜ñ Wô Wð Wð	'ð 	'ð 	'ð	ð 	ð 	ð#ð #ð #ð$ ð  ð  ð&ð ð ðð ð ð ð r   r0   N)Úerrorsr   Údictr   r   r0   r   r   r   ú<module>rK      s¦   ðØ Ð Ð Ð Ð Ð ð'ð 'ð 'ð 'ð '�ñ 'ô 'ð 'ð)ð )ð )ð )ð )ñ )ô )ð )ðXMð Mð Mð Mð Mñ Mô Mð Mð Mð Mr   