
    ph                         S SK JrJr  S SKJrJr  S SKrS SKJr  S SKJ	r	  S SK
Jr  S SKJr   " S S	\5      r " S
 S\5      r " S S\5      r\	\\\4      r " S S\\5      rg)    )ABCabstractmethod)OptionalUnionN)RedisCluster)WeightedList)CircuitBreaker)Numberc                       \ rS rSr\\S\4S j5       5       r\R                  \S\4S j5       5       r\\S\	\
   4S j5       5       r\R                  \S\	\
   4S j5       5       rS	rg
)AbstractDatabase   returnc                     g)z]The weight of this database in compare to others. Used to determine the database failover to.N selfs    P/home/james-whalen/.local/lib/python3.13/site-packages/redis/multidb/database.pyweightAbstractDatabase.weight        	    r   c                     g)z5Set the weight of this database in compare to others.Nr   r   r   s     r   r   r      r   r   c                     g)z6Health check URL associated with the current database.Nr   r   s    r   health_check_url!AbstractDatabase.health_check_url   r   r   r   c                     g)z>Set the health check URL associated with the current database.Nr   r   r   s     r   r   r      r   r   r   N)__name__
__module____qualname____firstlineno__propertyr   floatr   setterr   strr   __static_attributes__r   r   r   r   r      s        ]]U    (3-    #   r   r   c                       \ rS rSr SS\S\\   4S jjr\S\4S j5       r	\	R                  S\4S j5       r	\S\\   4S	 j5       r\R                  S\\   4S
 j5       rSrg)BaseDatabase%   Nr   r   c                     Xl         X l        g N)_weight_health_check_url)r   r   r   s      r   __init__BaseDatabase.__init__&   s    
 !1r   r   c                     U R                   $ r,   r-   r   s    r   r   BaseDatabase.weight.       ||r   c                     Xl         g r,   r2   r   s     r   r   r3   2       r   c                     U R                   $ r,   r.   r   s    r   r   BaseDatabase.health_check_url6   s    %%%r   c                     Xl         g r,   r8   r   s     r   r   r9   :   s    !1r   )r.   r-   r,   )r   r    r!   r"   r$   r   r&   r/   r#   r   r%   r   r'   r   r   r   r)   r)   %   s     +/22 #3-2    ]]U   &(3- & & 2# 2 2r   r)   c                      \ rS rSrSr\\S\\R                  \
4   4S j5       5       r\R                  \S\\R                  \
4   4S j5       5       r\\S\4S j5       5       r\R                  \S\4S	 j5       5       rS
rg)SyncDatabase?   z5Database with an underlying synchronous redis client.r   c                     g)zThe underlying redis client.Nr   r   s    r   clientSyncDatabase.clientB   r   r   r?   c                     g)z Set the underlying redis client.Nr   r   r?   s     r   r?   r@   H   r   r   c                     g)z)Circuit breaker for the current database.Nr   r   s    r   circuitSyncDatabase.circuitN   r   r   rD   c                     g)z1Set the circuit breaker for the current database.Nr   r   rD   s     r   rD   rE   T   r   r   r   N)r   r    r!   r"   __doc__r#   r   r   redisRedisr   r?   r%   r	   rD   r'   r   r   r   r<   r<   ?   s    ?ekk<78    ]]U5;;#<=        ^^~   r   r<   c            
       *  ^  \ rS rSr SS\\R                  \4   S\S\	S\
\   4U 4S jjjr\S\\R                  \4   4S j5       r\R                  S\\R                  \4   4S	 j5       r\S\4S
 j5       r\R                  S\4S j5       rSrU =r$ )Database^   r?   rD   r   r   c                 \   > Xl         X l        X R                  l        [        TU ]  X45        g)a<  
Initialize a new Database instance.

Args:
    client: Underlying Redis client instance for database operations
    circuit: Circuit breaker for handling database failures
    weight: Weight value used for database failover prioritization
    health_check_url: Health check URL associated with the current database
N)_client_cbdatabasesuperr/   )r   r?   rD   r   r   	__class__s        r   r/   Database.__init___   s&       2r   r   c                     U R                   $ r,   rO   r   s    r   r?   Database.clientt   r4   r   c                     Xl         g r,   rV   rB   s     r   r?   rW   x   r6   r   c                     U R                   $ r,   rP   r   s    r   rD   Database.circuit|   s    xxr   c                     Xl         g r,   rZ   rG   s     r   rD   r[      s    r   )rP   rO   r,   )r   r    r!   r"   r   rI   rJ   r   r	   r$   r   r&   r/   r#   r?   r%   rD   r'   __classcell__)rS   s   @r   rL   rL   ^   s     +/3ekk</03  3 	3
 #3-3 3* ekk<78   ]]U5;;#<=      ^^~  r   rL   )abcr   r   typingr   r   rI   r   redis.data_structurer   redis.multidb.circuitr	   redis.typingr
   r   r)   r<   tuple	DatabasesrL   r   r   r   <module>re      sd    # "   - 0 s 42# 24# 8 |V345	$|\ $r   