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

Safe HaskellNone
LanguageHaskell2010

Database.Haskey.Alloc.Concurrent.Internal.Environment

Description

Environments of a read or write transaction.

Synopsis

Documentation

data StateType #

Constructors

TypeData 
TypeIndex 

data S (t :: StateType) a where #

Wrapper around a type to indicate it belongs to a file with either data/leaf nodes or index nodes.

Constructors

DataState :: a -> S TypeData a 
IndexState :: a -> S TypeIndex a 
Instances
Functor (S t) # 
Instance details

Defined in Database.Haskey.Alloc.Concurrent.Internal.Environment

Methods

fmap :: (a -> b) -> S t a -> S t b #

(<$) :: a -> S t b -> S t a #

Show a => Show (S t a) # 
Instance details

Defined in Database.Haskey.Alloc.Concurrent.Internal.Environment

Methods

showsPrec :: Int -> S t a -> ShowS #

show :: S t a -> String #

showList :: [S t a] -> ShowS #

Binary a => Binary (S TypeData a) # 
Instance details

Defined in Database.Haskey.Alloc.Concurrent.Internal.Environment

Methods

put :: S TypeData a -> Put #

get :: Get (S TypeData a) #

putList :: [S TypeData a] -> Put #

Binary a => Binary (S TypeIndex a) # 
Instance details

Defined in Database.Haskey.Alloc.Concurrent.Internal.Environment

Methods

put :: S TypeIndex a -> Put #

get :: Get (S TypeIndex a) #

putList :: [S TypeIndex a] -> Put #

getSValue :: S t a -> a #

newtype ReaderEnv hnds #

Constructors

ReaderEnv 

Fields

data FileState stateType #

Constructors

FileState 

Fields

data WriterEnv hnds #

Constructors

WriterEnv 

Fields

newtype NewlyFreed #

Wrapper around PageId indicating it is newly free'd and cannot be reused in the same transaction.

Constructors

NewlyFreed PageId 

newtype FreePage #

Wrapper around PageId indicating it is free and can be reused in any transaction.

Constructors

FreePage PageId 

newtype Dirty #

Wrapper around PageId indicating that it is dirty, i.e. written to in this transaction.

Constructors

Dirty PageId 

freePage :: (Functor m, MonadState (WriterEnv hnd) m) => S stateType PageId -> m () #

Try to free a page, given a set of dirty pages.

If the page was dirty, a FreePage page is added to the environment, if not a NewlyFreed page is added to the environment.

Btw, give me lenses...

updateFileState :: FileState t -> (forall a. a -> S t a) -> Maybe Dirty -> PageId -> FileState t #

dirty :: (Functor m, MonadState (WriterEnv hnd) m) => S stateType PageId -> m (Maybe Dirty) #

Get a Dirty page, by first proving it is in fact dirty.

touchPage :: MonadState (WriterEnv hnd) m => S stateType PageId -> m () #

Touch a fresh page, make it dirty.

We really need lenses...

touchOverflow :: MonadState (WriterEnv hnd) m => OverflowId -> m () #

Touch a fresh overflow page, making it dirty.

overflowType :: MonadState (WriterEnv hnd) m => OverflowId -> m (Either DirtyOverflow OldOverflow) #

Get the type of the overflow page.

removeOldOverflow :: MonadState (WriterEnv hdn) m => OldOverflow -> m () #

Free an old overflow page.