System.TPFS.Tree
Description
Various structures and algorithms for trees.
- class Ord key => BTree key value pointer where
- btOrder :: (Num a, Device m h) => Filesystem m h -> (key, value, pointer) -> a
- btGet :: Device m h => Filesystem m h -> pointer -> m (BNode key value pointer)
- btPut :: Device m h => Filesystem m h -> pointer -> BNode key value pointer -> m ()
- btAllocate :: Device m h => Filesystem m h -> m pointer
- btFree :: Device m h => Filesystem m h -> pointer -> m ()
- data BTree key value pointer => BNode key value pointer = BNode {
- bnKeys :: [key]
- bnValues :: [value]
- bnChildren :: [pointer]
Documentation
class Ord key => BTree key value pointer whereSource
Describes functions for accessing a B-tree on a Filesystem. These
functions are used to write portable, reusable code for properly managing
any B-tree.
Methods
Arguments
| :: (Num a, Device m h) | |
| => Filesystem m h | |
| -> (key, value, pointer) | This parameter is included for the sole purpose of selecting which instance to use. Its value should be assumed undefined. |
| -> a |
Returns the optimal Knuth order for the given filesystem.
btGet :: Device m h => Filesystem m h -> pointer -> m (BNode key value pointer)Source
Retrieves a BNode from storage. Might throw an exception (or use
Maybe) in the future if the node failed verification (via a checksum or
similar), but currently it does not.
btPut :: Device m h => Filesystem m h -> pointer -> BNode key value pointer -> m ()Source
Places a BNode into storage. Attempting to write a BNode to an
unallocated part of storage may result in an exception in some
implementations.
btAllocate :: Device m h => Filesystem m h -> m pointerSource
Allocates and returns a pointer to a space where a BNode may be stored.
btFree :: Device m h => Filesystem m h -> pointer -> m ()Source
Frees the space used by a BNode.
data BTree key value pointer => BNode key value pointer Source
Describes a node of a B-tree in memory.
Constructors
| BNode | |
Fields
| |