
    +h                     6    d dl Z  G d d      Z G d de      Zy)    Nc                   ^    e Zd ZdZd Zd Zd Zd Zd Zd Z	d Z
d	 Zd
 Zd Zd Zd Zd Zy)SentinelCommandszn
    A class containing the commands specific to redis sentinel. This class is
    to be used as a mixin.
    c                 @    t        j                  t        d             y)"Redis Sentinel's SENTINEL command.z%Use the individual sentinel_* methodsN)warningswarnDeprecationWarning)selfargss     J/var/www/html/venv/lib/python3.12/site-packages/redis/commands/sentinel.pysentinelzSentinelCommands.sentinel
   s    ()PQR    c                 &    | j                  d|      S )z:Returns a (host, port) pair for the given ``service_name``z SENTINEL GET-MASTER-ADDR-BY-NAMEexecute_commandr
   service_names     r    sentinel_get_master_addr_by_namez1SentinelCommands.sentinel_get_master_addr_by_name   s    ##$FUUr   c                 &    | j                  d|      S )z<Returns a dictionary containing the specified masters state.zSENTINEL MASTERr   r   s     r   sentinel_masterz SentinelCommands.sentinel_master       ##$5|DDr   c                 $    | j                  d      S )z>Returns a list of dictionaries containing each master's state.zSENTINEL MASTERSr   r
   s    r   sentinel_mastersz!SentinelCommands.sentinel_masters   s    ##$677r   c                 ,    | j                  d||||      S )z,Add a new master to Sentinel to be monitoredzSENTINEL MONITORr   )r
   nameipportquorums        r   sentinel_monitorz!SentinelCommands.sentinel_monitor   s    ##$6b$OOr   c                 &    | j                  d|      S )z*Remove a master from Sentinel's monitoringzSENTINEL REMOVEr   )r
   r   s     r   sentinel_removez SentinelCommands.sentinel_remove   s    ##$5t<<r   c                 &    | j                  d|      S )z0Returns a list of sentinels for ``service_name``zSENTINEL SENTINELSr   r   s     r   sentinel_sentinelsz#SentinelCommands.sentinel_sentinels"   s    ##$8,GGr   c                 *    | j                  d|||      S )z5Set Sentinel monitoring parameters for a given masterzSENTINEL SETr   )r
   r   optionvalues       r   sentinel_setzSentinelCommands.sentinel_set&   s    ##ND&%HHr   c                 &    | j                  d|      S )z-Returns a list of slaves for ``service_name``zSENTINEL SLAVESr   r   s     r   sentinel_slavesz SentinelCommands.sentinel_slaves*   r   r   c                 *    | j                  d|d      S )aP  
        This command will reset all the masters with matching name.
        The pattern argument is a glob-style pattern.

        The reset process clears any previous state in a master (including a
        failover in progress), and removes every slave and sentinel already
        discovered and associated with the master.
        zSENTINEL RESETToncer   )r
   patterns     r   sentinel_resetzSentinelCommands.sentinel_reset.   s     ##$4gD#IIr   c                 &    | j                  d|      S )a  
        Force a failover as if the master was not reachable, and without
        asking for agreement to other Sentinels (however a new version of the
        configuration will be published so that the other Sentinels will
        update their configurations).
        zSENTINEL FAILOVERr   r
   new_master_names     r   sentinel_failoverz"SentinelCommands.sentinel_failover9   s     ##$7IIr   c                 *    | j                  d|d      S )a%  
        Check if the current Sentinel configuration is able to reach the
        quorum needed to failover a master, and the majority needed to
        authorize the failover.

        This command should be used in monitoring systems to check if a
        Sentinel deployment is ok.
        zSENTINEL CKQUORUMTr,   r   r1   s     r   sentinel_ckquorumz"SentinelCommands.sentinel_ckquorumB   s     ##$7t#TTr   c                 $    | j                  d      S )a  
        Force Sentinel to rewrite its configuration on disk, including the
        current Sentinel state.

        Normally Sentinel rewrites the configuration every time something
        changes in its state (in the context of the subset of the state which
        is persisted on disk across restart).
        However sometimes it is possible that the configuration file is lost
        because of operation errors, disk failures, package upgrade scripts or
        configuration managers. In those cases a way to to force Sentinel to
        rewrite the configuration file is handy.

        This command works even if the previous configuration file is
        completely missing.
        zSENTINEL FLUSHCONFIGr   r   s    r   sentinel_flushconfigz%SentinelCommands.sentinel_flushconfigM   s      ##$:;;r   N)__name__
__module____qualname____doc__r   r   r   r   r    r"   r$   r(   r*   r/   r3   r5   r7    r   r   r   r      sR    
SVE8P=HIE	JJ	U<r   r   c                         e Zd Zd fdZ xZS )AsyncSentinelCommandsc                 &   K   t        |   |  yw)r   N)superr   )r
   r   	__class__s     r   r   zAsyncSentinelCommands.sentinela   s     $s   )returnN)r8   r9   r:   r   __classcell__)rA   s   @r   r>   r>   `   s       r   r>   )r   r   r>   r<   r   r   <module>rD      s"    Y< Y<x ,  r   