Safe Haskell | None |
---|---|
Language | Haskell2010 |
- newtype ArenaLocation = ArenaLocation {}
- data ArenaT s f d m a
- type Arena s f d a = ArenaT s f d IO a
- data ArenaDB summary finalized d
- runArenaT :: ArenaDB s f d -> ArenaT s f d m a -> m a
- runArena :: ArenaDB s f d -> Arena s f d a -> IO a
- startArena :: (Serial d, Serial f, Semigroup s) => (d -> s) -> (s -> f) -> (s -> Bool) -> ArenaLocation -> IO (ArenaDB s f d)
- initArena :: ArenaLocation -> IO ()
- addData :: (MonadIO m, Serial d, Serial f, Semigroup s) => d -> ArenaT s f d m ()
- accessData :: MonadIO m => ArenaT s f d m [(f, IO [d])]
Documentation
newtype ArenaLocation Source
The base directory for the arena files to be stored under.
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.
data ArenaDB summary finalized d Source
Monad m => MonadReader (ArenaDB s f d) (ArenaT s f d m) 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 ArenaDB
s 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.