Ë
    §Œjª²  ã                   ó’  — U d dl Z d dlZd dlZd dlZd dlZd dlZd dlmZmZ d dl	m
Z
mZmZmZmZmZ d dlmZ d dlmZmZmZ d dlmZ e
rd dlmZ  ej4                  e«      Z G d„ d	e j:                  «      Z G d
„ de j:                  «      Ze
rd dl m!Z!m"Z"  G d„ de«      Z# G d„ de#«      Z$ G d„ de#«      Z% G d„ de#«      Z& G d„ de#«      Z' G d„ de#«      Z( G d„ de#«      Z) G d„ de#«      Z*de+de,fd„Z-e$d e%d!e&d"e'd#e(d$e)d%e*d&iZ.e/e0e#   e+f   e1d'<   d(d)d*ee+e#f   fd+„Z2 G d,„ d-«      Z3 G d.„ d/«      Z4 G d0„ d1«      Z5 G d2„ d3«      Z6y)4é    N)ÚABCÚabstractmethod)ÚTYPE_CHECKINGÚDictÚListÚLiteralÚOptionalÚUnion)Úget_pool_name)Úrecord_connection_handoffÚ!record_connection_relaxed_timeoutÚrecord_maint_notification_count)ÚNumber)Ú&MaintNotificationsAbstractRedisClusterc                   ó   — e Zd ZdZdZdZy)ÚMaintenanceStateÚnoneÚmovingÚmaintenanceN)Ú__name__Ú
__module__Ú__qualname__ÚNONEÚMOVINGÚMAINTENANCE© ó    úc/var/www/html/Fitness-lenito-AI-main/venv/lib/python3.12/site-packages/redis/maint_notifications.pyr   r      s   „ Ø€DØ€FØ�Kr   r   c                   ó*   — e Zd ZdZdZdZdZdZdZd„ Z	y)	ÚEndpointTypez@Valid endpoint types used in CLIENT MAINT_NOTIFICATIONS command.zinternal-ipzinternal-fqdnzexternal-ipzexternal-fqdnr   c                 ó   — | j                   S )z$Return the string value of the enum.)Úvalue©Úselfs    r   Ú__str__zEndpointType.__str__'   s   € à�z‰zÐr   N)
r   r   r   Ú__doc__ÚINTERNAL_IPÚINTERNAL_FQDNÚEXTERNAL_IPÚEXTERNAL_FQDNr   r%   r   r   r   r    r       s#   „ ÙJà€KØ#€MØ€KØ#€MØ€Dór   r    )Ú$MaintNotificationsAbstractConnectionÚ(MaintNotificationsAbstractConnectionPoolc                   ón   — e Zd ZdZdedefd„Zdefd„Zede	fd„«       Z
edefd„«       Zedefd	„«       Zy
)ÚMaintenanceNotificationaÔ  
    Base class for maintenance notifications sent through push messages by Redis server.

    This class provides common functionality for all maintenance notifications including
    unique identification and TTL (Time-To-Live) functionality.

    Attributes:
        id (int): Unique identifier for this notification
        ttl (int): Time-to-live in seconds for this notification
        creation_time (float): Timestamp when the notification was created/read
    ÚidÚttlc                 óŽ   — || _         || _        t        j                  «       | _        | j                  | j                  z   | _        y)zò
        Initialize a new MaintenanceNotification with unique ID and TTL functionality.

        Args:
            id (int): Unique identifier for this notification
            ttl (int): Time-to-live in seconds for this notification
        N)r/   r0   ÚtimeÚ	monotonicÚcreation_timeÚ	expire_at)r$   r/   r0   s      r   Ú__init__z MaintenanceNotification.__init__@   s7   € ð ˆŒØˆŒÜ!Ÿ^™^Ó-ˆÔØ×+Ñ+¨d¯h©hÑ6ˆ�r   Úreturnc                 ó^   — t        j                  «       | j                  | j                  z   kD  S )z¾
        Check if this notification has expired based on its TTL
        and creation time.

        Returns:
            bool: True if the notification has expired, False otherwise
        )r2   r3   r4   r0   r#   s    r   Ú
is_expiredz"MaintenanceNotification.is_expiredM   s%   € ô �~‰~Ó 4×#5Ñ#5¸¿¹Ñ#@ÑAÐAr   c                  ó   — y)zã
        Return a string representation of the maintenance notification.

        This method must be implemented by all concrete subclasses.

        Returns:
            str: String representation of the notification
        Nr   r#   s    r   Ú__repr__z MaintenanceNotification.__repr__W   s   € ð 	r   c                  ó   — y)a–  
        Compare two maintenance notifications for equality.

        This method must be implemented by all concrete subclasses.
        Notifications are typically considered equal if they have the same id
        and are of the same type.

        Args:
            other: The other object to compare with

        Returns:
            bool: True if the notifications are equal, False otherwise
        Nr   ©r$   Úothers     r   Ú__eq__zMaintenanceNotification.__eq__c   s   € ð 	r   c                  ó   — y)a  
        Return a hash value for the maintenance notification.

        This method must be implemented by all concrete subclasses to allow
        instances to be used in sets and as dictionary keys.

        Returns:
            int: Hash value for the notification
        Nr   r#   s    r   Ú__hash__z MaintenanceNotification.__hash__t   s   € ð 	r   N)r   r   r   r&   Úintr6   Úboolr9   r   Ústrr;   r?   rA   r   r   r   r.   r.   3   sy   „ ñ
ð7˜3ð 7 Só 7ðB˜Dó Bð ð	˜#ò 	ó ð	ð ð˜tò ó ðð  ð
˜#ò 
ó ñ
r   r.   c                   ód   ‡ — e Zd ZdZdedee   dee   defˆ fd„Zdefd„Zde	fd	„Z
defd
„Zˆ xZS )ÚNodeMovingNotificationz‰
    This notification is received when a node is replaced with a new node
    during cluster rebalancing or maintenance operations.
    r/   Únew_node_hostÚnew_node_portr0   c                 óB   •— t         ‰| �  ||«       || _        || _        y)ai  
        Initialize a new NodeMovingNotification.

        Args:
            id (int): Unique identifier for this notification
            new_node_host (str): Hostname or IP address of the new replacement node
            new_node_port (int): Port number of the new replacement node
            ttl (int): Time-to-live in seconds for this notification
        N)Úsuperr6   rG   rH   )r$   r/   rG   rH   r0   Ú	__class__s        €r   r6   zNodeMovingNotification.__init__ˆ   s$   ø€ ô  	‰Ñ˜˜SÔ!Ø*ˆÔØ*ˆÕr   r7   c                 ó@  — | j                   }t        d|t        j                  «       z
  «      }| j                  j
                  › d| j                  › d| j                  › d| j                  › d| j                  › d| j                  › d|› d|d	›d
