NebulaGraph Python Client  release-3.4
ConnectionPool Class Reference
+ Inheritance diagram for ConnectionPool:
+ Collaboration diagram for ConnectionPool:

Public Member Functions

def __init__ (self)
 
def __del__ (self)
 
def init (self, addresses, configs, ssl_conf=None)
 
def get_session (self, user_name, password, retry_connect=True)
 
def session_context (self, *args, **kwargs)
 
def get_connection (self)
 
def ping (self, address)
 
def close (self)
 
def connects (self)
 
def in_used_connects (self)
 
def get_ok_servers_num (self)
 
def update_servers_status (self)
 

Static Public Attributes

int S_OK = 0
 
int S_BAD = 1
 

Detailed Description

Definition at line 21 of file ConnectionPool.py.

Member Function Documentation

◆ close()

def close (   self)
close all connections in pool

:return: void

Definition at line 218 of file ConnectionPool.py.

+ Here is the caller graph for this function:

◆ connects()

def connects (   self)
get the number of existing connections

:return: the number of connections

Definition at line 231 of file ConnectionPool.py.

◆ get_connection()

def get_connection (   self)
get available connection

:return: Connection

Definition at line 131 of file ConnectionPool.py.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ get_ok_servers_num()

def get_ok_servers_num (   self)
get the number of the ok servers

:return: int

Definition at line 255 of file ConnectionPool.py.

+ Here is the caller graph for this function:

◆ get_session()

def get_session (   self,
  user_name,
  password,
  retry_connect = True 
)
get session

:param user_name: the user name to authenticate graphd
:param password: the password to authenticate graphd
:param retry_connect:
:return: Session

Definition at line 90 of file ConnectionPool.py.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ in_used_connects()

def in_used_connects (   self)
get the number of the used connections

:return: int

Definition at line 242 of file ConnectionPool.py.

◆ init()

def init (   self,
  addresses,
  configs,
  ssl_conf = None 
)
init the connection pool

:param addresses: the graphd servers' addresses
:param configs: the config of the pool
:param ssl_conf: the config of SSL socket
:return: if all addresses are ok, return True else return False.

Definition at line 43 of file ConnectionPool.py.

+ Here is the call graph for this function:

◆ ping()

def ping (   self,
  address 
)
check the server is ok

:param address: the server address want to connect
:return: True or False

Definition at line 201 of file ConnectionPool.py.

+ Here is the caller graph for this function:

◆ session_context()

def session_context (   self,
args,
**  kwargs 
)
session_context is to be used with a contextlib.contextmanager.
It returns a connection session from the pool, with same params
as the method get_session().

When session_context is exited, the connection will be released.

:param user_name: the user name to authenticate graphd
:param password: the password to authenticate graphd
:param retry_connect: if auto retry connect
:return: contextlib._GeneratorContextManager

Definition at line 108 of file ConnectionPool.py.

+ Here is the call graph for this function:

◆ update_servers_status()

def update_servers_status (   self)
update the servers' status

Definition at line 275 of file ConnectionPool.py.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

The documentation for this class was generated from the following file: