happstack-state-0.5.1: Event-based distributed state.

Happstack.State

Contents

Synopsis

ACID monad

data Ev m t Source

Monad for ACID event handlers.

type AnyEv a = forall t. (Monad (t STM), MonadTrans t) => Ev (t STM) aSource

ACID computations that work with any state and event types.

query :: (MonadIO m, QueryEvent ev res) => ev -> m resSource

Emit a state query and wait for the result.

update :: (MonadIO m, UpdateEvent ev res) => ev -> m resSource

Schedule an update and wait for it to complete. When this function returns, you're guaranteed the update will be persistent.

type Update state = Ev (StateT state STM)Source

type Query state = Ev (ReaderT state STM)Source

Types

data Saver Source

Constructors

NullSaver

A saver that discards all output

FileSaver String

A saver that operates on files. The parameter is the prefix for the files.

Queue Saver

Enable queueing.

Memory (MVar Store) 

Misc utilities

getTime :: Integral epochTime => AnyEv epochTimeSource

Serialization

runTxSystem :: (Methods st, Component st) => Saver -> Proxy st -> IO (MVar TxControl)Source

Run the MACID system without multimaster support and with the given Saver.

shutdownSystem :: MVar TxControl -> IO ()Source

Shuts down a transaction system

Unsafe things