| j                  «       › d�S )Nr   ú(id=z, new_node_host='z', new_node_port=ú, ttl=ú, creation_time=ú, expires_at=ú, remaining=ú.1fús, expired=Ú))r5   Úmaxr2   r3   rK   r   r/   rG   rH   r0   r4   r9   ©r$   Úexpiry_timeÚ	remainings      r   r;   zNodeMovingNotification.__repr__œ   s¹   € Ø—n‘nˆÜ˜˜;¬¯©Ó)9Ñ9Ó:ˆ	ð �~‰~×&Ñ&Ð'ð (Ø—'‘'�ð Ø"×0Ñ0Ð1ð 2Ø!×/Ñ/Ð0ð 1Ø—8‘8�*ð Ø!×/Ñ/Ð0ð 1Ø%˜ð 'Ø" 3˜ð (Ø—‘Ó(Ð)Øð	ð	
r   c                 óÂ   — t        |t        «      sy| j                  |j                  k(  xr4 | j                  |j                  k(  xr | j                  |j                  k(  S )z“
        Two NodeMovingNotification notifications are considered equal if they have the same
        id, new_node_host, and new_node_port.
        F)Ú
isinstancerF   r/   rG   rH   r=   s     r   r?   zNodeMovingNotification.__eq__­   sY   € ô
 ˜%Ô!7Ô8Øà�G‰G�u—x‘xÑò :Ø×"Ñ" e×&9Ñ&9Ñ9ò:à×"Ñ" e×&9Ñ&9Ñ9ð	
r   c                 óþ   — 	 | j                   rt        | j                   «      nd}t        | j                  j
                  t        | j                  «      t        | j                  «      |f«      S # t        $ r d}Y ŒVw xY w)a  
        Return a hash value for the notification to allow
        instances to be used in sets and as dictionary keys.

        Returns:
            int: Hash value based on notification type class name, id,
            new_node_host and new_node_port
        Nr   )	rH   rB   Ú
ValueErrorÚhashrK   r   r/   rD   rG   )r$   Ú	node_ports     r   rA   zNodeMovingNotification.__hash__º   st   € ð	Ø37×3EÒ3Eœ˜D×.Ñ.Ô/È4ˆIô à—‘×'Ñ'Ü�D—G‘G“Ü�D×&Ñ&Ó'Øð	ó
ð 	
øô ò 	ØŠIð	ús   ‚#A. Á.A<Á;A<)r   r   r   r&   rB   r	   rD   r6   r;   rC   r?   rA   Ú__classcell__©rK   s   @r   rF   rF   ‚   s_   ø„ ñð
+àð+ð   ‘}ð+ð   ‘}ð	+ð
 õ+ð(
˜#ó 
ð"
˜tó 
ð
˜#÷ 
r   rF   c                   óP   ‡ — e Zd ZdZdedefˆ fd„Zdefd„Zdefd„Z	defd„Z
ˆ xZS )	ÚNodeMigratingNotificationat  
    Notification for when a Redis cluster node is in the process of migrating slots.

    This notification is received when a node starts migrating its slots to another node
    during cluster rebalancing or maintenance operations.

    Args:
        id (int): Unique identifier for this notification
        ttl (int): Time-to-live in seconds for this notification
    r/   r0   c                 ó&   •— t         ‰| �  ||«       y ©N©rJ   r6   ©r$   r/   r0   rK   s      €r   r6   z"NodeMigratingNotification.__init__Þ   ó   ø€ Ü‰Ñ˜˜SÕ!r   r7   c                 ó&  — | j                   | j                  z   }t        d|t        j                  «       z
  «      }| j
                  j                  › d| j                  › d| j                  › d| j                   › d|› d|d›d| j                  «       › d	�S ©
