haskey-btree-0.2.0.0: B+-tree implementation in Haskell.

Safe HaskellNone
LanguageHaskell2010

Data.BTree.Alloc.Class

Contents

Description

A page allocator manages all physical pages.

Synopsis

Classes

class (Applicative m, Monad m) => AllocReaderM m where Source #

A page allocator that can read physical pages.

Minimal complete definition

readNode, readOverflow

Methods

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

Read a page and return the actual node.

readOverflow :: Value val => OverflowId -> m val Source #

Read an overflow page.

Instances

(Functor m, Monad m) => AllocReaderM (DebugT m) Source # 

Methods

readNode :: (Key key, Value val) => Height height -> NodeId height key val -> DebugT m (Node height key val) Source #

readOverflow :: Value val => OverflowId -> DebugT m val Source #

class AllocReaderM m => AllocM m where Source #

A page allocator that can write physical pages.

Methods

nodePageSize :: (Key key, Value val) => m (Height height -> Node height key val -> PageSize) Source #

A function that calculates the hypothetical size of a node, if it were to be written to a page (regardless of the maximum page size).

maxPageSize :: m PageSize Source #

The maximum page size the allocator can handle.

maxKeySize :: m Word64 Source #

The maximum key size

maxValueSize :: m Word64 Source #

The maximum value size

allocNode :: (Key key, Value val) => Height height -> Node height key val -> m (NodeId height key val) Source #

Allocate a new page for a node, and write the node to the page.

freeNode :: Height height -> NodeId height key val -> m () Source #

Free the page belonging to the node.

allocOverflow :: Value val => val -> m OverflowId Source #

Allocate a new overflow page, and write the value to the page.

freeOverflow :: OverflowId -> m () Source #

Free an overflow page.

Instances

(Functor m, Monad m) => AllocM (DebugT m) Source # 

Methods

nodePageSize :: (Key key, Value val) => DebugT m (Height height -> Node height key val -> PageSize) Source #

maxPageSize :: DebugT m PageSize Source #

maxKeySize :: DebugT m Word64 Source #

maxValueSize :: DebugT m Word64 Source #

allocNode :: (Key key, Value val) => Height height -> Node height key val -> DebugT m (NodeId height key val) Source #

freeNode :: Height height -> NodeId height key val -> DebugT m () Source #

allocOverflow :: Value val => val -> DebugT m OverflowId Source #

freeOverflow :: OverflowId -> DebugT m () Source #