Copyright | (c) Max Amanshauser 2016 |
---|---|
License | MIT |
Maintainer | max@lambdalifting.org |
Safe Haskell | None |
Language | Haskell2010 |
This is the interface through which you primarily interact with a FSM from the rest of your program.
- data FSMHandle st wal k s e a where
- get :: forall st wal k s e a. FSMStore st k s e a => FSMHandle st wal k s e a -> k -> IO (Maybe s)
- post :: forall st wal k s e a. FSMStore st k s e a => FSMHandle st wal k s e a -> k -> s -> IO Bool
- patch :: forall st wal k s e a. (FSMStore st k s e a, MealyInstance k s e a, FSMKey k) => FSMHandle st wal k s e a -> k -> [Msg e] -> IO Bool
- recover :: forall st wal k s e a. (FSMStore st k s e a, MealyInstance k s e a, FSMKey k) => FSMHandle st wal k s e a -> k -> IO ()
- recoverAll :: forall st wal k s e a. MealyInstance k s e a => FSMHandle st wal k s e a -> IO ()
- upsert :: forall st wal k s e a. MealyInstance k s e a => FSMStore st k s e a => FSMHandle st wal k s e a -> k -> s -> [Msg e] -> IO ()
Documentation
data FSMHandle st wal k s e a where Source #
FSMHandle :: (Eq s, Eq e, Eq a, FSMStore st k s e a, WALStore wal k, FSMKey k) => {..} -> FSMHandle st wal k s e a | |
|
get :: forall st wal k s e a. FSMStore st k s e a => FSMHandle st wal k s e a -> k -> IO (Maybe s) Source #
post :: forall st wal k s e a. FSMStore st k s e a => FSMHandle st wal k s e a -> k -> s -> IO Bool Source #
Idempotent because of usage of caller-generated keys.
patch :: forall st wal k s e a. (FSMStore st k s e a, MealyInstance k s e a, FSMKey k) => FSMHandle st wal k s e a -> k -> [Msg e] -> IO Bool Source #
Concurrent updates will be serialised by Postgres. Returns True when the state transition has been successfully computed and actions have been scheduled. Returns False on failure.
recover :: forall st wal k s e a. (FSMStore st k s e a, MealyInstance k s e a, FSMKey k) => FSMHandle st wal k s e a -> k -> IO () Source #
Recovering is the process of asynchronously applying Actions. It is performed immediately after the synchronous part of an update and, on failure, retried until it succeeds or the retry limit is hit.
recoverAll :: forall st wal k s e a. MealyInstance k s e a => FSMHandle st wal k s e a -> IO () Source #
During certain long-lasting failures, like network outage, the retry limit of Actions will be exhausted. You should regularly, e.g. ever 10 minutes, call this function to clean up those hard cases.