Nr   rM   rN   rO   rP   rQ   rR   rS   rT   ©	r4   r0   rU   r2   r3   rK   r   r/   r9   rV   s      r   r;   z"NodeMigratingNotification.__repr__á   ó    € Ø×(Ñ(¨4¯8©8Ñ3ˆÜ˜˜;¬¯©Ó)9Ñ9Ó:ˆ	à�~‰~×&Ñ&Ð'ð (Ø—'‘'�ð Ø—8‘8�*ð Ø!×/Ñ/Ð0ð 1Ø%˜ð 'Ø" 3˜ð (Ø—‘Ó(Ð)Øðð		
r   c                 ó†   — t        |t        «      sy| j                  |j                  k(  xr t        | «      t        |«      u S )z�
        Two NodeMigratingNotification notifications are considered equal if they have the same
        id and are of the same type.
        F)rZ   rb   r/   Útyper=   s     r   r?   z NodeMigratingNotification.__eq__ï   s7   € ô
 ˜%Ô!:Ô;ØØ�w‰w˜%Ÿ(™(Ñ"Ò@¤t¨D£z´T¸%³[Ð'@Ð@r   c                 ój   — t        | j                  j                  t        | j                  «      f«      S ©zÐ
        Return a hash value for the notification to allow
        instances to be used in sets and as dictionary keys.

        Returns:
            int: Hash value based on notification type and id
        ©r]   rK   r   rB   r/   r#   s    r   rA   z"NodeMigratingNotification.__hash__ø   ó&   € ô �T—^‘^×,Ñ,¬c°$·'±'«lÐ;Ó<Ð<r   ©r   r   r   r&   rB   r6   rD   r;   rC   r?   rA   r_   r`   s   @r   rb   rb   Ò   óA   ø„ ñ	ð"˜3ð " Sõ "ð
˜#ó 
ðA˜tó Að=˜#÷ =r   rb   c                   óP   ‡ — e Zd ZdZdZdefˆ fd„Zdefd„Zde	fd„Z
defd„Zˆ xZS )	ÚNodeMigratedNotificationa5  
    Notification for when a Redis cluster node has completed migrating slots.

    This notification is received when a node has finished migrating all its slots
    to other nodes during cluster rebalancing or maintenance operations.

    Args:
        id (int): Unique identifier for this notification
    é   r/   c                 óB   •— t         ‰| �  |t        j                  «       y rd   )rJ   r6   ru   ÚDEFAULT_TTL©r$   r/   rK   s     €r   r6   z!NodeMigratedNotification.__init__  s   ø€ Ü‰Ñ˜Ô5×AÑAÕBr   r7   c                 ó&  — | j                   | j                  z   }t        d|t        j                  «       z
  «      }| j
                  j                  › d| j                  › d| j                  › d| j                   › d|› d|d›d| j                  «       › d	�S ri   rj   rV   s      r   r;   z!NodeMigratedNotification.__repr__  rk   r   c                 ó†   — t        |t        «      sy| j                  |j                  k(  xr t        | «      t        |«      u S )zŒ
        Two NodeMigratedNotification notifications are considered equal if they have the same
        id and are of the same type.
        F)rZ   ru   r/   rm   r=   s     r   r?   zNodeMigratedNotification.__eq__!  s7   € ô
 ˜%Ô!9Ô:ØØ�w‰w˜%Ÿ(™(Ñ"Ò@¤t¨D£z´T¸%³[Ð'@Ð@r   c                 ój   — t        | j                  j                  t        | j                  «      f«      S ro   rp   r#   s    r   rA   z!NodeMigratedNotification.__hash__*  rq   r   ©r   r   r   r&   rx   rB   r6   rD   r;   rC   r?   rA   r_   r`   s   @r   ru   ru     sC   ø„ ñð €KðC˜3õ Cð
˜#ó 
ðA˜tó Að=˜#÷ =r   ru   c                   óP   ‡ — e Zd ZdZdedefˆ fd„Zdefd„Zdefd„Z	defd„Z
ˆ xZS )	ÚNodeFailingOverNotificationap  
    Notification for when a Redis cluster node is in the process of failing over.

    This notification is received when a node starts a failover process during
    cluster maintenance operations or when handling node failures.

    Args:
        id (int): Unique identifier for this notification
        ttl (int): Time-to-live in seconds for this notification
    r/   r0   c                 ó&   •— t         ‰| �  ||«       y rd   re   rf   s      €r   r6   z$NodeFailingOverNotification.__init__A  rg   r   r7   c                 ó&  — | j                   | j                  z   }t        d|t        j                  «       z
  «      }| j
                  j                  › d| j                  › d| j                  › d| j                   › d|› d|d›d| j                  «       › d	�S ri   rj   rV   s      r   r;   z$NodeFailingOverNotification.__repr__D  rk   r   c                 ó†   — t        |t        «      sy| j                  |j                  k(  xr t        | «      t        |«      u S )z�
        Two NodeFailingOverNotification notifications are considered equal if they have the same
        id and are of the same type.
        F)rZ   r   r/   rm   r=   s     r   r?   z"NodeFailingOverNotification.__eq__R  ó7   € ô
 ˜%Ô!<Ô=ØØ�w‰w˜%Ÿ(™(Ñ"Ò@¤t¨D£z´T¸%³[Ð'@Ð@r   c                 ój   — t        | j                  j                  t        | j                  «      f«      S ro   rp   r#   s    r   rA   z$NodeFailingOverNotification.__hash__[  rq   r   rr   r`   s   @r   r   r   5  rs   r   r   c                   óP   ‡ — e Zd ZdZdZdefˆ fd„Zdefd„Zde	fd„Z
defd„Zˆ xZS )	ÚNodeFailedOverNotificationa/  
    Notification for when a Redis cluster node has completed a failover.

    This notification is received when a node has finished the failover process
    during cluster maintenance operations or after handling node failures.

    Args:
        id (int): Unique identifier for this notification
    rv   r/   c                 óB   •— t         ‰| �  |t        j                  «       y rd   )rJ   r6   r†   rx   ry   s     €r   r6   z#NodeFailedOverNotification.__init__s  s   ø€ Ü‰Ñ˜Ô7×CÑCÕDr   r7   c                 ó&  — | j                   | j                  z   }t        d|t        j                  «       z
  «      }| j
                  j                  › d| j                  › d| j                  › d| j                   › d|› d|d›d| j                  «       › d	�S ri   rj   rV   s      r   r;   z#NodeFailedOverNotification.__repr__v  rk   r   c                 ó†   — t        |t        «      sy| j                  |j                  k(  xr t        | «      t        |«      u S )zŽ
        Two NodeFailedOverNotification notifications are considered equal if they have the same
        id and are of the same type.
        F)rZ   r†   r/   rm   r=   s     r   r?   z!NodeFailedOverNotification.__eq__„  s7   € ô
 ˜%Ô!;Ô<ØØ�w‰w˜%Ÿ(™(Ñ"Ò@¤t¨D£z´T¸%³[Ð'@Ð@r   c                 ój   — t        | j                  j                  t        | j                  «      f«      S ro   rp   r#   s    r   rA   z#NodeFailedOverNotification.__hash__�  rq   r   r}   r`   s   @r   r†   r†   f  sC   ø„ ñð €KðE˜3õ Eð
˜#ó 
ðA˜tó Að=˜#÷ =r   r†   c                   ó^   ‡ — e Zd ZdZdZ	 d
dedee   fˆ fd„Zdefd„Z	de
fd„Zdefd	„Zˆ xZS )ÚOSSNodeMigratingNotificationaŠ  
    Notification for when a Redis OSS API client is used and a node is in the process of migrating slots.

    This notification is received when a node starts migrating its slots to another node
    during cluster rebalancing or maintenance operations.

    Args:
        id (int): Unique identifier for this notification
        slots (Optional[List[int]]): List of slots being migrated
    é   r/   Úslotsc                 óP   •— t         ‰| �  |t        j                  «       || _        y rd   )rJ   r6   rŒ   rx   rŽ   )r$   r/   rŽ   rK   s      €r   r6   z%OSSNodeMigratingNotification.__init__¦  s"   ø€ ô
 	‰Ñ˜Ô9×EÑEÔFØˆ�
r   r7   c                 ó@  — | j                   | j                  z   }t        d|t        j                  «       z
  «      }| j
                  j                  › d| j                  › d| j                  › d| j                  › d| j                   › d|› d|d›d	| j                  «       › d
�S )Nr   rM   z, slots=rN   rO   rP   rQ   rR   rS   rT   )
r4   r0   rU   r2   r3   rK   r   r/   rŽ   r9   rV   s      r   r;   z%OSSNodeMigratingNotification.__repr__®  s®   € Ø×(Ñ(¨4¯8©8Ñ3ˆÜ˜˜;¬¯©Ó)9Ñ9Ó:ˆ	à�~‰~×&Ñ&Ð'ð (Ø—'‘'�ð Ø—Z‘Z�Lð !Ø—8‘8�*ð Ø!×/Ñ/Ð0ð 1Ø%˜ð 'Ø" 3˜ð (Ø—‘Ó(Ð)Øðð
	
r   c                 ó†   — t        |t        «      sy| j                  |j                  k(  xr t        | «      t        |«      u S )z�
        Two OSSNodeMigratingNotification notifications are considered equal if they have the same
        id and are of the same type.
        F)rZ   rŒ   r/   rm   r=   s     r   r?   z#OSSNodeMigratingNotification.__eq__½  s7   € ô
 ˜%Ô!=Ô>ØØ�w‰w˜%Ÿ(™(Ñ"Ò@¤t¨D£z´T¸%³[Ð'@Ð@r   c                 ój   — t        | j                  j                  t        | j                  «      f«      S ro   rp   r#   s    r   rA   z%OSSNodeMigratingNotification.__hash__Æ  rq   r   rd   )r   r   r   r&   rx   rB   r	   rD   r6   r;   rC   r?   rA   r_   r`   s   @r   rŒ   rŒ   ˜  sU   ø„ ñ	ð €Kð
  $ñàðð ˜‰}õð
˜#ó 
ðA˜tó Að=˜#÷ =r   rŒ   c            	       ón   ‡ — e Zd ZdZdZdedeeeeeef      f   fˆ fd„Z	defd„Z
defd„Zdefd	„Zˆ xZS )
ÚOSSNodeMigratedNotificationa†  
    Notification for when a Redis OSS API client is used and a node has completed migrating slots.

    This notification is received when a node has finished migrating all its slots
    to other nodes during cluster rebalancing or maintenance operations.

    Args:
        id (int): Unique identifier for this notification
        nodes_to_slots_mapping (Dict[str, List[Dict[str, str]]]): Map of source node address
            to list of destination mappings. Each destination mapping is a dict with
            the destination node address as key and the slot range as value.

            Structure example:
            {
                "127.0.0.1:6379": [
                    {"127.0.0.1:6380": "1-100"},
                    {"127.0.0.1:6381": "101-200"}
                ],
                "127.0.0.1:6382": [
                    {"127.0.0.1:6383": "201-300"}
                ]
            }

            Where:
            - Key (str): Source node address in "host:port" format
            - Value (List[Dict[str, str]]): List of destination mappings where each dict
              contains destination node address as key and slot range as value
    éx   r/   Únodes_to_slots_mappingc                 óP   •— t         ‰| �  |t        j                  «       || _        y rd   )rJ   r6   r”   rx   r–   )r$   r/   r–   rK   s      €r   r6   z$OSSNodeMigratedNotification.__init__ñ  s#   ø€ ô
 	‰Ñ˜Ô8×DÑDÔEØ&<ˆÕ#r   r7   c                 ó@  — | j                   | j                  z   }t        d|t        j                  «       z
  «      }| j
                  j                  › d| j                  › d| j                  › d| j                  › d| j                   › d|› d|d›d	| j                  «       › d
