-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | Connection pool built on top of resource-pool and streaming-commons. -- -- Connection poll is a family specialised resource pools. Currently -- package provides two variants: -- --
    --
  1. pool for TCP client connections,
  2. --
  3. and pool for UNIX Sockets client connections.
  4. --
-- -- In addition it can be used to build your own connection pool using -- provided primitives. -- -- This package is built on top of resource-pool and -- streaming-commons. The later allows us to use -- conduit-extra package for implementation of TCP or UNIX Sockets -- clients. -- -- For examples and other details see documentation in -- Data.ConnectionPool module. @package connection-pool @version 0.2 -- | 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.HandlerParams as Internal
--   
-- -- This module doesn't depend on streaming-commons. Another -- notable thing is that this package is not OS specific. Please, bear -- this in mind when doing modifications. -- -- Since version 0.1.3. module Data.ConnectionPool.Internal.HandlerParams -- | Additional parameters passed to connection handler that aren't part of -- specific connection context. -- -- Since version 0.1.3. data HandlerParams HandlerParams :: !Int -> HandlerParams -- | See readBufferSize for details. [_readBufferSize] :: HandlerParams -> !Int -- | Lens for accessing read buffer size that handler should use when -- reading data from connection. -- -- Since version 0.1.3. readBufferSize :: Functor f => (Int -> f Int) -> HandlerParams -> f HandlerParams instance GHC.Generics.Selector Data.ConnectionPool.Internal.HandlerParams.S1_0_0HandlerParams instance GHC.Generics.Constructor Data.ConnectionPool.Internal.HandlerParams.C1_0HandlerParams instance GHC.Generics.Datatype Data.ConnectionPool.Internal.HandlerParams.D1HandlerParams instance GHC.Show.Show Data.ConnectionPool.Internal.HandlerParams.HandlerParams instance GHC.Generics.Generic Data.ConnectionPool.Internal.HandlerParams.HandlerParams instance Data.Data.Data Data.ConnectionPool.Internal.HandlerParams.HandlerParams instance Data.Default.Class.Default Data.ConnectionPool.Internal.HandlerParams.HandlerParams -- | Module defines helper functions that would be ideally provided by -- streaming-commons package and some wrappers with specialised -- type signatures. -- -- 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.Streaming as Internal
--   
-- -- This module doesn't neither depend on resource-pool package nor -- any other module of this package, with notable exception of -- Data.ConnectionPool.Internal.HandlerParams, and it shoud stay -- that way. This module uses CPP to get OS specific things right. Most -- importantly Windows doesn't support UNIX Sockets. -- -- Please, bear above in mind when doing modifications. module Data.ConnectionPool.Internal.Streaming -- | Wrapper for getSocketFamilyTCP that takes ClientSettings -- instead of individual parameters. acquireTcpClientConnection :: ClientSettings -> IO (Socket, SockAddr) -- | Wrapper for runTcpAppImpl with a type signature that is more -- natural for implementing a TCP specific withConnection. -- -- Definition changed in version 0.1.3. runTcpApp :: MonadBaseControl IO m => Maybe SockAddr -> (AppData -> m r) -> HandlerParams -> Socket -> SockAddr -> m r -- | Simplified runTCPClient and runTCPServer that provides -- only construction of AppData and passing it to a callback -- function. -- -- Definition changed in version 0.1.3. runTcpAppImpl :: MonadBaseControl IO m => Maybe SockAddr -> Socket -> SockAddr -> Int -> (AppData -> m r) -> m r -- | Construct HandlerParams that are passed to individual TCP -- connection handlers. -- -- Since version 0.1.3. fromClientSettings :: ClientSettings -> HandlerParams -- | Wrapper for runUnixAppImpl with a type signature that is more -- natural for implementing a UNIX Socket specific withConnection. -- -- Definition changed in version 0.1.3. runUnixApp :: MonadBaseControl IO m => (AppDataUnix -> m r) -> HandlerParams -> Socket -> () -> m r -- | Simplified runUnixClient and runUnixServer that provides -- only construction of AppDataUnix and passing it to a callback -- function. -- -- Definition changed in version 0.1.3. runUnixAppImpl :: MonadBaseControl IO m => Socket -> Int -> (AppDataUnix -> m r) -> m r -- | Construct HandlerParams that are passed to individual UNIX -- socket connection handlers. -- -- Since version 0.1.3. fromClientSettingsUnix :: ClientSettingsUnix -> HandlerParams -- | 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.ResourcePoolParams
--     as Internal
--   
-- -- Surprisingly this module doesn't depend on resource-pool -- package and it would be good if it stayed that way, but not at the -- cost of crippling functionality. -- -- Importantly this package should not depend on streaming-commons -- package or other modules of this package. -- -- Please, bear above in mind when doing modifications. module Data.ConnectionPool.Internal.ResourcePoolParams -- | Parameters of resource pool that describe things like its internal -- structure. See createPool for details. -- -- Instance for Generic introduced in version 0.2. data ResourcePoolParams ResourcePoolParams :: !Int -> !NominalDiffTime -> !Int -> ResourcePoolParams [_numberOfStripes] :: ResourcePoolParams -> !Int [_resourceIdleTimeout] :: ResourcePoolParams -> !NominalDiffTime [_numberOfResourcesPerStripe] :: ResourcePoolParams -> !Int -- | Lens for accessing maximum number of resources to keep open per -- stripe. The smallest acceptable value is 1 (default). numberOfResourcesPerStripe :: Functor f => (Int -> f Int) -> ResourcePoolParams -> f ResourcePoolParams -- | Lens for accessing stripe count. The number of distinct sub-pools to -- maintain. The smallest acceptable value is 1 (default). numberOfStripes :: Functor f => (Int -> f Int) -> ResourcePoolParams -> f ResourcePoolParams -- | Lens for accessing amount of time for which an unused resource is kept -- open. The smallest acceptable value is 0.5 seconds (default). resourceIdleTimeout :: Functor f => (NominalDiffTime -> f NominalDiffTime) -> ResourcePoolParams -> f ResourcePoolParams -- | Check if all parameters for underlying resource pool are valid: -- -- -- -- For more details see createPool. -- -- Since version 0.1.1.0. validateResourcePoolParams :: ResourcePoolParams -> Either String ResourcePoolParams instance GHC.Generics.Selector Data.ConnectionPool.Internal.ResourcePoolParams.S1_0_2ResourcePoolParams instance GHC.Generics.Selector Data.ConnectionPool.Internal.ResourcePoolParams.S1_0_1ResourcePoolParams instance GHC.Generics.Selector Data.ConnectionPool.Internal.ResourcePoolParams.S1_0_0ResourcePoolParams instance GHC.Generics.Constructor Data.ConnectionPool.Internal.ResourcePoolParams.C1_0ResourcePoolParams instance GHC.Generics.Datatype Data.ConnectionPool.Internal.ResourcePoolParams.D1ResourcePoolParams instance GHC.Show.Show Data.ConnectionPool.Internal.ResourcePoolParams.ResourcePoolParams instance GHC.Generics.Generic Data.ConnectionPool.Internal.ResourcePoolParams.ResourcePoolParams instance Data.Data.Data Data.ConnectionPool.Internal.ResourcePoolParams.ResourcePoolParams instance Data.Default.Class.Default Data.ConnectionPool.Internal.ResourcePoolParams.ResourcePoolParams -- | 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 exception of two packages -- resource-pool and between. Another notable thing is that -- this package is not OS specific. Please, bear this in mind when doing -- modifications. module Data.ConnectionPool.Internal.ConnectionPool -- | Simple specialized wrapper for Pool. -- -- Definition changed in version 0.1.3 and 0.2. Instance for -- Generic introduced in version 0.2. data ConnectionPool handlerParams connection connectionInfo ConnectionPool :: !(Pool (connection, connectionInfo)) -> !handlerParams -> ConnectionPool handlerParams connection connectionInfo -- | See resourcePool for details. -- -- Since version 0.1.3; changed in 0.2. [_resourcePool] :: ConnectionPool handlerParams connection connectionInfo -> !(Pool (connection, connectionInfo)) -- | See handlerParams for details. -- -- Since version 0.1.3. [_handlerParams] :: ConnectionPool handlerParams connection connectionInfo -> !handlerParams -- | Lens for accessing underlying resource pool Pool -- (connection, connectionInfo). Where connection -- represents network connection and connectionInfo is a -- protocol specific information associated with the same network -- connection as the connection is. -- -- Since version 0.1.3; changed in 0.2. resourcePool :: Functor f => (Pool (c, i) -> f (Pool (c', i'))) -> ConnectionPool p c i -> f (ConnectionPool p c' i') -- | Lens for accessing parameters passed down to connection handler. These -- information will usually be implementation specific. E.g. for -- streaming-commons >= 1.13 we use this to pass around read -- buffer size, for more details see module -- Data.ConnectionPool.Internal.HandlerParams. -- -- Since version 0.1.3. handlerParams :: Functor f => (handlerParams -> f handlerParams') -> ConnectionPool handlerParams c i -> f (ConnectionPool handlerParams' c i) -- | Since version 0.2. class HasConnectionPool p c i s | s -> p, s -> c, s -> i -- | Lens for accessing ConnectionPool wrapped in a data type. connectionPool :: (HasConnectionPool p c i s, Functor f) => (ConnectionPool p c i -> f (ConnectionPool p c i)) -> s -> f s -- | Specialized wrapper for createPool, see its documentation for -- details. -- -- Definition changed in version 0.1.3 and version 0.2. createConnectionPool :: handlerParams -> IO (connection, connectionInfo) -> (connection -> IO ()) -> ResourcePoolParams -> IO (ConnectionPool handlerParams connection connectionInfo) -- | 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. destroyAllConnections :: ConnectionPool p c i -> IO () -- | Specialized wrapper for withResource. -- -- Changed in version 0.2. withConnection :: MonadBaseControl IO m => ConnectionPool handlerParams connection connectionInfo -> (handlerParams -> connection -> connectionInfo -> m r) -> m r -- | Specialized wrapper for tryWithResource. -- -- Since version 0.2. tryWithConnection :: MonadBaseControl IO m => ConnectionPool handlerParams connection connectionInfo -> (handlerParams -> connection -> connectionInfo -> m r) -> m (Maybe r) instance GHC.Generics.Selector Data.ConnectionPool.Internal.ConnectionPool.S1_0_1ConnectionPool instance GHC.Generics.Selector Data.ConnectionPool.Internal.ConnectionPool.S1_0_0ConnectionPool instance GHC.Generics.Constructor Data.ConnectionPool.Internal.ConnectionPool.C1_0ConnectionPool instance GHC.Generics.Datatype Data.ConnectionPool.Internal.ConnectionPool.D1ConnectionPool instance GHC.Generics.Generic (Data.ConnectionPool.Internal.ConnectionPool.ConnectionPool handlerParams connection connectionInfo) instance GHC.Show.Show handlerParams => GHC.Show.Show (Data.ConnectionPool.Internal.ConnectionPool.ConnectionPool handlerParams c i) -- | Module defines data family of connection pools that is later -- specialised for various protocols and implementations. -- -- This module is intended mostly for library writers, for normal usage -- just import Data.ConnectionPool which re-exports -- ConnectionPool data family. -- -- Notice that this module doesn't depend on any other internal modules -- nor any other package then base. Please, bear this in mind when -- doing modifications. module Data.ConnectionPool.Family -- | Family of connection pools parametrised by transport protocol. -- -- Definition changed 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. -- | Type class for common connection pool operations. module Data.ConnectionPool.Class -- | Type class for common connection pool operations. It intentionally -- doesn't handle connection pool creation, which is best left to -- dedicated smart constructors. -- -- Since version 0.2. class ConnectionPoolFor (protocol :: k) where type family HandlerData protocol -- | Temporarily take a connection from a pool, run handler with it, and -- return it to the pool afterwards. -- -- Since version 0.2. withConnection :: (ConnectionPoolFor protocol, MonadBaseControl IO m) => ConnectionPool protocol -> (HandlerData protocol -> m r) -> m r -- | Similar to withConnection, but only performs action if a -- 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. tryWithConnection :: (ConnectionPoolFor protocol, MonadBaseControl IO m) => ConnectionPool protocol -> (HandlerData protocol -> m r) -> m (Maybe r) -- | 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. -- -- Since version 0.2. destroyAllConnections :: ConnectionPoolFor protocol => ConnectionPool protocol -> IO () -- | 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. module Data.ConnectionPool.Internal.TCP -- | Family of connection pools parametrised by transport protocol. -- -- Definition changed 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. -- | Type tag used to specialize connection pool for TCP clients. -- -- Instance for Generic introduced in version 0.2. data TcpClient -- | Create connection pool for TCP clients. createTcpClientPool :: ResourcePoolParams -> ClientSettings -> IO (ConnectionPool TcpClient) -- | 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. withTcpClientConnection :: (MonadBaseControl io m, io ~ IO) => ConnectionPool TcpClient -> (AppData -> m r) -> m 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. tryWithTcpClientConnection :: (MonadBaseControl io m, io ~ IO) => ConnectionPool TcpClient -> (AppData -> m r) -> m (Maybe r) -- | 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. destroyAllTcpClientConnections :: ConnectionPool TcpClient -> IO () instance GHC.Generics.Constructor Data.ConnectionPool.Internal.TCP.C1_0R:ConnectionPool*TcpClient instance GHC.Generics.Datatype Data.ConnectionPool.Internal.TCP.D1R:ConnectionPool*TcpClient instance GHC.Generics.Datatype Data.ConnectionPool.Internal.TCP.D1TcpClient instance GHC.Show.Show (Data.ConnectionPool.Family.ConnectionPool Data.ConnectionPool.Internal.TCP.TcpClient) instance GHC.Generics.Generic (Data.ConnectionPool.Family.ConnectionPool Data.ConnectionPool.Internal.TCP.TcpClient) instance GHC.Generics.Generic Data.ConnectionPool.Internal.TCP.TcpClient instance Data.ConnectionPool.Internal.ConnectionPool.HasConnectionPool Data.ConnectionPool.Internal.HandlerParams.HandlerParams Network.Socket.Types.Socket Network.Socket.Types.SockAddr (Data.ConnectionPool.Family.ConnectionPool Data.ConnectionPool.Internal.TCP.TcpClient) instance Data.ConnectionPool.Class.ConnectionPoolFor Data.ConnectionPool.Internal.TCP.TcpClient -- | 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.Unix as Internal
--   
-- -- This package is OS specific, because Windows doesn't support UNIX -- Sockets. Please, bear this in mind when doing modifications. -- -- Module introduced in version 0.2. module Data.ConnectionPool.Internal.Unix -- | Family of connection pools parametrised by transport protocol. -- -- Definition changed 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. -- | Type tag used to specialize connection pool for UNIX Socket clients. -- -- Instance for Generic introduced in version 0.2. data UnixClient -- | Create connection pool for UNIX Sockets clients. createUnixClientPool :: ResourcePoolParams -> ClientSettingsUnix -> IO (ConnectionPool UnixClient) -- | Temporarily take a UNIX Sockets connection from a pool, run client -- with it, and return it to the pool afterwards. For details how -- connections are allocated see withResource. withUnixClientConnection :: (MonadBaseControl io m, io ~ IO) => ConnectionPool UnixClient -> (AppDataUnix -> m r) -> m r -- | Similar to withConnection, but only performs action if a UNIX -- Sockets 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. tryWithUnixClientConnection :: (MonadBaseControl io m, io ~ IO) => ConnectionPool UnixClient -> (AppDataUnix -> m r) -> m (Maybe r) -- | Destroy all UNIX Sockets 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. destroyAllUnixClientConnections :: ConnectionPool UnixClient -> IO () instance GHC.Generics.Constructor Data.ConnectionPool.Internal.Unix.C1_0R:ConnectionPool*UnixClient instance GHC.Generics.Datatype Data.ConnectionPool.Internal.Unix.D1R:ConnectionPool*UnixClient instance GHC.Generics.Datatype Data.ConnectionPool.Internal.Unix.D1UnixClient instance GHC.Show.Show (Data.ConnectionPool.Family.ConnectionPool Data.ConnectionPool.Internal.Unix.UnixClient) instance GHC.Generics.Generic (Data.ConnectionPool.Family.ConnectionPool Data.ConnectionPool.Internal.Unix.UnixClient) instance GHC.Generics.Generic Data.ConnectionPool.Internal.Unix.UnixClient instance Data.ConnectionPool.Internal.ConnectionPool.HasConnectionPool Data.ConnectionPool.Internal.HandlerParams.HandlerParams Network.Socket.Types.Socket () (Data.ConnectionPool.Family.ConnectionPool Data.ConnectionPool.Internal.Unix.UnixClient) instance Data.ConnectionPool.Class.ConnectionPoolFor Data.ConnectionPool.Internal.Unix.UnixClient -- | Connection pools for TCP clients and UNIX Socket clients, later is not -- supported on Windows. -- -- This package is built on top of resource-pool and -- streaming-commons packages. The later allows us to use -- conduit-extra package for implementing TCP and UNIX Sockets -- clients. Package conduit-extra defines appSource and -- appSink based on abstractions from streaming-commons -- package and they can be therefore reused. Difference between using -- conduit-extra or streaming-commons is that instead of -- using runTCPClient (or its lifted variant -- runGeneralTCPClient from conduit-extra) one would use -- withTcpClientConnection, and instead of runUnixClient -- it would be withUnixClientConnection. There is also more -- generic function named withConnection, which takes either -- ConnectionPool instance. module Data.ConnectionPool -- | Family of connection pools parametrised by transport protocol. -- -- Definition changed 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. -- | Parameters of resource pool that describe things like its internal -- structure. See createPool for details. -- -- Instance for Generic introduced in version 0.2. data ResourcePoolParams -- | Lens for accessing maximum number of resources to keep open per -- stripe. The smallest acceptable value is 1 (default). numberOfResourcesPerStripe :: Functor f => (Int -> f Int) -> ResourcePoolParams -> f ResourcePoolParams -- | Lens for accessing stripe count. The number of distinct sub-pools to -- maintain. The smallest acceptable value is 1 (default). numberOfStripes :: Functor f => (Int -> f Int) -> ResourcePoolParams -> f ResourcePoolParams -- | Lens for accessing amount of time for which an unused resource is kept -- open. The smallest acceptable value is 0.5 seconds (default). resourceIdleTimeout :: Functor f => (NominalDiffTime -> f NominalDiffTime) -> ResourcePoolParams -> f ResourcePoolParams -- | Check if all parameters for underlying resource pool are valid: -- -- -- -- For more details see createPool. -- -- Since version 0.1.1.0. validateResourcePoolParams :: ResourcePoolParams -> Either String ResourcePoolParams -- | Type tag used to specialize connection pool for TCP clients. -- -- Instance for Generic introduced in version 0.2. data TcpClient -- | Settings for a TCP client, specifying how to connect to the server. data ClientSettings :: * -- | The data passed to an Application. data AppData :: * -- | Create connection pool for TCP clients. createTcpClientPool :: ResourcePoolParams -> ClientSettings -> IO (ConnectionPool TcpClient) -- | 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. withTcpClientConnection :: (MonadBaseControl io m, io ~ IO) => ConnectionPool TcpClient -> (AppData -> m r) -> m 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. tryWithTcpClientConnection :: (MonadBaseControl io m, io ~ IO) => ConnectionPool TcpClient -> (AppData -> m r) -> m (Maybe r) -- | 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. destroyAllTcpClientConnections :: ConnectionPool TcpClient -> IO () -- | Type tag used to specialize connection pool for UNIX Socket clients. -- -- Instance for Generic introduced in version 0.2. data UnixClient -- | Settings for a Unix domain sockets client. data ClientSettingsUnix :: * -- | The data passed to a Unix domain sockets Application. data AppDataUnix :: * -- | Create connection pool for UNIX Sockets clients. createUnixClientPool :: ResourcePoolParams -> ClientSettingsUnix -> IO (ConnectionPool UnixClient) -- | Temporarily take a UNIX Sockets connection from a pool, run client -- with it, and return it to the pool afterwards. For details how -- connections are allocated see withResource. withUnixClientConnection :: (MonadBaseControl io m, io ~ IO) => ConnectionPool UnixClient -> (AppDataUnix -> m r) -> m r -- | Similar to withConnection, but only performs action if a UNIX -- Sockets 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. tryWithUnixClientConnection :: (MonadBaseControl io m, io ~ IO) => ConnectionPool UnixClient -> (AppDataUnix -> m r) -> m (Maybe r) -- | Destroy all UNIX Sockets 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. destroyAllUnixClientConnections :: ConnectionPool UnixClient -> IO () -- | Type class for common connection pool operations. It intentionally -- doesn't handle connection pool creation, which is best left to -- dedicated smart constructors. -- -- Since version 0.2. class ConnectionPoolFor (protocol :: k) where type family HandlerData protocol -- | Temporarily take a connection from a pool, run handler with it, and -- return it to the pool afterwards. -- -- Since version 0.2. withConnection :: (ConnectionPoolFor protocol, MonadBaseControl IO m) => ConnectionPool protocol -> (HandlerData protocol -> m r) -> m r -- | Similar to withConnection, but only performs action if a -- 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. tryWithConnection :: (ConnectionPoolFor protocol, MonadBaseControl IO m) => ConnectionPool protocol -> (HandlerData protocol -> m r) -> m (Maybe r) -- | 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. -- -- Since version 0.2. destroyAllConnections :: ConnectionPoolFor protocol => ConnectionPool protocol -> IO ()