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

Safe HaskellNone
LanguageHaskell2010

Database.Haskey.Alloc.Concurrent.Internal.FreePages.Query

Synopsis

Documentation

getFreePageId :: (Functor m, AllocM m, MonadIO m, MonadState (WriterEnv hnd) m) => S stateType () -> m (Maybe PageId) Source #

Get a free page.

First try to get one from the in-memory dirty pages. Then try to get one from the in-memory free page cache stored in fileStateCachedFreePages. If that one is empty, actually query one from the free database.

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

Get a cached free page.

Get a free page from the free database cache stored in fileStateCachedFreePages.

queryNewFreePageIds :: (AllocM m, MonadIO m, MonadState (WriterEnv hnd) m) => S stateType () -> m (Maybe PageId) Source #

Try to get a list of free pages from the free page database, return the first free one for immediate use, and store the rest in the environment.

Immediately remove the queried free pages from the free tree.

lookupValidFreePageIds :: (MonadIO m, AllocReaderM m, MonadState (WriterEnv hnd) m) => FreeTree -> m (Maybe (TxId, NonEmpty PageId)) Source #

Lookup a list of free pages from the free page database, guaranteed to be old enough.

lookupFreePageIds :: (Functor m, AllocReaderM m, MonadState (WriterEnv hnd) m) => FreeTree -> m (Maybe (Unchecked (TxId, NonEmpty PageId))) Source #

Lookup a list of free pages from the free page database.

newtype Unchecked a Source #

Auxiliry type to ensure the transaction ID of free pages are checked.

Constructors

Unchecked a 

checkFreePages :: (Functor m, MonadIO m, MonadState (WriterEnv hnd) m) => Unchecked (TxId, NonEmpty PageId) -> m (Maybe (TxId, NonEmpty PageId)) Source #

Check the transaction ID of the free pages, if it's to old, return Nothing.