�S )Nr   rM   z, nodes_to_slots_mapping=rN   rO   rP   rQ   rR   rS   rT   )
r4   r0   rU   r2   r3   rK   r   r/   r–   r9   rV   s      r   r;   z$OSSNodeMigratedNotification.__repr__ù  s²   € Ø×(Ñ(¨4¯8©8Ñ3ˆÜ˜˜;¬¯©Ó)9Ñ9Ó:ˆ	à�~‰~×&Ñ&Ð'ð (Ø—'‘'�ð &Ø&*×&AÑ&AÐ%Bð CØ—8‘8�*ð Ø!×/Ñ/Ð0ð 1Ø%˜ð 'Ø" 3˜ð (Ø—‘Ó(Ð)Øðð
	
r   c                 ó†   — t        |t        «      sy| j                  |j                  k(  xr t        | «      t        |«      u S )z�
        Two OSSNodeMigratedNotification notifications are considered equal if they have the same
        id and are of the same type.
        F)rZ   r”   r/   rm   r=   s     r   r?   z"OSSNodeMigratedNotification.__eq__  rƒ   r   c                 ój   — t        | j                  j                  t        | j                  «      f«      S ro   rp   r#   s    r   rA   z$OSSNodeMigratedNotification.__hash__  rq   r   )r   r   r   r&   rx   rB   r   rD   r   r6   r;   rC   r?   rA   r_   r`   s   @r   r”   r”   Ñ  sc   ø„ ñð: €Kð=àð=ð !% S¨$¨t°C¸°H©~Ñ*>Ð%>Ñ ?õ=ð
˜#ó 
ðA˜tó Að=˜#÷ =r   r”   Úhostr7   c                 ó’   — | j                  «       j                  d«      }d|vryg d¢}|D ]  }t        j                  ||«      sŒ y y)a§  
    Determine if an FQDN is likely to be internal/private.

    This uses heuristics based on RFC 952 and RFC 1123 standards:
    - .local domains (RFC 6762 - Multicast DNS)
    - .internal domains (common internal convention)
    - Single-label hostnames (no dots)
    - Common internal TLDs

    Args:
        host (str): The FQDN to check

    Returns:
        bool: True if the FQDN appears to be internal/private
    Ú.T)z\.local$z\.internal$z\.corp$z\.lan$z\.intranet$z
\.private$F)ÚlowerÚrstripÚreÚsearch)r›   Ú
host_lowerÚinternal_patternsÚpatterns       r   Ú_is_private_fqdnr¥     sQ   € ð  —‘“×$Ñ$ SÓ)€Jð �*ÑØòÐó %ˆÜ�9‰9�W˜jÕ)Ùð %ð
 r   r   Ú	MIGRATINGÚMIGRATEDÚFAILING_OVERÚFAILED_OVERÚ
SMIGRATINGÚ	SMIGRATEDÚnotification_types_mappingÚ
connectionr+   Únotificationc           
      ó<  — t         j                  t        j                  «      rdd }	 | j                  r| j                  j                  «       nd }|r|d   nd }t         j                  d|› d| › d| j                  «       › d|› �«       y y # t        t        f$ r Y ŒBw xY w)Né   z#Handling maintenance notification: ú, with connection: ú, connected to ip z, local socket port: )
ÚloggerÚisEnabledForÚloggingÚDEBUGÚ_sockÚgetsocknameÚAttributeErrorÚOSErrorÚdebugÚget_resolved_ip)r­   r®   Úsocket_addresss      r   Úadd_debug_log_for_notificationr¾   O  s²   € ô ×Ñœ7Ÿ=™=Ô)Øˆð	à2<×2BÒ2B�
× Ñ ×,Ñ,Ô.Èð ñ 3A˜^¨AÒ.ÀdˆNô 	�‰Ø1°,°ð @ Ø *˜|Ð+=¸j×>XÑ>XÓ>ZÐ=[ð \"Ø"0Ð!1ð3õ	
ð *øô ¤Ð(ò 	Ùð	ús   §1B	 Â	BÂBc            
       óz   — e Zd ZdZ	 	 	 	 ddeeed   f   dedee   dee	   fd„Z
d	efd
„Zd	efd„Zdeddd	e	fd„Zy)ÚMaintNotificationsConfiga#  
    Configuration class for maintenance notifications handling behaviour. Notifications are received through
    push notifications.

    This class defines how the Redis client should react to different push notifications
    such as node moving, migrations, etc. in a Redis cluster.

    ÚautoNÚenabledÚproactive_reconnectÚrelaxed_timeoutÚendpoint_typec                 ó<   — || _         || _        || _        || _        y)a!  
        Initialize a new MaintNotificationsConfig.

        Args:
            enabled (bool | "auto"): Controls maintenance notifications handling behavior.
                - True: The CLIENT MAINT_NOTIFICATIONS command must succeed during connection setup,
                otherwise a ResponseError is raised.
                - "auto": The CLIENT MAINT_NOTIFICATIONS command is attempted but failures are
                gracefully handled - a warning is logged and normal operation continues.
                - False: Maintenance notifications are completely disabled.
                Defaults to "auto".
            proactive_reconnect (bool): Whether to proactively reconnect when a node is replaced.
                Defaults to True.
            relaxed_timeout (Number): The relaxed timeout to use for the connection during maintenance.
                If -1 is provided - the relaxed timeout is disabled. Defaults to 20.
            endpoint_type (Optional[EndpointType]): Override for the endpoint type to use in CLIENT MAINT_NOTIFICATIONS.
                If None, the endpoint type will be automatically determined based on the host and TLS configuration.
                Defaults to None.

        Raises:
            ValueError: If endpoint_type is provided but is not a valid endpoint type.
        N)rÂ   rÄ   rÃ   rÅ   )r$   rÂ   rÃ   rÄ   rÅ   s        r   r6   z!MaintNotificationsConfig.__init__n  s#   € ð: ˆŒØ.ˆÔØ#6ˆÔ Ø*ˆÕr   r7   c           
      óœ   — | j                   j                  › d| j                  › d| j                  › d| j                  › d| j
                  ›d�
