Copyright | (c) 2014, Peter Trško |
---|---|
License | BSD3 |
Maintainer | peter.trsko@gmail.com |
Stability | unstable (internal module) |
Portability | DeriveDataTypeable, NoImplicitPrelude, RecordWildCards |
Safe Haskell | Safe-Inferred |
Language | Haskell2010 |
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.
- data ResourcePoolParams = ResourcePoolParams {}
- numberOfResourcesPerStripe :: Functor f => (Int -> f Int) -> ResourcePoolParams -> f ResourcePoolParams
- numberOfStripes :: Functor f => (Int -> f Int) -> ResourcePoolParams -> f ResourcePoolParams
- resourceIdleTimeout :: Functor f => (NominalDiffTime -> f NominalDiffTime) -> ResourcePoolParams -> f ResourcePoolParams
- validateResourcePoolParams :: ResourcePoolParams -> Either String ResourcePoolParams
ResourcePoolParams
data ResourcePoolParams Source
Parameters of resource pool that describe things like its internal
structure. See createPool
for details.
Lenses
numberOfResourcesPerStripe :: Functor f => (Int -> f Int) -> ResourcePoolParams -> f ResourcePoolParams Source
Lens for accessing maximum number of resources to keep open per stripe. The smallest acceptable value is 1 (default).
numberOfStripes :: Functor f => (Int -> f Int) -> ResourcePoolParams -> f ResourcePoolParams Source
Lens for accessing stripe count. The number of distinct sub-pools to maintain. The smallest acceptable value is 1 (default).
resourceIdleTimeout :: Functor f => (NominalDiffTime -> f NominalDiffTime) -> ResourcePoolParams -> f ResourcePoolParams Source
Lens for accessing amount of time for which an unused resource is kept open. The smallest acceptable value is 0.5 seconds (default).
Validation
validateResourcePoolParams Source
:: ResourcePoolParams | Parameters to validate. |
-> Either String ResourcePoolParams | Either error message or the same value of |
Check if all parameters for underlying resource pool are valid:
Number of connection sub-pools. Keeping it set tonumberOfStripes
>= 11
is good for most applications.
Maximum number of connections in each stripe. Totally there can benumberOfResourcesPerStripe
>= 1
open connections simultaneously.numberOfStripes
*numberOfResourcesPerStripe
Property specified for how long connection will be kept alive after it is released by back to the pool before it is automatically closed. Value is in seconds.resourceIdleTimeout
>= 0.5
For more details see createPool
.
Since version 0.1.1.0.