module Data.BTree.Alloc.Class (
AllocReaderM(..)
, AllocM(..)
) where
import Prelude hiding (max, min, pred)
import Control.Applicative (Applicative)
import Data.Word (Word64)
import Data.BTree.Impure.Structures
import Data.BTree.Primitives
class (Applicative m, Monad m) => AllocReaderM m where
readNode :: (Key key, Value val)
=> Height height
-> NodeId height key val
-> m (Node height key val)
readOverflow :: (Value val)
=> OverflowId
-> m val
class AllocReaderM m => AllocM m where
nodePageSize :: (Key key, Value val)
=> m (Height height -> Node height key val -> PageSize)
maxPageSize :: m PageSize
maxKeySize :: m Word64
maxValueSize :: m Word64
allocNode :: (Key key, Value val)
=> Height height
-> Node height key val
-> m (NodeId height key val)
freeNode :: Height height
-> NodeId height key val
-> m ()
allocOverflow :: (Value val)
=> val
-> m OverflowId
freeOverflow :: OverflowId -> m ()