muesli-0.1.1.0: A simple document-oriented database

Copyright(c) 2015 Călin Ardelean
LicenseMIT
MaintainerCălin Ardelean <calinucs@gmail.com>
Stabilityexperimental
Portabilityportable
Safe HaskellNone
LanguageHaskell2010

Database.Muesli.Allocator

Description

Document data allocator.

This module should be imported qualified.

Synopsis

Documentation

empty :: DocAddress -> GapsIndex Source

Creates an index holding a single gap starting at the given address.

add :: DocSize -> DocAddress -> GapsIndex -> GapsIndex Source

Adds a gap to the index.

build :: MainIndex -> GapsIndex Source

Builds the index from the LogRecord data held in an MainIndex.

O(n*log(n)) operation used by open after loading the log.

buildExtra :: DocAddress -> [LogRecord] -> GapsIndex Source

Builds the index from a set of LogRecords, with all space before the given address considered reserved.

Used by the garbage collector (see module Database.Muesli.GC).

alloc :: GapsIndex -> DocSize -> (DocAddress, GapsIndex) Source

Allocates a new slot of the given size. The smallest available size in the index is preferred.

Throws DataAllocationError if no gap big enough is found.