jobqueue-0.0.15: A job queue library

Safe HaskellNone
LanguageHaskell98

Network.JobQueue.Action

Synopsis

Documentation

buildActionState :: (Env e, Unit a) => JobM e a () -> IO (JobActionState e a) Source

runActionState :: (Env e, Unit a) => JobActionState e a -> e -> a -> IO (Maybe (JobResult a)) Source

runAction :: (Env e, Unit a) => e -> a -> ActionM e a () -> IO (Maybe (JobResult a)) Source

getEnv :: (Env e, Unit a) => ActionM e a e Source

Get environment in action.

param :: (ParamEnv e, Unit a, Read b) => (String, String) -> ActionM e a b Source

Get a parameter value with a key from the environment in action. This is a special function for ParamEnv.

result :: (Env e, Unit a) => Maybe (JobResult a) -> ActionM e a () Source

Set the result of the action. (for internal use)

next Source

Arguments

:: (Env e, Unit a) 
=> a

the next state

-> ActionM e a () 

Move to the next state immediately. After the execution of the action the job being processed will be moved to the given state. The next action will be invoked immediately and can continue to work without being interrupted by another job.

fin :: (Env e, Unit a) => ActionM e a () Source

Finish a job.

none :: (Env e, Unit a) => ActionM e a () Source

If the unit passed by the job queue system cannot be processed by the action function, the function should call this.

fork Source

Arguments

:: (Env e, Unit a) 
=> a

a unit

-> ActionM e a () 

Create a job with a unit and schedule it.

forkInTime :: (Env e, Unit a) => NominalDiffTime -> a -> ActionM e a () Source

Create a job with a unit and schedule it after a few micro seconds.

forkOnTime Source

Arguments

:: (Env e, Unit a) 
=> UTCTime

absolute time in UTC

-> a

a unit

-> ActionM e a () 

Create a job with a unit and schedule it at a specific time.

abort :: (Env e, Unit a) => Alert -> String -> ActionM e a b Source

Abort the execution of a state machine. If a critical problem is found and there is a need to switch to the failure state, call this function with a human readable meassage.

logMsg :: (Env e, Unit a) => Alert -> String -> ActionM e a () Source

Put a message to syslog daemon.

commitIO :: (Env e, Unit a) => IO b -> ActionM e a b Source

Do a dirty I/O action to the external system. If it doesn't change the state of the external system, you can use liftIO instead.

data Alert Source

Constructors

Critical 
Error 
Warning 
Notice 
Info 

Instances