Safe Haskell | None |
---|---|
Language | Haskell2010 |
Environments of a read or write transaction.
Synopsis
- data StateType
- data S (t :: StateType) a where
- getSValue :: S t a -> a
- newtype ReaderEnv hnds = ReaderEnv {
- readerHnds :: hnds
- data FileState stateType = FileState {
- fileStateNewlyFreedPages :: ![NewlyFreed]
- fileStateOriginalNumPages :: !(S stateType PageId)
- fileStateNewNumPages :: !(S stateType PageId)
- fileStateDirtyPages :: !(Set PageId)
- fileStateFreeTree :: !(S stateType FreeTree)
- fileStateCachedFreePages :: !(S stateType [FreePage])
- data WriterEnv hnds = WriterEnv {
- writerHnds :: !hnds
- writerTxId :: !TxId
- writerReaders :: Map TxId Integer
- writerIndexFileState :: FileState TypeIndex
- writerDataFileState :: FileState TypeData
- writerQueryFreeTreeOn :: !Bool
- writerDirtyOverflows :: !(Set DirtyOverflow)
- writerOverflowCounter :: !Word32
- writerRemovedOverflows :: ![OldOverflow]
- newWriter :: hnd -> TxId -> Map TxId Integer -> S TypeData PageId -> S TypeIndex PageId -> S TypeData [FreePage] -> S TypeIndex [FreePage] -> S TypeData FreeTree -> S TypeIndex FreeTree -> WriterEnv hnd
- newtype NewlyFreed = NewlyFreed PageId
- newtype FreePage = FreePage PageId
- newtype Dirty = Dirty PageId
- freePage :: (Functor m, MonadState (WriterEnv hnd) m) => S stateType PageId -> m ()
- 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)
- touchPage :: MonadState (WriterEnv hnd) m => S stateType PageId -> m ()
- newtype DirtyOverflow = DirtyOverflow OverflowId
- newtype OldOverflow = OldOverflow OverflowId
- touchOverflow :: MonadState (WriterEnv hnd) m => OverflowId -> m ()
- overflowType :: MonadState (WriterEnv hnd) m => OverflowId -> m (Either DirtyOverflow OldOverflow)
- removeOldOverflow :: MonadState (WriterEnv hdn) m => OldOverflow -> m ()
Documentation
data S (t :: StateType) a where Source #
Wrapper around a type to indicate it belongs to a file with either data/leaf nodes or index nodes.
newtype ReaderEnv hnds Source #
ReaderEnv | |
|
Instances
ConcurrentMetaStoreM m => AllocReaderM (ConcurrentT ReaderEnv ConcurrentHandles m) Source # | |
Defined in Database.Haskey.Alloc.Concurrent.Internal.Monad 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 # |
data FileState stateType Source #
FileState | |
|
WriterEnv | |
|
Instances
newWriter :: hnd -> TxId -> Map TxId Integer -> S TypeData PageId -> S TypeIndex PageId -> S TypeData [FreePage] -> S TypeIndex [FreePage] -> S TypeData FreeTree -> S TypeIndex FreeTree -> WriterEnv hnd Source #
Create a new writer.
newtype NewlyFreed Source #
Wrapper around PageId
indicating it is newly free'd and cannot be reused
in the same transaction.
Instances
Eq NewlyFreed Source # | |
Defined in Database.Haskey.Alloc.Concurrent.Internal.Environment (==) :: NewlyFreed -> NewlyFreed -> Bool # (/=) :: NewlyFreed -> NewlyFreed -> Bool # | |
Ord NewlyFreed Source # | |
Defined in Database.Haskey.Alloc.Concurrent.Internal.Environment compare :: NewlyFreed -> NewlyFreed -> Ordering # (<) :: NewlyFreed -> NewlyFreed -> Bool # (<=) :: NewlyFreed -> NewlyFreed -> Bool # (>) :: NewlyFreed -> NewlyFreed -> Bool # (>=) :: NewlyFreed -> NewlyFreed -> Bool # max :: NewlyFreed -> NewlyFreed -> NewlyFreed # min :: NewlyFreed -> NewlyFreed -> NewlyFreed # | |
Show NewlyFreed Source # | |
Defined in Database.Haskey.Alloc.Concurrent.Internal.Environment showsPrec :: Int -> NewlyFreed -> ShowS # show :: NewlyFreed -> String # showList :: [NewlyFreed] -> ShowS # |
Wrapper around PageId
indicating it is free and can be reused in any
transaction.
Wrapper around PageId
indicating that it is dirty, i.e. written to in
this transaction.
freePage :: (Functor m, MonadState (WriterEnv hnd) m) => S stateType PageId -> m () Source #
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 Source #
dirty :: (Functor m, MonadState (WriterEnv hnd) m) => S stateType PageId -> m (Maybe Dirty) Source #
Get a Dirty
page, by first proving it is in fact dirty.
touchPage :: MonadState (WriterEnv hnd) m => S stateType PageId -> m () Source #
Touch a fresh page, make it dirty.
We really need lenses...
newtype DirtyOverflow Source #
Wrapper around OverflowId
indicating that it is dirty.
Instances
Eq DirtyOverflow Source # | |
Defined in Database.Haskey.Alloc.Concurrent.Internal.Environment (==) :: DirtyOverflow -> DirtyOverflow -> Bool # (/=) :: DirtyOverflow -> DirtyOverflow -> Bool # | |
Ord DirtyOverflow Source # | |
Defined in Database.Haskey.Alloc.Concurrent.Internal.Environment compare :: DirtyOverflow -> DirtyOverflow -> Ordering # (<) :: DirtyOverflow -> DirtyOverflow -> Bool # (<=) :: DirtyOverflow -> DirtyOverflow -> Bool # (>) :: DirtyOverflow -> DirtyOverflow -> Bool # (>=) :: DirtyOverflow -> DirtyOverflow -> Bool # max :: DirtyOverflow -> DirtyOverflow -> DirtyOverflow # min :: DirtyOverflow -> DirtyOverflow -> DirtyOverflow # | |
Show DirtyOverflow Source # | |
Defined in Database.Haskey.Alloc.Concurrent.Internal.Environment showsPrec :: Int -> DirtyOverflow -> ShowS # show :: DirtyOverflow -> String # showList :: [DirtyOverflow] -> ShowS # |
newtype OldOverflow Source #
Wrapper around OverflowId
indicating that it is an overflow
page from a previous transaction.
Instances
Eq OldOverflow Source # | |
Defined in Database.Haskey.Alloc.Concurrent.Internal.Environment (==) :: OldOverflow -> OldOverflow -> Bool # (/=) :: OldOverflow -> OldOverflow -> Bool # | |
Ord OldOverflow Source # | |
Defined in Database.Haskey.Alloc.Concurrent.Internal.Environment compare :: OldOverflow -> OldOverflow -> Ordering # (<) :: OldOverflow -> OldOverflow -> Bool # (<=) :: OldOverflow -> OldOverflow -> Bool # (>) :: OldOverflow -> OldOverflow -> Bool # (>=) :: OldOverflow -> OldOverflow -> Bool # max :: OldOverflow -> OldOverflow -> OldOverflow # min :: OldOverflow -> OldOverflow -> OldOverflow # | |
Show OldOverflow Source # | |
Defined in Database.Haskey.Alloc.Concurrent.Internal.Environment showsPrec :: Int -> OldOverflow -> ShowS # show :: OldOverflow -> String # showList :: [OldOverflow] -> ShowS # |
touchOverflow :: MonadState (WriterEnv hnd) m => OverflowId -> m () Source #
Touch a fresh overflow page, making it dirty.
overflowType :: MonadState (WriterEnv hnd) m => OverflowId -> m (Either DirtyOverflow OldOverflow) Source #
Get the type of the overflow page.
removeOldOverflow :: MonadState (WriterEnv hdn) m => OldOverflow -> m () Source #
Free an old overflow page.