-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | Lightweight library for waiting on networked services to become available. -- -- Please see the README on GitHub at -- https://github.com/mbg/network-wait#readme @package network-wait @version 0.1.2.0 -- | This module contains computations which wait for some networked -- service to become available, subject to some retry policy from -- Control.Retry. The waitSocketWith function is the most -- general function exported by this module, but several variants exist -- for convenience. You may wish to start out with e.g. waitTcp or -- waitSocket initially and move on to the more feature-rich -- variants if you need their functionality. module Network.Wait -- | waitTcp retryPolicy hostName serviceName is a variant -- of waitTcpWith which does not install any additional handlers. -- --
-- waitTcp retryPolicyDefault "localhost" "80" --waitTcp :: (MonadIO m, MonadMask m) => RetryPolicyM m -> HostName -> ServiceName -> m () -- | waitTcpVerbose outputHandler retryPolicy addrInfo is a -- variant of waitTcpVerboseFormat which catches all exceptions -- derived from SomeException and formats retry attempt -- information using defaultLogMsg before passing the resulting -- String to out. -- --
-- waitTcpVerbose putStrLn retryPolicyDefault "localhost" "80" --waitTcpVerbose :: (MonadIO m, MonadMask m) => (String -> m ()) -> RetryPolicyM m -> HostName -> ServiceName -> m () -- | waitTcpVerboseFormat outputHandler retryPolicy -- addrInfo is a variant of waitTcpWith which installs an -- extra handler based on logRetries which passes status -- information for each retry attempt to outputHandler. -- --
-- waitTcpVerboseFormat @SomeException -- (\b ex st -> putStrLn $ defaultLogMsg b ex st) -- retryPolicyDefault "localhost" "80" --waitTcpVerboseFormat :: forall e m. (MonadIO m, MonadMask m, Exception e) => (Bool -> e -> RetryStatus -> m ()) -> RetryPolicyM m -> HostName -> ServiceName -> m () -- | waitTcpWith extraHandlers retryPolicy hostName -- serviceName is a variant of waitSocketWith which -- constructs a suitable AddrInfo value for a TCP socket from -- hostName and serviceName. waitTcpWith :: (MonadIO m, MonadMask m) => [RetryStatus -> Handler m Bool] -> RetryPolicyM m -> HostName -> ServiceName -> m () -- | waitSocket retryPolicy addrInfo is a variant of -- waitSocketWith which does not install any additional exception -- handlers. waitSocket :: (MonadIO m, MonadMask m) => RetryPolicyM m -> AddrInfo -> m () -- | waitSocketVerbose outputHandler retryPolicy addrInfo -- is a variant of waitSocketVerboseFormat which catches all -- exceptions derived from SomeException and formats retry attempt -- information using defaultLogMsg before passing the resulting -- String to out. waitSocketVerbose :: (MonadIO m, MonadMask m) => (String -> m ()) -> RetryPolicyM m -> AddrInfo -> m () -- | waitSocketVerboseFormat outputHandler retryPolicy -- addrInfo is a variant of waitSocketWith which installs an -- extra handler based on logRetries which passes status -- information for each retry attempt to outputHandler. waitSocketVerboseFormat :: forall e m. (MonadIO m, MonadMask m, Exception e) => (Bool -> e -> RetryStatus -> m ()) -> RetryPolicyM m -> AddrInfo -> m () -- | waitSocketWith extraHandlers retryPolicy addrInfo will -- attempt to connect to addrInfo. If the connection fails, -- retryPolicy is used to determine whether (and how often) this -- function should attempt to retry establishing the connection. By -- default, this function will retry after all exceptions (except for -- those given by skipAsyncExceptions). This behaviour may be -- customised with extraHandlers which are installed after -- skipAsyncExceptions, but before the default exception handler. -- The extraHandlers may also be used to report retry attempts -- to e.g. the standard output or a logger. waitSocketWith :: (MonadIO m, MonadMask m) => [RetryStatus -> Handler m Bool] -> RetryPolicyM m -> AddrInfo -> m () -- | recoveringWith extraHandlers retryPolicy action will -- attempt to run action. If the action fails, -- retryPolicy is used to determine whether (and how often) this -- function should attempt to retry action. By default, this -- function will retry after all exceptions (except for those given by -- skipAsyncExceptions). This behaviour may be customised with -- extraHandlers which are installed after -- skipAsyncExceptions, but before the default exception handler. -- The extraHandlers may also be used to report retry attempts -- to e.g. the standard output or a logger. recoveringWith :: (MonadIO m, MonadMask m) => [RetryStatus -> Handler m Bool] -> RetryPolicyM m -> m () -> m ()