Aestate
Public Member Functions | Public Attributes | Static Public Attributes | Private Member Functions | Private Attributes | List of all members
aestate.opera.DBPool.simple_pooled_db.PooledDB Class Reference
Collaboration diagram for aestate.opera.DBPool.simple_pooled_db.PooledDB:
Collaboration graph

Public Member Functions

def __init__ (self, dbapi, maxconnections, *args, **kwargs)
 

Public Attributes

 connection
 
 addConnection
 
 returnConnection
 

Static Public Attributes

 version = __version__
 

Private Member Functions

def _unthreadsafe_get_connection (self)
 
def _unthreadsafe_add_connection (self, con)
 
def _unthreadsafe_return_connection (self, con)
 
def _threadsafe_get_connection (self)
 
def _threadsafe_add_connection (self, con)
 
def _threadsafe_return_connection (self, con)
 

Private Attributes

 _queue
 
 _lock
 
 _nextConnection
 
 _connections
 

Detailed Description

A very simple database connection pool.

After you have created the connection pool,
you can get connections using getConnection().

Definition at line 113 of file simple_pooled_db.py.

Constructor & Destructor Documentation

◆ __init__()

def aestate.opera.DBPool.simple_pooled_db.PooledDB.__init__ (   self,
  dbapi,
  maxconnections,
args,
**  kwargs 
)
Set up the database connection pool.

dbapi: the DB-API 2 compliant module you want to use
maxconnections: the number of connections cached in the pool
args, kwargs: the parameters that shall be used to establish
    the database connections using connect()

Definition at line 122 of file simple_pooled_db.py.

Member Function Documentation

◆ _threadsafe_add_connection()

def aestate.opera.DBPool.simple_pooled_db.PooledDB._threadsafe_add_connection (   self,
  con 
)
private
Add a connection to the pool.

Definition at line 211 of file simple_pooled_db.py.

◆ _threadsafe_get_connection()

def aestate.opera.DBPool.simple_pooled_db.PooledDB._threadsafe_get_connection (   self)
private
Get a connection from the pool.

Definition at line 197 of file simple_pooled_db.py.

◆ _threadsafe_return_connection()

def aestate.opera.DBPool.simple_pooled_db.PooledDB._threadsafe_return_connection (   self,
  con 
)
private
Return a connection to the pool.

In this case, the connections always stay in the pool,
so there is no need to do anything here.

Definition at line 215 of file simple_pooled_db.py.

◆ _unthreadsafe_add_connection()

def aestate.opera.DBPool.simple_pooled_db.PooledDB._unthreadsafe_add_connection (   self,
  con 
)
private
Add a connection to the pool.

Definition at line 178 of file simple_pooled_db.py.

Here is the caller graph for this function:

◆ _unthreadsafe_get_connection()

def aestate.opera.DBPool.simple_pooled_db.PooledDB._unthreadsafe_get_connection (   self)
private
Get a connection from the pool.

Definition at line 174 of file simple_pooled_db.py.

◆ _unthreadsafe_return_connection()

def aestate.opera.DBPool.simple_pooled_db.PooledDB._unthreadsafe_return_connection (   self,
  con 
)
private
Return a connection to the pool.

In this case, the connections need to be put
back into the queue after they have been used.
This is done automatically when the connection is closed
and should never be called explicitly outside of this module.

Definition at line 182 of file simple_pooled_db.py.

Here is the call graph for this function:

Member Data Documentation

◆ _connections

aestate.opera.DBPool.simple_pooled_db.PooledDB._connections
private

Definition at line 156 of file simple_pooled_db.py.

◆ _lock

aestate.opera.DBPool.simple_pooled_db.PooledDB._lock
private

Definition at line 154 of file simple_pooled_db.py.

◆ _nextConnection

aestate.opera.DBPool.simple_pooled_db.PooledDB._nextConnection
private

Definition at line 155 of file simple_pooled_db.py.

◆ _queue

aestate.opera.DBPool.simple_pooled_db.PooledDB._queue
private

Definition at line 145 of file simple_pooled_db.py.

◆ addConnection

aestate.opera.DBPool.simple_pooled_db.PooledDB.addConnection

Definition at line 147 of file simple_pooled_db.py.

◆ connection

aestate.opera.DBPool.simple_pooled_db.PooledDB.connection

Definition at line 146 of file simple_pooled_db.py.

◆ returnConnection

aestate.opera.DBPool.simple_pooled_db.PooledDB.returnConnection

Definition at line 148 of file simple_pooled_db.py.

◆ version

aestate.opera.DBPool.simple_pooled_db.PooledDB.version = __version__
static

Definition at line 120 of file simple_pooled_db.py.


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