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.Streaming

Contents

Description

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.

Synopsis

TCP

acquireTcpClientConnection :: ClientSettings -> IO (Socket, SockAddr) Source #

Wrapper for getSocketFamilyTCP that takes ClientSettings instead of individual parameters.

runTcpApp Source #

Arguments

:: Maybe SockAddr 
-> (AppData -> m r) 
-> HandlerParams

Parameters passed down to connection handler (AppData -> m r) as part of definition of AppData. Since version 0.1.3.

-> Socket 
-> SockAddr 
-> m r 

Wrapper for runTcpAppImpl with a type signature that is more natural for implementing a TCP specific withConnection.

Definition changed in version 0.1.3 and 0.2.1.

runTcpAppImpl Source #

Arguments

:: Maybe SockAddr 
-> Socket 
-> SockAddr 
-> Int

Buffer size used while reading from socket. Since version 0.1.3.

-> (AppData -> m r) 
-> 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 and 0.2.1.

fromClientSettings :: ClientSettings -> HandlerParams Source #

Construct HandlerParams that are passed to individual TCP connection handlers.

Since version 0.1.3.

Unix Socket

runUnixApp Source #

Arguments

:: (AppDataUnix -> m r) 
-> HandlerParams

Parameters passed down to connection handler (AppDataUnix -> m r) as part of definition of AppDataUnix. Since version 0.1.3.

-> Socket 
-> () 
-> m r 

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 and 0.2.1.

runUnixAppImpl Source #

Arguments

:: Socket 
-> Int

Buffer size used while reading from socket. Since version 0.1.3.

-> (AppDataUnix -> m r) 
-> 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 and 0.2.1.

fromClientSettingsUnix :: ClientSettingsUnix -> HandlerParams Source #

Construct HandlerParams that are passed to individual UNIX socket connection handlers.

Since version 0.1.3.

Socket

close :: Socket -> IO () Source #

Compatibility wrapper around close/sClose.

Package network deprecated sClose in favour of close in version 2.4.0.0.

Since version 0.2.2.