connection-pool-0.2.2: Connection pool built on top of resource-pool and streaming-commons.

Copyright(c) 2014-2016 Peter Trško
LicenseBSD3
Maintainerpeter.trsko@gmail.com
Stabilityunstable (internal module)
PortabilityGHC specific language extensions.
Safe HaskellNone
LanguageHaskell2010

Data.ConnectionPool.Internal.TCP

Description

Module defines type family of connection pools that is later specialised using type tags (phantom types) to specialize implementation of underlying ConnectionPool for various protocols.

Internal packages are here to provide access to internal definitions for library writers, but they should not be used in application code.

Preferably use qualified import, e.g.:

import qualified Data.ConnectionPool.Internal.TCP as Internal

Module introduced in version 0.2.

Synopsis

Documentation

data family ConnectionPool :: k -> * #

Family of connection pools parametrised by transport protocol.

Definition changed in version 0.2 to be kind polymorphic (only on GHC >= 7.10), and became part of stable API by being moved in to Data.ConnectionPool.Family module.

Instances
HasConnectionPool HandlerParams Socket () (ConnectionPool UnixClient) #

Since version 0.2.

Instance details

Defined in Data.ConnectionPool.Internal.Unix

HasConnectionPool HandlerParams Socket SockAddr (ConnectionPool TcpClient) #

Since version 0.2.

Instance details

Defined in Data.ConnectionPool.Internal.TCP

Show (ConnectionPool TcpClient) # 
Instance details

Defined in Data.ConnectionPool.Internal.TCP

Show (ConnectionPool UnixClient) # 
Instance details

Defined in Data.ConnectionPool.Internal.Unix

Generic (ConnectionPool TcpClient) # 
Instance details

Defined in Data.ConnectionPool.Internal.TCP

Associated Types

type Rep (ConnectionPool TcpClient) :: * -> * #

Generic (ConnectionPool UnixClient) # 
Instance details

Defined in Data.ConnectionPool.Internal.Unix

Associated Types

type Rep (ConnectionPool UnixClient) :: * -> * #

data ConnectionPool TcpClient #

Connection pool for TCP clients.

Definition changed in version 0.1.3 and 0.2. Instances for Generic and Show introduced in version 0.2.

Instance details

Defined in Data.ConnectionPool.Internal.TCP

data ConnectionPool UnixClient #

Connection pool for UNIX Socket clients.

Definition changed in version 0.1.3 and 0.2. Instances for Generic and Show introduced in version 0.2.

Instance details

Defined in Data.ConnectionPool.Internal.Unix

type Rep (ConnectionPool TcpClient) # 
Instance details

Defined in Data.ConnectionPool.Internal.TCP

type Rep (ConnectionPool TcpClient) = D1 (MetaData "ConnectionPool" "Data.ConnectionPool.Internal.TCP" "connection-pool-0.2.2-JZ0PRtvm17B2lHDKKV9f0u" True) (C1 (MetaCons "TcpConnectionPool" PrefixI False) (S1 (MetaSel (Nothing :: Maybe Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 (ConnectionPool HandlerParams Socket SockAddr))))
type Rep (ConnectionPool UnixClient) # 
Instance details

Defined in Data.ConnectionPool.Internal.Unix

type Rep (ConnectionPool UnixClient) = D1 (MetaData "ConnectionPool" "Data.ConnectionPool.Internal.Unix" "connection-pool-0.2.2-JZ0PRtvm17B2lHDKKV9f0u" True) (C1 (MetaCons "UnixConnectionPool" PrefixI False) (S1 (MetaSel (Nothing :: Maybe Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 (ConnectionPool HandlerParams Socket ()))))

data TcpClient #

Type tag used to specialize connection pool for TCP clients.

Instance for Generic introduced in version 0.2.

Instances
Generic TcpClient # 
Instance details

Defined in Data.ConnectionPool.Internal.TCP

Associated Types

type Rep TcpClient :: * -> * #

HasConnectionPool HandlerParams Socket SockAddr (ConnectionPool TcpClient) #

Since version 0.2.

Instance details

Defined in Data.ConnectionPool.Internal.TCP

ConnectionPoolFor TcpClient #

Defined using:

withConnection = withTcpClientConnection
destroyAllConnections = destroyAllTcpClientConnections

Since version 0.2.

Instance details

Defined in Data.ConnectionPool.Internal.TCP

Associated Types

type HandlerData TcpClient :: * #

Show (ConnectionPool TcpClient) # 
Instance details

Defined in Data.ConnectionPool.Internal.TCP

Generic (ConnectionPool TcpClient) # 
Instance details

Defined in Data.ConnectionPool.Internal.TCP

Associated Types

type Rep (ConnectionPool TcpClient) :: * -> * #

type Rep TcpClient # 
Instance details

Defined in Data.ConnectionPool.Internal.TCP

type Rep TcpClient = D1 (MetaData "TcpClient" "Data.ConnectionPool.Internal.TCP" "connection-pool-0.2.2-JZ0PRtvm17B2lHDKKV9f0u" False) (V1 :: * -> *)
data ConnectionPool TcpClient #

Connection pool for TCP clients.

Definition changed in version 0.1.3 and 0.2. Instances for Generic and Show introduced in version 0.2.

Instance details

Defined in Data.ConnectionPool.Internal.TCP

type HandlerData TcpClient # 
Instance details

Defined in Data.ConnectionPool.Internal.TCP

type Rep (ConnectionPool TcpClient) # 
Instance details

Defined in Data.ConnectionPool.Internal.TCP

type Rep (ConnectionPool TcpClient) = D1 (MetaData "ConnectionPool" "Data.ConnectionPool.Internal.TCP" "connection-pool-0.2.2-JZ0PRtvm17B2lHDKKV9f0u" True) (C1 (MetaCons "TcpConnectionPool" PrefixI False) (S1 (MetaSel (Nothing :: Maybe Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 (ConnectionPool HandlerParams Socket SockAddr))))

createTcpClientPool :: ResourcePoolParams -> ClientSettings -> IO (ConnectionPool TcpClient) #

Create connection pool for TCP clients.

withTcpClientConnection :: (MonadBaseControl io m, io ~ IO) => ConnectionPool TcpClient -> (AppData -> m r) -> m r #

Temporarily take a TCP connection from a pool, run client with it, and return it to the pool afterwards. For details how connections are allocated see withResource.

tryWithTcpClientConnection :: (MonadBaseControl io m, io ~ IO) => ConnectionPool TcpClient -> (AppData -> m r) -> m (Maybe r) #

Similar to withConnection, but only performs action if a TCP connection could be taken from the pool without blocking. Otherwise, tryWithResource returns immediately with Nothing (ie. the action function is not called). Conversely, if a connection can be acquired from the pool without blocking, the action is performed and it's result is returned, wrapped in a Just.

Since version 0.2.

destroyAllTcpClientConnections :: ConnectionPool TcpClient -> IO () #

Destroy all TCP connections that might be still open in a connection pool. This is useful when one needs to release all resources at once and not to wait for idle timeout to be reached.

For more details see destroyAllResources.

Since version 0.1.1.0.