S )Nz	(enabled=z, proactive_reconnect=z, relaxed_timeout=z, endpoint_type=rT   )rK   r   rÂ   rÃ   rÄ   rÅ   r#   s    r   r;   z!MaintNotificationsConfig.__repr__�  s`   € à�~‰~×&Ñ&Ð'ð (Ø—|‘|�nð %#Ø#'×#;Ñ#;Ð"<ð =Ø#×3Ñ3Ð4ð 5Ø!×/Ñ/Ð2Øðð	
r   c                 ó    — | j                   dk7  S )aK  
        Check if the relaxed_timeout is enabled. The '-1' value is used to disable the relaxed_timeout.
        If relaxed_timeout is set to None, it will make the operation blocking
        and waiting until any response is received.

        Returns:
            True if the relaxed_timeout is enabled, False otherwise.
        éÿÿÿÿ)rÄ   r#   s    r   Úis_relaxed_timeouts_enabledz4MaintNotificationsConfig.is_relaxed_timeouts_enabledš  s   € ð ×#Ñ# rÑ)Ð)r   r›   r­   r+   c                 óü  — | j                   �| j                   S 	 t        j                  |«      }|j                  }|rt        j
                  S t        j                  S # t        $ r Y nw xY w|j                  «       }|rS	 t        j                  |«      }|j                  }|rt        j                  S t        j                  S # t        $ r Y nw xY wt        |«      }|rt        j                  S t        j                  S )aY  
        Determine the appropriate endpoint type for CLIENT MAINT_NOTIFICATIONS command.

        Logic:
        1. If endpoint_type is explicitly set, use it
        2. Otherwise, check the original host from connection.host:
           - If host is an IP address, use it directly to determine internal-ip vs external-ip
           - If host is an FQDN, get the resolved IP to determine internal-fqdn vs external-fqdn

        Args:
            host: User provided hostname to analyze
            connection: The connection object to analyze for endpoint type determination

        Returns:
        )rÅ   Ú	ipaddressÚ
ip_addressÚ
is_privater    r'   r)   r\   r¼   r(   r*   r¥   )r$   r›   r­   Úip_addrrÎ   Úresolved_ips         r   Úget_endpoint_typez*MaintNotificationsConfig.get_endpoint_type¥  sø   € ð( ×ÑÐ)Ø×%Ñ%Ð%ð	Ü×*Ñ*¨4Ó0ˆGà ×+Ñ+ˆJÙ/9”<×+Ñ+ÐW¼|×?WÑ?WÐWøÜò 	áð	úð
 !×0Ñ0Ó2ˆáðÜ#×.Ñ.¨{Ó;�Ø$×/Ñ/�
ñ "ô !×.Ñ.ðô &×3Ñ3ðøô
 ò áðúô
 & dÓ+ˆ
Ù-7Œ|×)Ñ)ÐW¼\×=WÑ=WÐWs/   š2A ÁA Á	A)Á(A)Á?2C Â2C Ã	CÃC)rÁ   Té
   N)r   r   r   r&   r
   rC   r   r	   r   r    r6   rD   r;   rÊ   rÑ   r   r   r   rÀ   rÀ   d  s’   „ ñð 17Ø$(Ø,.Ø04ñ +à�t˜W V™_Ð,Ñ-ð +ð "ð +ð " &Ñ)ð	 +ð
   Ñ-ó +ðD
˜#ó 
ð	*¨Tó 	*ð4XØð4XØ%Kð4Xà	ô4Xr   rÀ   c                   ól   — e Zd Zdddeddfd„Zdd„Zd„ Zd	„ Zd
efd„Z	d
e
fd„Zddee   fd„Zd
e
fd„Zy)ÚMaintNotificationsPoolHandlerÚpoolr,   Úconfigr7   Nc                 ó~   — || _         || _        t        «       | _        t	        j
                  «       | _        d | _        y rd   )rÕ   rÖ   ÚsetÚ_processed_notificationsÚ	threadingÚRLockÚ_lockr­   )r$   rÕ   rÖ   s      r   r6   z&MaintNotificationsPoolHandler.__init__Ý  s1   € ð
 ˆŒ	ØˆŒÜ(+«ˆÔ%Ü—_‘_Ó&ˆŒ
Øˆ�r   c                 ó   — || _         y rd   )r­   )r$   r­   s     r   Úset_connectionz,MaintNotificationsPoolHandler.set_connectionè  s	   € Ø$ˆ�r   c                 ó˜   — t        | j                  | j                  «      }| j                  |_        | j                  |_        d |_        |S rd   )rÔ   rÕ   rÖ   rÙ   rÜ   r­   ©r$   Úcopys     r   Úget_handler_for_connectionz8MaintNotificationsPoolHandler.get_handler_for_connectionë  s=   € ô -¨T¯Y©Y¸¿¹ÓDˆØ(,×(EÑ(EˆÔ%Ø—Z‘ZˆŒ
ØˆŒØˆr   c                 óÔ   — | j                   5  t        | j                  «      D ].  }|j                  «       sŒ| j                  j	                  |«       Œ0 	 d d d «       y # 1 sw Y   y xY wrd   ©rÜ   ÚtuplerÙ   r9   Úremove©r$   r®   s     r   Úremove_expired_notificationsz:MaintNotificationsPoolHandler.remove_expired_notificationsõ  óI   € Ø�Z‹ZÜ % d×&CÑ&CÖ D�Ø×*Ñ*Õ,Ø×1Ñ1×8Ñ8¸ÕFñ !E÷ �Z‰Zúó   �)A·AÁA'r®   c                 ó–   — | j                  «        t        |t        «      r| j                  |«      S t        j                  d|› �«       y ©NúUnhandled notification type: )rè   rZ   rF   Úhandle_node_moving_notificationr³   Úerrorrç   s     r   Úhandle_notificationz1MaintNotificationsPoolHandler.handle_notificationû  s>   € Ø×)Ñ)Ô+ä�lÔ$:Ô;Ø×7Ñ7¸ÓEÐEä�L‰LÐ8¸¸ÐGÕHr   c                 ó0  — | j                   j                  s| j                   j                  «       sy | j                  5  || j                  v r
	 d d d «       y | j
                  j                  5  t        j                  d|› d| j                  › d| j                  r| j                  j                  «       nd › �«       | j                   j                  s| j                   j                  «       �r| j                  r| j                  j                  «       nd }t        | j
                  dd«      r| j
                  j                  d«       | j
                  j                  t        j                  t!        |«      | j                   j"                  |j$                  |ddd¬«       | j                   j                  r\|j$                  �| j'                  |«       n>t)        j*                  |j,                  d	z  | j&                  |f¬
«      j/                  «        t        j                  t!        |«      dœ}|j$                  �|j1                  d|j$                  i«       | j                   j                  «       r<|j1                  | j                   j"                  | j                   j"                  dœ«        | j
                  j2                  di |¤Ž t        | j
                  dd«      r| j
                  j                  d«       d d d «       t)        j*                  |j,                  | j4                  |f¬
