| Copyright | (c) 2014-2015, Peter Trško |
|---|---|
| License | BSD3 |
| Maintainer | peter.trsko@gmail.com |
| Stability | unstable (internal module) |
| Portability | DeriveDataTypeable, FlexibleContexts, NamedFieldPuns, NoImplicitPrelude, RecordWildCards |
| Safe Haskell | None |
| Language | Haskell2010 |
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.
- data ConnectionPool handlerParams a = ConnectionPool {
- _resourcePool :: !(Pool (Socket, a))
- _handlerParams :: !handlerParams
- resourcePool :: Functor f => (Pool (Socket, a) -> f (Pool (Socket, b))) -> ConnectionPool handlerParams a -> f (ConnectionPool handlerParams b)
- handlerParams :: Functor f => (handlerParams -> f handlerParams') -> ConnectionPool handlerParams c -> f (ConnectionPool handlerParams' c)
- createConnectionPool :: handlerParams -> IO (Socket, a) -> (Socket -> IO ()) -> ResourcePoolParams -> IO (ConnectionPool handlerParams a)
- destroyAllConnections :: ConnectionPool handlerParams a -> IO ()
- withConnection :: MonadBaseControl IO m => ConnectionPool c a -> (c -> Socket -> a -> m r) -> m r
Documentation
data ConnectionPool handlerParams a Source
Simple specialized wrapper for Pool.
Constructors
| ConnectionPool | |
Fields
| |
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
Arguments
| :: handlerParams | Data type passed down to individual connection handlers. |
| -> IO (Socket, a) | Acquire a connection which is represented by a |
| -> (Socket -> IO ()) | Release a connection which is represented by a |
| -> ResourcePoolParams | Data type representing all |
| -> 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.