class ConnectorPool

This class implements a thread-safe DB connector pool in the typical way. ConnectorPool is the generic base class for SeaIceConnectorPool which is should be used in practice.

class seaice.ConnectorPool.ConnectorPool(Connector, count=20, user=None, password=None, db=None)[source]

A thread-safe connection pool.

TODO: Make this an actual queue, not a stack. Nomenclature is imporant sometimes.

dequeue()[source]

Get connector.

Return type:seaice.SeaIceConnector.SeaIceConnector
enqueue(db_con)[source]

Release connector.

Parameters:db_con (seaice.SeaIceConnector.SeaIceConnector) – The connector.
class seaice.ConnectorPool.SeaIceConnectorPool(count=20, user=None, password=None, db=None)[source]

Bases: seaice.ConnectorPool.ConnectorPool

A thread-safe connection pool which can produce scoped SeaIce connectors.

Parameters:
  • count (int) – Size of the pool.
  • user (str) – Name of DB role (see seaice.SeaIceConnector.SeaIceConnector for default behavior).
  • password (str) – User’s password.
  • db (str) – Name of database.
getScoped()[source]

Return a scoped connector from the pool.

Return type:seaice.SeaIceConnector.SeaIceConnector

digraph inheritancecd7b16f004 { rankdir=LR; size="8.0, 12.0"; "seaice.ConnectorPool.ScopedSeaIceConnector" [style="setlinewidth(0.5)",URL="SeaIceConnector.html#seaice.ConnectorPool.ScopedSeaIceConnector",fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",tooltip="A SeaIce DB Connector which is released to the pool it from whence it ",height=0.25,shape=box,fontsize=10]; "seaice.SeaIceConnector.SeaIceConnector" -> "seaice.ConnectorPool.ScopedSeaIceConnector" [arrowsize=0.5,style="setlinewidth(0.5)"]; "seaice.SeaIceConnector.SeaIceConnector" [style="setlinewidth(0.5)",URL="SeaIceConnector.html#seaice.SeaIceConnector.SeaIceConnector",fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",tooltip="Connection to the PostgreSQL database. ",height=0.25,shape=box,fontsize=10]; }

class seaice.ConnectorPool.ScopedSeaIceConnector(pool, db_con)[source]

Bases: seaice.SeaIceConnector.SeaIceConnector

A SeaIce DB Connector which is released to the pool it from whence it came when it goes out of scope. This type of connector is produced by seaice.ConnectorPool.SeaIceConnectorPool.getScoped() and should not be used directly.

Parameters:

Previous topic

class SeaIceConnector – interface for PostgreSQL DB

Next topic

class IdPool

This Page