
    &`i)                     h   d dl mZmZmZ d dlmZ d dlmZ dada	d Z
d Zdefd	Zed
             Zedddeeef         deeeef                  defd            Zedddeeef         deeeef                  defd            Zedededdfd            Ze	 ddddeeef         deeef         dedeeeef                  def
d            Zeddddeeef         dedeeeef                  defd            Zedddeeef         deeeef                  dee         fd            ZdS )    )ListOptionalUnion)client_mode_hook)	GcsClientFNc                      d a dad S )NFglobal_gcs_client_initialized     p/home/jaya/work/projects/VOICE-AGENT/VIET/agent-env/lib/python3.11/site-packages/ray/experimental/internal_kv.py_internal_kv_resetr   
   s    LLLr   c                      t           S Nr
   r   r   r   internal_kv_get_gcs_clientr      s    r   
gcs_clientc                     | J | a dadS )z;Initialize the internal KV for use in other function calls.NTr	   )r   s    r   _initialize_internal_kvr      s     !!!"LLLr   c                      t           d uS r   r   r   r   r   _internal_kv_initializedr      s    D((r   )	namespacekeyr   returnc                
   t          | t                    r|                                 } t          |t                    r|                                }t          | t                    sJ t                              | |          S )z Fetch the value of a binary key.)
isinstancestrencodebytesr
   internal_kv_getr   r   s     r   _internal_kv_getr#   !   sr     #s jjll)S!! '$$&&	c5!!!!!,,S)<<<r   c                
   t          | t                    r|                                 } t          |t                    r|                                }t          | t                    sJ t                              | |          S )zCheck key exists or not.)r   r   r   r    r
   internal_kv_existsr"   s     r   _internal_kv_existsr&   /   sr     #s jjll)S!! '$$&&	c5!!!!!//Y???r   uriexpiration_sc                8    t                               | |          S )z'Pin a runtime_env URI for expiration_s.)r
   pin_runtime_env_uri)r'   r(   s     r   _pin_runtime_env_urir+   =   s     00lCCCr   Tvalue	overwritec                   t          | t                    r|                                 } t          |t                    r|                                }t          |t                    r|                                }t          | t                    r*t          |t                    rt          |t                    sJ t
                              | |||          dk    S )zGlobally associates a value with a given binary key.

    This only has an effect if the key does not already have a value.

    Returns:
        already_exists: whether the value already exists.
    r   )r   r   r   r    boolr
   internal_kv_put)r   r,   r-   r   s       r   _internal_kv_putr1   C   s      #s jjll% )S!! '$$&&	3ue$$ y$'' 	( ,,S%INNRSSSr   )del_by_prefixr   r2   c                   t          | t                    r|                                 } t          |t                    r|                                }t          | t                    sJ t                              | ||          S r   )r   r   r   r    r
   internal_kv_del)r   r2   r   s      r   _internal_kv_delr5   a   st     #s jjll)S!! '$$&&	c5!!!!!,,S-KKKr   prefixc                    t          | t                    r|                                 } t          |t                    r|                                }t                              | |          S )zBList all keys in the internal KV store that start with the prefix.)r   r   r   r
   internal_kv_keys)r6   r   s     r   _internal_kv_listr9   p   s\    
 &# !)S!! '$$&&	--fi@@@r   )T)typingr   r   r   ray._private.client_mode_hookr   ray._rayletr   r   r
   r   r   r   r   r   r    r#   r/   r&   intr+   r1   r5   r9   r   r   r   <module>r>      s+   ( ( ( ( ( ( ( ( ( ( : : : : : : ! ! ! ! ! !     	     ) ) ) HL
= 
= 
=	sEz	
=*25e3D*E
=

= 
= 
= 
= HL
@ 
@ 
@	sEz	
@*25e3D*E
@	
@ 
@ 
@ 
@ Dc DC DD D D D D
  T
 .2T T T	sEz	TeT T
 c5j)*T 
T T T T:   -1	L L L	sEz	L L c5j)*	L
 	L L L L KOA A A#u*A-5eCJ6G-HA	%[A A A A A Ar   