«      j/                  «        t7        t9        | j
                  «      ¬«       | j                  j;                  |«       d d d «       y # 1 sw Y   Œ‡xY w# 1 sw Y   y xY w)Nz#Handling node MOVING notification: r±   r²   Úset_in_maintenanceFTÚconnected_address)ÚstateÚmaintenance_notification_hashrÄ   Úhost_addressÚmatching_addressÚmatching_patternÚupdate_notification_hashÚinclude_free_connectionsé   )Úargs)Úmaintenance_staterõ   r›   )Úsocket_timeoutÚsocket_connect_timeout©Ú	pool_namer   )rÖ   rÃ   rÊ   rÜ   rÙ   rÕ   r³   r»   r­   r¼   ÚgetpeernameÚgetattrrò   Úupdate_connections_settingsr   r   r]   rÄ   rG   Úrun_proactive_reconnectrÚ   ÚTimerr0   ÚstartÚupdateÚupdate_connection_kwargsÚhandle_node_moved_notificationr   r   Úadd)r$   r®   Úmoving_address_srcÚkwargss       r   rî   z=MaintNotificationsPoolHandler.handle_node_moving_notification  sÛ  € à—‘×/Ò/Ø—K‘K×;Ñ;Ô=àØ�Z‹ZØ˜t×<Ñ<Ñ<ð ÷ ˆZð —‘—“Ü—‘Ø9¸,¸ð H(Ø(,¯©Ð'8Ð8JØ<@¿OºO�t—‘×6Ñ6Ô8ÐQUÐVðXôð —K‘K×3Ò3Ø—{‘{×>Ñ>Õ@ð :>¿º˜Ÿ™×3Ñ3Ô5Èdð 'ô ˜tŸy™yÐ*>ÀÔFð Ÿ	™	×4Ñ4°TÔ:ð —I‘I×9Ñ9Ü.×5Ñ5Ü6:¸<Ó6HØ(,¯©×(CÑ(CØ%1×%?Ñ%?Ø);Ø)<Ø15Ø15ð :ô 	ð —{‘{×6Ò6Ø'×5Ñ5ÐAØ ×8Ñ8Ð9KÕLä%ŸO™OØ ,× 0Ñ 0°1Ñ 4Ø $× <Ñ <Ø&8Ð%:ô÷ $™eœgô .>×-DÑ-DÜ9=¸lÓ9Kñ$�Fð $×1Ñ1Ð=ð Ÿ™à &¨×(BÑ(Bðôð
 —{‘{×>Ñ>Ô@ØŸ™à26·+±+×2MÑ2MØ:>¿+¹+×:UÑ:Uñôð 7�D—I‘I×6Ñ6Ñ@¸Ò@ä˜tŸy™yÐ*>ÀÔFØŸ	™	×4Ñ4°UÔ;÷S !ôV �O‰OØ× Ñ Ø×3Ñ3Ø"�_ô÷ ‰eŒgä%Ü'¨¯	©	Ó2õð ×)Ñ)×-Ñ-¨lÔ;÷y ˆZ÷ !�ú÷ ˆZús+   ¾NÁNÁ-JN Ë:A=NÎ N		ÎNÎNr  c                 ó  — | j                   5  | j                  j                   5  | j                  j                  |¬«       | j                  j                  |¬«       ddd«       ddd«       y# 1 sw Y   ŒxY w# 1 sw Y   yxY w)zå
        Run proactive reconnect for the pool.
        Active connections are marked for reconnect after they complete the current command.
        Inactive connections are disconnected and will be connected on next use.
        )r  N)rÜ   rÕ   Ú'update_active_connections_for_reconnectÚdisconnect_free_connections)r$   r  s     r   r  z5MaintNotificationsPoolHandler.run_proactive_reconnectg  si   € ð �Z‹ZØ—‘—“ð —	‘	×AÑAØ'9ð Bô ð
 —	‘	×5Ñ5Ø'9ð 6ô ÷ !÷ ˆZß �ú÷ ˆZús"   �A:¤9A.ÁA:Á.A7	Á3A:Á:Bc                 ó¤  — t        |«      }| j                  5  t        j                  d|› d| j                  › d| j                  r| j                  j                  «       nd› �«       | j                  j                  j                  d«      |k(  r¡| j                  j                  j                  d«      }| j                  j                  j                  d«      }| j                  j                  j                  d«      }t        j                  d|||d	œ} | j                  j                  di |¤Ž | j                  j                  5  | j                  j                  «       }| j                  j                  }| j                  j                  d
t        j                  d|dd||d¬«	       ddd«       ddd«       y# 1 sw Y   ŒxY w# 1 sw Y   yxY w)zN
        Handle the cleanup after a node moving notification expires.
        z5Reverting temporary changes related to notification: r±   r²   Nrõ   Úorig_host_addressÚorig_socket_timeoutÚorig_socket_connect_timeout)rý   rõ   r›   rþ   rÿ   rÉ   Únotification_hashT)	rÄ   rô   rõ   Úmatching_notification_hashrø   rù   Úreset_relaxed_timeoutÚreset_host_addressrú   r   )r]   rÜ   r³   r»   r­   r¼   rÕ   Úconnection_kwargsÚgetr   r   r	  rÖ   rÊ   rÃ   r  )	r$   r®   r  Ú	orig_hostr  Úorig_connect_timeoutr  r  r  s	            r   r
  z<MaintNotificationsPoolHandler.handle_node_moved_notificationz  s”  € ô ! Ó.Ðà�Z‹ZÜ�L‰LØGÈÀ~ð V$Ø$(§O¡OÐ#4Ð4FØ8<¿º�4—?‘?×2Ñ2Ô4ÈTÐRðTôð —	‘	×+Ñ+×/Ñ/Ð0OÓPØ$ò%ð !ŸI™I×7Ñ7×;Ñ;Ð<OÓP�	Ø&*§i¡i×&AÑ&A×&EÑ&EØ)ó'Ð#ð (,§y¡y×'BÑ'B×'FÑ'FØ1ó(Ð$ô *:×)>Ñ)>Ø59Ø%Ø&9Ø.Bñ �ð 3�—	‘	×2Ñ2Ñ<°VÒ<à—‘—“Ø(,¯©×(OÑ(OÓ(QÐ%Ø%)§[¡[×%DÑ%DÐ"à—	‘	×5Ñ5Ø$&Ü*×/Ñ/Ø26Ø/@Ø%8Ø-1Ø*?Ø'9Ø-1ð 6ô 
÷	 !÷; ˆZ÷: !�ú÷; ˆZús%   ˜D.GÅA#F:Æ)GÆ:G	Æ?GÇG)r­   r+   rd   )r   r   r   rÀ   r6   rÞ   râ   rè   r.   rð   rF   rî   r	   rD   r  r
  r   r   r   rÔ   rÔ   Ü  so   „ ð	à8ð	ð )ð	ð 
