2222    PoolTolopogyError ,
2323    PoolTolopogyWarning ,
2424    ConfigurationError ,
25-     DatabaseError ,
2625    NetworkError ,
27-     NetworkWarning ,
28-     tnt_strerror ,
2926    warn 
3027)
3128from  tarantool .utils  import  ENCODING_DEFAULT 
32- from  tarantool .mesh_connection  import  validate_address 
29+ from  tarantool .mesh_connection  import  prepare_address 
3330
3431
3532class  Mode (Enum ):
@@ -190,13 +187,15 @@ class ConnectionPool(ConnectionInterface):
190187    ConnectionPool API is the same as a plain Connection API. 
191188    On each request, a connection is chosen to execute this request. 
192189    Connection is selected based on request mode: 
190+ 
193191    * Mode.ANY chooses any instance. 
194192    * Mode.RW chooses an RW instance. 
195193    * Mode.RO chooses an RO instance. 
196194    * Mode.PREFER_RW chooses an RW instance, if possible, RO instance 
197195      otherwise. 
198196    * Mode.PREFER_RO chooses an RO instance, if possible, RW instance 
199197      otherwise. 
198+ 
200199    All requests that are guaranteed to write (insert, replace, delete, 
201200    upsert, update) use RW mode by default. select uses ANY by default. You 
202201    can set the mode explicitly. call, eval, execute and ping requests 
@@ -218,36 +217,47 @@ def __init__(self,
218217        ''' 
219218        Initialize connections to the cluster of servers. 
220219
221-         :param list addrs: List of {host: , port:} dictionaries, 
222-         describing server addresses. 
223-         :user str Username used to authenticate. User must be able 
224-         to call box.info function. For example, to give grants to  
225-         'guest' user, evaluate 
226-           box.schema.func.create('box.info') 
227-           box.schema.user.grant('guest', 'execute', 'function', 'box.info') 
228-         on Tarantool instances. 
220+         :param list addrs: List of 
221+ 
222+             .. code-block:: python 
223+ 
224+                 { host: "str", 
225+                   port: int, 
226+                   transport: "str", 
227+                   ssl_key_file: "str", 
228+                   ssl_cert_file: "str", 
229+                   ssl_ca_file: "str", 
230+                   ssl_ciphers: "str" } 
231+ 
232+             dictionaries, describing server addresses. 
233+         :param str user: Username used to authenticate. User must be able 
234+             to call box.info function. For example, to give grants to 
235+             'guest' user, evaluate 
236+             box.schema.func.create('box.info') 
237+             box.schema.user.grant('guest', 'execute', 'function', 'box.info') 
238+             on Tarantool instances. 
229239        :param int reconnect_max_attempts: Max attempts to reconnect 
230-         for each connection in the pool. Be careful with reconnect 
231-         parameters in ConnectionPool since every status refresh is 
232-         also a request with reconnection. Default is 0 (fail after 
233-         first attempt). 
240+              for each connection in the pool. Be careful with reconnect 
241+              parameters in ConnectionPool since every status refresh is 
242+              also a request with reconnection. Default is 0 (fail after 
243+              first attempt). 
234244        :param float reconnect_delay: Time between reconnect 
235-         attempts for each connection in the pool. Be careful with 
236-         reconnect parameters in ConnectionPool since every status 
237-         refresh is also a request with reconnection. Default is 0. 
245+              attempts for each connection in the pool. Be careful with 
246+              reconnect parameters in ConnectionPool since every status 
247+              refresh is also a request with reconnection. Default is 0. 
238248        :param StrategyInterface strategy_class: Class for choosing 
239-         instance based on request mode. By default, round-robin 
240-         strategy is used. 
249+              instance based on request mode. By default, round-robin 
250+              strategy is used. 
241251        :param int refresh_delay: Minimal time between RW/RO status 
242-         refreshes. 
252+              refreshes. 
243253        ''' 
244254
245255        if  not  isinstance (addrs , list ) or  len (addrs ) ==  0 :
246256            raise  ConfigurationError ("addrs must be non-empty list" )
247257
248-         # Verify  addresses. 
258+         # Prepare  addresses for usage . 
249259        for  addr  in  addrs :
250-             ok , msg  =  validate_address (addr )
260+             ok , msg  =  prepare_address (addr )
251261            if  not  ok :
252262                raise  ConfigurationError (msg )
253263        self .addrs  =  addrs 
@@ -272,7 +282,12 @@ def __init__(self,
272282                    connect_now = False , # Connect in ConnectionPool.connect() 
273283                    encoding = encoding ,
274284                    call_16 = call_16 ,
275-                     connection_timeout = connection_timeout )
285+                     connection_timeout = connection_timeout ,
286+                     transport = addr ['transport' ],
287+                     ssl_key_file = addr ['ssl_key_file' ],
288+                     ssl_cert_file = addr ['ssl_cert_file' ],
289+                     ssl_ca_file = addr ['ssl_ca_file' ],
290+                     ssl_ciphers = addr ['ssl_ciphers' ])
276291            )
277292
278293        if  connect_now :
@@ -464,7 +479,7 @@ def ping(self, *, mode=None, **kwargs):
464479    def  select (self , space_name , key , * , mode = Mode .ANY , ** kwargs ):
465480        ''' 
466481        :param tarantool.Mode mode: Request mode (default is 
467-         ANY). 
482+              ANY). 
468483        ''' 
469484
470485        return  self ._send (mode , 'select' , space_name , key , ** kwargs )
0 commit comments