arena-0.1: A journaled data store

Safe HaskellNone




newtype ArenaLocation Source

The base directory for the arena files to be stored under.



data ArenaT s f d m a Source

  • s: The summary semigroup for the journal data.
  • f: The finalized summary associated with a datablock.
  • d: The user's datatype stored in the arena.


MonadTrans (ArenaT s f d) Source 
Monad m => MonadReader (ArenaDB s f d) (ArenaT s f d m) Source 
Monad m => Monad (ArenaT s f d m) Source 
Functor m => Functor (ArenaT s f d m) Source 
Applicative m => Applicative (ArenaT s f d m) Source 
MonadIO m => MonadIO (ArenaT s f d m) Source 

type Arena s f d a = ArenaT s f d IO a Source

data ArenaDB summary finalized d Source


Monad m => MonadReader (ArenaDB s f d) (ArenaT s f d m) Source 

runArenaT :: ArenaDB s f d -> ArenaT s f d m a -> m a Source

runArena :: ArenaDB s f d -> Arena s f d a -> IO a Source

startArena :: (Serial d, Serial f, Semigroup s) => (d -> s) -> (s -> f) -> (s -> Bool) -> ArenaLocation -> IO (ArenaDB s f d) Source

Launch an ArenaDB, using the given summarizing, finalizing, and block policy functions, at the given ArenaLocation.

NB: Two ArenaDBs must not be run concurrently with a shared ArenaLocation. Data loss from the journal is likely to result.

initArena :: ArenaLocation -> IO () Source

Setup the directory structure for Arena. This is performed implicitly by startArena.

addData :: (MonadIO m, Serial d, Serial f, Semigroup s) => d -> ArenaT s f d m () Source

Durably insert a piece of data into the ArenaDB. This funtion returns after the data is sync'd to disk.

accessData :: MonadIO m => ArenaT s f d m [(f, IO [d])] Source

Access an atomic snapshot of the ArenaDB as a list of summaries and accessors for their associated data. One datablock is the journal, and thus does not satisfy the block policy.

The returned IO actions in the list provide access to a state consistent with the time when the list of accessors was returned, but do not hold more then the journal at that time's contents in memory.