registry-0.2.0.3: data structure for assembling components
Safe HaskellNone
LanguageHaskell2010

Data.Registry.Warmup

Description

This module contains data structures to describe the "warming-up" of componnts in order to ensure that they are properly configured:

  • createWarmup creates a warmup from an action returning a Result
  • warmupOf takes a component name and unit action then just checks that the action executes without exception
Synopsis

Documentation

newtype Warmup Source #

A list of actions to run at startup

Constructors

Warmup 

Fields

Instances

Instances details
Semigroup Warmup Source # 
Instance details

Defined in Data.Registry.Warmup

Monoid Warmup Source # 
Instance details

Defined in Data.Registry.Warmup

Creation functions

warmupOf :: Typeable a => a -> IO () -> Warmup Source #

Create a warmup action for a given component The type of the component is used as the description for the action to execute

createWarmup :: IO Result -> Warmup Source #

Create a Warmup from an IO action returning a Result

declareWarmup :: Typeable a => a -> Warmup Source #

Create a Warmup with no action but just the type of a component

data Result Source #

Result of a Warmup

Constructors

Empty 
Ok [Text] 
Failed [Text] 

Instances

Instances details
Eq Result Source # 
Instance details

Defined in Data.Registry.Warmup

Methods

(==) :: Result -> Result -> Bool #

(/=) :: Result -> Result -> Bool #

Show Result Source # 
Instance details

Defined in Data.Registry.Warmup

Semigroup Result Source # 
Instance details

Defined in Data.Registry.Warmup

Monoid Result Source # 
Instance details

Defined in Data.Registry.Warmup

isSuccess :: Result -> Bool Source #

Return True if a Warmup was successful

ok :: Text -> Result Source #

Create a successful Result

failed :: Text -> Result Source #

Create a failed Result

messages :: Result -> [Text] Source #

Extract the list of all the messages from a Result

Run functions

runWarmup :: Warmup -> IO Result Source #

Simple sequential warmup strategy

runBoth :: IO Result -> IO Result -> IO Result Source #

runBoth runs both tasks and cumulate the results exceptions are being transformed into Failed results