ó		ó%òòGðIÐ0Gó Iðb<Ð<Ró b<ñH¸(À3¹-ó ð&1Ð;Qô 1r   rÔ   c                   ó†   — e Zd ZU edededededediZ	e
ed   ef   ed<   dddedd	fd
„Zdefd„Zdefd„Zdedefd„Zd„ Zy	)Ú#MaintNotificationsConnectionHandlerr°   r   r.   Ú_NOTIFICATION_TYPESr­   r+   rÖ   r7   Nc                 ó    — || _         || _        y rd   )r­   rÖ   )r$   r­   rÖ   s      r   r6   z,MaintNotificationsConnectionHandler.__init__¹  s   € ð
 %ˆŒØˆ�r   c                 ó¢   — t        | j                  dd«      }|r"t        |dd«      rt        |j                  «      S t	        | j                  «      S )z‘
        Get the pool name from the connection's pool handler.
        Falls back to connection representation if pool is not available.
        Ú!_maint_notifications_pool_handlerNrÕ   )r  r­   r   rÕ   Úrepr)r$   Úpool_handlers     r   Ú_get_pool_namez2MaintNotificationsConnectionHandler._get_pool_nameÁ  sJ   € ô
 Ø�O‰OÐ@À$ó
ˆñ œG L°&¸$Ô?Ü  ×!2Ñ!2Ó3Ð3ä�D—O‘OÓ$Ð$r   r®   c                 óð  — | j                   j                  |j                  d «      }t        j                  |j                  d«      }t	        | j
                  j                  | j
                  j                  | j
                  j                  | j
                  j                  |¬«       |€t        j                  d|› �«       y |r!| j                  t        j                  |«       y | j                  |¬«       y )NÚ )Úserver_addressÚserver_portÚnetwork_peer_addressÚnetwork_peer_portÚmaint_notificationrí   )r®   )r  r  rK   r¬   r   r­   r›   Úportr³   rï   Ú%handle_maintenance_start_notificationr   r   Ú)handle_maintenance_completed_notification)r$   r®   Únotification_typer,  s       r   rð   z7MaintNotificationsConnectionHandler.handle_notificationÎ  sÉ   € à ×4Ñ4×8Ñ8¸×9OÑ9OÐQUÓVÐÜ7×;Ñ;¸L×<RÑ<RÐTVÓWÐä'ØŸ?™?×/Ñ/ØŸ™×,Ñ,Ø!%§¡×!5Ñ!5Ø"Ÿo™o×2Ñ2Ø1õ	
ð Ð$Ü�L‰LÐ8¸¸ÐGÔHØáØ×6Ñ6Ü ×,Ñ,¨lõð ×:Ñ:ÈÐ:ÕUr   rý   c                 óv  — t        | j                  |«       | j                  j                  t        j                  k(  s| j
                  j                  «       sy || j                  _        | j                  j                  | j
                  j                  ¬«       | j                  j                  | j
                  j                  «       t        |t        «      r%| j                  j                  |j                  «       t        j                  |j                   d«      }t#        | j%                  «       |d¬«       y )N)Útmp_relaxed_timeoutr'  T©Úconnection_namer,  Úrelaxed)r¾   r­   rý   r   r   rÖ   rÊ   Úset_tmp_settingsrÄ   Úupdate_current_socket_timeoutrZ   rŒ   Úadd_maint_start_notificationr/   r¬   r  rK   r   r%  )r$   rý   r®   r,  s       r   r.  zIMaintNotificationsConnectionHandler.handle_maintenance_start_notificationæ  så   € ô 	' t§¡¸ÔEð �O‰O×-Ñ-Ô1A×1HÑ1HÒHØ—;‘;×:Ñ:Ô<àà,=ˆ�‰Ô)Ø�‰×(Ñ(Ø $§¡× ;Ñ ;ð 	)ô 	
ð 	�‰×5Ñ5°d·k±k×6QÑ6QÔRÜ�lÔ$@ÔAð �O‰O×8Ñ8¸¿¹ÔIä7×;Ñ;¸L×<RÑ<RÐTVÓWÐÜ)Ø ×/Ñ/Ó1Ø1Øö	
r   c                 óB  — | j                   j                  t        j                  k(  s| j                  j                  «       sy d }|j                  d«      r|d   }t        | j                   d«       | j                   j                  d¬«       | j                   j                  d«       t        j                  | j                   _        | j                   j                  «        |r=t        j                  |j                  d«      }t        | j                  «       |d¬«       y y )	Nr®   ÚMAINTENANCE_COMPLETEDT)r  rÉ   r'  Fr3  )r­   rý   r   r   rÖ   rÊ   r  r¾   Úreset_tmp_settingsr7  r   Úreset_received_notificationsr¬   rK   r   r%  )r$   r  r®   r,  s       r   r/  zMMaintNotificationsConnectionHandler.handle_maintenance_completed_notification  sç   € ð �O‰O×-Ñ-Ô1A×1HÑ1HÒHØ—;‘;×:Ñ:Ô<àØˆØ�:‰:�nÔ%Ø! .Ñ1ˆLÜ& t§¡Ð8OÔPØ�‰×*Ñ*ÀÐ*ÔFð 	�‰×5Ñ5°bÔ9Ü,<×,AÑ,Aˆ�‰Ô)ð 	�‰×4Ñ4Ô6áÜ!;×!?Ñ!?Ø×&Ñ&¨ó"Ðô .Ø $× 3Ñ 3Ó 5Ø#5Øöð	 r   )r   r   r   rb   r   rŒ   ru   r†   r”   r  Údictrm   rB   Ú__annotations__rÀ   r6   rD   r%  r.   rð   r   r.  r/  r   r   r   r  r  ®  s˜   … ð 	" 1Ø# QØ$ aØ  !Ø" AØ# QðGÐ˜˜dÐ#<Ñ=¸sÐBÑCó ðà:ðð )ðð 
ó	ð% ó %ðVÐ0Gó Vð0
Ø!1ð
ØAXó
ó<r   r  c                   óD   — e Zd Zdddeddfd„Zd„ Zd„ Zd	efd
„Zd	e	fd„Z
y)ÚOSSMaintNotificationsHandlerÚcluster_clientr   rÖ   r7   Nc                 óŽ   — || _         || _        t        «       | _        t        «       | _        t        j                  «       | _        y rd   )rA  rÖ   rØ   rÙ   Ú_in_progressrÚ   rÛ   rÜ   )r$   rA  rÖ   s      r   r6   z%OSSMaintNotificationsHandler.__init__$  s5   € ð
 -ˆÔØˆŒÜ(+«ˆÔ%Ü›EˆÔÜ—_‘_Ó&ˆ�
r   c                 ó¬   — t        | j                  | j                  «      }| j                  |_        | j                  |_        | j
                  |_        |S rd   )r@  rA  rÖ   rÙ   rC  rÜ   rà   s     r   râ   z7OSSMaintNotificationsHandler.get_handler_for_connection/  sF   € ô ,¨D×,?Ñ,?ÀÇÁÓMˆØ(,×(EÑ(EˆÔ%Ø ×-Ñ-ˆÔØ—Z‘ZˆŒ
Øˆr   c                 óÔ   — | j                   5  t        | j                  «      D ].  }|j                  «       sŒ| j                  j	                  |«       Œ0 	 d d d «       y # 1 sw Y   y xY wrd   rä   rç   s     r   rè   z9OSSMaintNotificationsHandler.remove_expired_notifications9  ré   rê   r®   c                 óx   — t        |t        «      r| j                  |«       y t        j	                  d|› �«       y rì   )rZ   r”   Ú-handle_oss_maintenance_completed_notificationr³   rï   rç   s     r   rð   z0OSSMaintNotificationsHandler.handle_notification?  s/   € Ü�lÔ$?Ô@Ø×>Ñ>¸|ÕLä�L‰LÐ8¸¸ÐGÕHr   c           
      ó  — | j                  «        | j                  5  || j                  v s|| j                  v r
	 d d d «       y t        j                  d|› �«       | j                  j                  |«       g }t        «       }|j                  j                  «       D ]Ÿ  \  }}|j                  d«      \  }}| j                  j                  j                  ||¬«      }|�|j                  |«       |D ]G  }	|	j                  «       D ]2  }
