registry-0.1.2.6: data structure for assembling components

Safe HaskellNone
LanguageHaskell2010

Data.Registry.Warmup

Contents

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 #

A list of actions to run at startup

Constructors

Warmup 

Fields

Instances
Semigroup Warmup # 
Instance details

Defined in Data.Registry.Warmup

Monoid Warmup # 
Instance details

Defined in Data.Registry.Warmup

Creation functions

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

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 #

Create a Warmup from an IO action returning a Result

noWarmup :: Warmup #

The empty Warmup

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

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

data Result #

Result of a Warmup

Constructors

Empty 
Ok [Text] 
Failed [Text] 
Instances
Eq Result # 
Instance details

Defined in Data.Registry.Warmup

Methods

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

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

Show Result # 
Instance details

Defined in Data.Registry.Warmup

Semigroup Result # 
Instance details

Defined in Data.Registry.Warmup

Monoid Result # 
Instance details

Defined in Data.Registry.Warmup

isSuccess :: Result -> Bool #

Return True if a Warmup was successful

ok :: Text -> Result #

Create a successful Result

failed :: Text -> Result #

Create a failed Result

messages :: Result -> [Text] #

Extract the list of all the messages from a Result

Run functions

runWarmup :: Warmup -> IO Result #

Simple sequential warmup strategy

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

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