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

Copyright(c) 2014-2015, Peter Trško
LicenseBSD3
Maintainerpeter.trsko@gmail.com
Stabilityunstable (internal module)
PortabilityDeriveDataTypeable, FlexibleContexts, NamedFieldPuns, NoImplicitPrelude, RecordWildCards
Safe HaskellNone
LanguageHaskell2010

Data.ConnectionPool.Internal.ConnectionPool

Description

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.ConnectionPool as Internal

This module doesn't depend on streaming-commons and other non-HaskellPlatform packages with notable exception of resource-pool. Another notable thing is that this package is not OS specific. Please, bear this in mind when doing modifications.

Synopsis

Documentation

data ConnectionPool handlerParams a Source

Simple specialized wrapper for Pool.

Constructors

ConnectionPool 

Fields

_resourcePool :: !(Pool (Socket, a))
 
_handlerParams :: !handlerParams
 

Instances

Show handlerParams => Show (ConnectionPool handlerParams a)

@since 0.1.3

Typeable (* -> * -> *) ConnectionPool 

resourcePool :: Functor f => (Pool (Socket, a) -> f (Pool (Socket, b))) -> ConnectionPool handlerParams a -> f (ConnectionPool handlerParams b) Source

handlerParams :: Functor f => (handlerParams -> f handlerParams') -> ConnectionPool handlerParams c -> f (ConnectionPool handlerParams' c) Source

createConnectionPool Source

Arguments

:: handlerParams

Data type passed down to individual connection handlers.

-> IO (Socket, a)

Acquire a connection which is represented by a Socket. There might be additional information associated with specific connection that we pass as a sencond value in a tuple. Such information are considered read only and aren't passed to release function (see next argument).

-> (Socket -> IO ())

Release a connection which is represented by a Socket.

-> ResourcePoolParams

Data type representing all createPool parameters that describe internal Pool parameters.

-> IO (ConnectionPool handlerParams a)

Created connection pool that is parametrised by additional connection details.

Specialized wrapper for createPool, see its documentation for details.

destroyAllConnections :: ConnectionPool handlerParams a -> IO () Source

Destroy all 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.

withConnection :: MonadBaseControl IO m => ConnectionPool c a -> (c -> Socket -> a -> m r) -> m r Source

Specialized wrapper for withResource.