|
j                  d«      \  }}|j                  |t!        |«      f«       Œ4 ŒI Œ¡ | j                  j                  j#                  d|¬«       t        |«      }|j%                  | j                  j                  j&                  j)                  «       «      }|D �]~  }|j*                  €Œ|j*                  j,                  j                  5  d}||v re|j*                  j,                  j/                  «       D ]  }|j1                  «        Œ t3        t5        |j*                  j,                  «      ¬«       d}nFt        j7                  t8        j:                  «      r#t        j                  d|j<                  › d	�«       || j                  j                  j&                  j)                  «       vrd|j*                  j,                  j?                  «       D ]  }|jA                  «        Œ |s)t3        t5        |j*                  j,                  «      ¬«       d d d «       �Œ� | j                  j                  |«       | j                  jC                  |«       d d d «       y # 1 sw Y   �ŒËxY w# 1 sw Y   y xY w)
Nz!Handling SMIGRATED notification: Ú:)r›   r-  F)Údisconnect_startup_nodes_poolsÚadditional_startup_nodes_infor   TzSMIGRATED: Node z9 not affected by maintenance, skipping mark for reconnect)"rè   rÜ   rC  rÙ   r³   r»   r  rØ   r–   ÚitemsÚsplitrA  Únodes_managerÚget_nodeÚkeysÚappendrB   Ú
initializeÚunionÚnodes_cacheÚvaluesÚredis_connectionÚconnection_poolÚ_get_in_use_connectionsÚmark_for_reconnectr   r   r´   rµ   r¶   ÚnameÚ_get_free_connectionsÚ
disconnectræ   )r$   r®   rK  Úaffected_nodesÚsrc_addressÚdest_mappingsÚsrc_hostÚsrc_portÚsrc_nodeÚdest_mappingÚdest_addressÚ	dest_hostÚ	dest_portÚ	all_nodesÚcurrent_nodeÚhandoff_recordedÚconns                    r   rG  zJOSSMaintNotificationsHandler.handle_oss_maintenance_completed_notificationE  s/  € ð 	×)Ñ)Ô+à�Z‹Zà × 1Ñ 1Ñ1Ø 4×#@Ñ#@Ñ@ð ÷ ˆZô �L‰LÐ<¸\¸NÐKÔLØ×Ñ×!Ñ! ,Ô/ð -/Ð)Ü ›UˆNð ×4Ñ4×:Ñ:Ö<ñØØà%0×%6Ñ%6°sÓ%;Ñ"�˜(Ø×.Ñ.×<Ñ<×EÑEØ!¨ð Fó �ð Ð'Ø"×&Ñ& xÔ0ã$1�LØ(4×(9Ñ(9Ö(;˜Ø/;×/AÑ/AÀ#Ó/FÑ,˜	 9Ø5×<Ñ<Ø&¬¨I«Ð7õñ )<ñ %2ð =ð" ×Ñ×-Ñ-×8Ñ8Ø/4Ø.Kð 9ô ô
 ˜NÓ+ˆIØ!Ÿ™Ø×#Ñ#×1Ñ1×=Ñ=×DÑDÓFóˆIô !*�Ø×0Ñ0Ð8ØØ!×2Ñ2×BÑB×HÓHØ',Ð$Ø# ~Ñ5ð
 %1×$AÑ$A×$QÑ$Q×$iÑ$iÖ$k˜DØ ×3Ñ3Õ5ð %lô 2Ü&3Ø ,× =Ñ =× MÑ Mó'õð
 ,0Ñ(ä!×.Ñ.¬w¯}©}Ô=Ü"ŸL™LØ"2°<×3DÑ3DÐ2Eð F>ð !?ôð %Ø#×2Ñ2×@Ñ@×LÑL×SÑSÓUñVð
 %1×$AÑ$A×$QÑ$Q×$gÑ$gÖ$i˜DØ ŸO™OÕ-ð %jñ  0Ü5Ü*7Ø$0×$AÑ$A×$QÑ$Qó+"õ÷E IÑHð !*ðX ×)Ñ)×-Ñ-¨lÔ;Ø×Ñ×$Ñ$ \Ô2÷K ˆZ÷v IÑHú÷w ˆZús,   �M>ÁFM>Ç!EM1Ì'AM>Í1M;Í6M>Í>N)r   r   r   rÀ   r6   râ   rè   r.   rð   r”   rG  r   r   r   r@  r@  #  sL   „ ð	'à@ð	'ð )ð	'ð 
ó		'òòGðIÐ0Gó Iðj3Ø7ôj3r   r@  )7ÚenumrÌ   rµ   r    rÚ   r2   Úabcr   r   Útypingr   r   r   r   r	   r
   Úredis.observability.attributesr   Úredis.observability.recorderr   r   r   Úredis.typingr   Úredis.clusterr   Ú	getLoggerr   r³   ÚEnumr   r    Úredis.connectionr+   r,   r.   rF   rb   ru   r   r†   rŒ   r”   rD   rC   r¥   r¬   r=  rm   r>  r¾   rÀ   rÔ   r  r@  r   r   r   Ú<module>ru     s—  ðÜ Û Û Û 	Û Û ß #ß F× Få 8÷ñ õ
  áÝDà	ˆ×	Ñ	˜8Ó	$€ô �t—y‘yô  ô�4—9‘9ô ñ ÷ôL˜cô Lô^M
Ð4ô M
ô`.=Ð 7ô .=ôb/=Ð6ô /=ôd.=Ð"9ô .=ôb/=Ð!8ô /=ôd6=Ð#:ô 6=ôrH=Ð"9ô H=ðV%˜3ð % 4ó %ðR ˜HØ˜{Ø˜jØ Ø Ø  ,Ø ðHÐ ˜D Ð&=Ñ!>ÀÐ!CÑDó ð
Ø6ð
à˜Ð4Ð4Ñ5ó
÷*uXñ uX÷pOñ O÷drñ r÷jL3ò L3r   