haskey-0.2.0.0: A transactional, ACID compliant, embeddable key-value store.

Safe HaskellNone
LanguageHaskell2010

Database.Haskey.Alloc.Concurrent.Monad

Description

This module implements the ConcurrentT monad.

The ConcurrentT monad is used to implement a page allocator with concurrent readers and serialized writers.

Synopsis

Documentation

data ConcurrentHandles Source #

All necessary database handles.

Instances

Show ConcurrentHandles Source # 
ConcurrentMetaStoreM m => AllocReaderM (ConcurrentT WriterEnv ConcurrentHandles m) Source # 

Methods

readNode :: (Key key, Value val) => Height height -> NodeId height key val -> ConcurrentT WriterEnv ConcurrentHandles m (Node height key val) #

readOverflow :: Value val => OverflowId -> ConcurrentT WriterEnv ConcurrentHandles m val #

ConcurrentMetaStoreM m => AllocReaderM (ConcurrentT ReaderEnv ConcurrentHandles m) Source # 

Methods

readNode :: (Key key, Value val) => Height height -> NodeId height key val -> ConcurrentT ReaderEnv ConcurrentHandles m (Node height key val) #

readOverflow :: Value val => OverflowId -> ConcurrentT ReaderEnv ConcurrentHandles m val #

(ConcurrentMetaStoreM m, MonadIO m) => AllocM (ConcurrentT WriterEnv ConcurrentHandles m) Source # 

concurrentHandles :: FilePath -> ConcurrentHandles Source #

Construct a set of ConcurrentHandles from a root directory.

newtype ConcurrentT env hnd m a Source #

Monad in which page allocations can take place.

The monad has access to a ConcurrentMetaStoreM back-end which manages can store and retreive the corresponding metadata.

Constructors

ConcurrentT 

Fields

Instances

Monad m => MonadState (env hnd) (ConcurrentT env hnd m) Source # 

Methods

get :: ConcurrentT env hnd m (env hnd) #

put :: env hnd -> ConcurrentT env hnd m () #

state :: (env hnd -> (a, env hnd)) -> ConcurrentT env hnd m a #

MonadTrans (ConcurrentT env hnd) Source # 

Methods

lift :: Monad m => m a -> ConcurrentT env hnd m a #

Monad m => Monad (ConcurrentT env hnd m) Source # 

Methods

(>>=) :: ConcurrentT env hnd m a -> (a -> ConcurrentT env hnd m b) -> ConcurrentT env hnd m b #

(>>) :: ConcurrentT env hnd m a -> ConcurrentT env hnd m b -> ConcurrentT env hnd m b #

return :: a -> ConcurrentT env hnd m a #

fail :: String -> ConcurrentT env hnd m a #

Functor m => Functor (ConcurrentT env hnd m) Source # 

Methods

fmap :: (a -> b) -> ConcurrentT env hnd m a -> ConcurrentT env hnd m b #

(<$) :: a -> ConcurrentT env hnd m b -> ConcurrentT env hnd m a #

Monad m => Applicative (ConcurrentT env hnd m) Source # 

Methods

pure :: a -> ConcurrentT env hnd m a #

(<*>) :: ConcurrentT env hnd m (a -> b) -> ConcurrentT env hnd m a -> ConcurrentT env hnd m b #

(*>) :: ConcurrentT env hnd m a -> ConcurrentT env hnd m b -> ConcurrentT env hnd m b #

(<*) :: ConcurrentT env hnd m a -> ConcurrentT env hnd m b -> ConcurrentT env hnd m a #

MonadIO m => MonadIO (ConcurrentT env hnd m) Source # 

Methods

liftIO :: IO a -> ConcurrentT env hnd m a #

MonadThrow m => MonadThrow (ConcurrentT env hnd m) Source # 

Methods

throwM :: Exception e => e -> ConcurrentT env hnd m a #

MonadCatch m => MonadCatch (ConcurrentT env hnd m) Source # 

Methods

catch :: Exception e => ConcurrentT env hnd m a -> (e -> ConcurrentT env hnd m a) -> ConcurrentT env hnd m a #

MonadMask m => MonadMask (ConcurrentT env hnd m) Source # 

Methods

mask :: ((forall a. ConcurrentT env hnd m a -> ConcurrentT env hnd m a) -> ConcurrentT env hnd m b) -> ConcurrentT env hnd m b #

uninterruptibleMask :: ((forall a. ConcurrentT env hnd m a -> ConcurrentT env hnd m a) -> ConcurrentT env hnd m b) -> ConcurrentT env hnd m b #

ConcurrentMetaStoreM m => AllocReaderM (ConcurrentT WriterEnv ConcurrentHandles m) Source # 

Methods

readNode :: (Key key, Value val) => Height height -> NodeId height key val -> ConcurrentT WriterEnv ConcurrentHandles m (Node height key val) #

readOverflow :: Value val => OverflowId -> ConcurrentT WriterEnv ConcurrentHandles m val #

ConcurrentMetaStoreM m => AllocReaderM (ConcurrentT ReaderEnv ConcurrentHandles m) Source # 

Methods

readNode :: (Key key, Value val) => Height height -> NodeId height key val -> ConcurrentT ReaderEnv ConcurrentHandles m (Node height key val) #

readOverflow :: Value val => OverflowId -> ConcurrentT ReaderEnv ConcurrentHandles m val #

(ConcurrentMetaStoreM m, MonadIO m) => AllocM (ConcurrentT WriterEnv ConcurrentHandles m) Source # 

runConcurrentT :: ConcurrentMetaStoreM m => ConcurrentT env ConcurrentHandles m a -> env ConcurrentHandles -> m (a, env ConcurrentHandles) Source #

Run the actions in an ConcurrentT monad, given a reader or writer environment.

evalConcurrentT :: ConcurrentMetaStoreM m => ConcurrentT env ConcurrentHandles m a -> env ConcurrentHandles -> m a Source #

Evaluate the actions in an ConcurrentT monad, given a reader or writer environment.