
    tia                     l    d dl mZmZ d dlZd dlmZ d dlmZmZ d dl	m
Z
 d dlmZ  G d d          ZdS )	    )ClassVarDictN)	ServerAPI)SettingsSystem)ProductTelemetryClient)ClientStartEventc                   (   e Zd ZU i Zeeeef                  ed<   eed<    e	            fde	ddfdZ
edede	defd            Zede	defd	            Zed
edefd            Zed
edd fd            Zedd            Zedefd            ZddZdS )SharedSystemClient_identifier_to_system_identifiersettingsreturnNc                     t                               |          | _        t                               | j        |           d S N)r   _get_identifier_from_settingsr   _create_system_if_not_exists)selfr   s     T/var/www/icac/venv/lib/python3.11/site-packages/chromadb/api/shared_system_client.py__init__zSharedSystemClient.__init__   s9     .KKHUU778H(SSSSS    
identifierc                 H   || j         vrbt          |          }|| j         |<   |                    t                     |                    t                     |                                 n+| j         |         }|j        |k    rt          d| d          | j         |         S )Nz)An instance of Chroma already exists for z with different settings)r   r   instancer   r   startr   
ValueError)clsr   r   
new_systemprevious_systems        r   r   z/SharedSystemClient._create_system_if_not_exists   s     S666))J4>C%j1 6777	***!7
CO '833 d
ddd   (44r   c                     d}| j         }|t          d          |dk    r| j        r| j        }n:d}n7|dv r!t	          t          j                              }nt          d|           |S )N z1Chroma API implementation must be set in settingszchromadb.api.segment.SegmentAPI	ephemeral)zchromadb.api.fastapi.FastAPIz'chromadb.api.async_fastapi.AsyncFastAPIz&Unsupported Chroma API implementation )chroma_api_implr   is_persistentpersist_directorystruuiduuid4)r   r   api_impls      r   r   z0SharedSystemClient._get_identifier_from_settings,   s    
+PQQQ:::% %7

   
  
 
 

 TZ\\**JJPhPPQQQr   systemc                 b    t                               | j                  }| t           j        |<   |S r   )r   r   r   r   )r*   r   s     r   _populate_data_from_systemz-SharedSystemClient._populate_data_from_systemE   s+    'EEfoVV
?E0<r   c                 Z    t                               |            | |j                  }|S )zRCreate a client from an existing system. This is useful for testing and debugging.)r   r,   r   )r   r*   r   s      r   from_systemzSharedSystemClient.from_systemK   s.     	55f===3v''r   c                      i t           _        d S r   )r   r    r   r   clear_system_cachez%SharedSystemClient.clear_system_cacheS   s    35000r   c                 0    t           j        | j                 S r   )r   r   r   )r   s    r   _systemzSharedSystemClient._systemW   s    !78HIIr   c                     | j                             t                    }|                    t	                                 d S r   )r3   r   r   capturer	   )r   telemetry_clients     r   _submit_client_start_eventz-SharedSystemClient._submit_client_start_event[   s:    <001GHH  !1!3!344444r   )r   N)__name__
__module____qualname__r   r   r   r&   r   __annotations__r   r   classmethodr   staticmethodr   r,   r.   r1   propertyr3   r7   r0   r   r   r   r   
   s        9;8Df$56;;; &XZZT TT 
T T T T 55(05	5 5 5 [5,  S    \0 6 c    \
  ,@    [ 6 6 6 \6 J J J J XJ5 5 5 5 5 5r   r   )typingr   r   r'   chromadb.apir   chromadb.configr   r   chromadb.telemetry.productr   !chromadb.telemetry.product.eventsr	   r   r0   r   r   <module>rD      s    ! ! ! ! ! ! ! !  " " " " " " , , , , , , , , = = = = = = > > > > > >S5 S5 S5 S5 S5 S5 S5 S5 S5 S5r   