Transactional, type-indexed implementation of server-side state.
Glossary
A transactional entity (TE) is a named multi-versioned global variable.
- data T a
- init :: (Types a, Read a, Show a) => String -> a -> TCGI b (T a)
- create :: (Read a, Show a, Types a) => a -> TCGI b (T a)
- remove :: Types a => T a -> TCGI b ()
- get :: (Read a, Show a) => T a -> TCGI b a
- set :: (Read a, Show a) => T a -> a -> TCGI b ()
- with :: (WithMonad cgi, Read result, Show result) => result -> (result -> cgi ()) -> (Control (TCGI result) result -> TCGI result ()) -> cgi ()
- data Control cgi result = Control {}
- data TCGI b a
Documentation
init :: (Types a, Read a, Show a) => String -> a -> TCGI b (T a)Source
Attempt to create a new tv n
and set its initial value. Returns handle to
the variable. If the variable already exists, then just returns the handle.
create :: (Read a, Show a, Types a) => a -> TCGI b (T a)Source
Create a fresh transactional variable with an initial value and return its handle. Performs a physical write to ensure that the variable's name is unique. Locks the transaction directory during the write operation.
remove :: Types a => T a -> TCGI b ()Source
Remove a transactional variable. Subsequent read accesses to this variable will make the transaction fail. May throw an exception if the variable is not present.
set :: (Read a, Show a) => T a -> a -> TCGI b ()Source
Write to a transactional variable through typed handle. Only affects the log, no physical write happens. Checks physically for existence of the variable (but tries the log first). Raises exception if it does not exist.
with :: (WithMonad cgi, Read result, Show result) => result -> (result -> cgi ()) -> (Control (TCGI result) result -> TCGI result ()) -> cgi ()Source