grnet/archipelago — pull request #60 by cnanakos (2014-12-26 21:41:03+00:00)
Title: archipelago: Introduce ArchipelagoPoolClient class

The class can be instantiated without any argument, the default
configuration file which is used is '/etc/archipelago/archipelago.conf':

pool = ArchipelagoPoolClient()

or using another configuration file:

pool = ArchipelagoPoolClient(conffile='local.conf')

or using another connection endpoint for the connection pooler:

pool = ArchipelagoPoolClient(endpoint='poold.socket')

or

pool = ArchipelagoPoolClient(conffile='local.conf',
endpoint='poold.socket')

or using a set of keyword arguments describing the full segment
characteristics:

pool = ArchipelagoPoolClient(segtype='posix', segname='archipelago',
dynports=1024, ports=2048, segsize=2048,
segalign=12)

The basic segment parameters are:

- *segname*: the segment name
- *segtype*: the segment type
- *dynports*: the dynamic ports range
- *ports*: the total ports range
- *segsize*: the segmen size
- *segalign*: the segment alignment

Any other keyword parameter will be passed to the underlying client
libraries: the list of supported parameters depends on the library version.

The following functionality is provided:

- Connect to connection pooler

pool.connect()

- Get an Archipelago port

portctx = pool.get_port()

- Return Archipelago port back to connection pool

pool.leave_port(portctx)

- Check if connection is alive

pool.alive()

- Return all ports the instatiated object holds back to the connection pool

pool.leave_all_ports()

Signed-off-by: Chrysostomos Nanakos