haskey-0.1.0.1: A transcatoinal, ACID compliant, embeddable key-value store.

Contents

Description

A storage back-end manages physical storage of pages.

Synopsis

# Class

class (Applicative m, Monad m) => StoreM hnd m | m -> hnd where Source #

A storage back-end that can store and fetch physical pages.

Minimal complete definition

Methods

openHandle :: hnd -> m () Source #

Open a database handle for reading and writing.

flushHandle :: hnd -> m () Source #

Flush the contents of a handle to disk (or other storage).

closeHandle :: hnd -> m () Source #

Close a database handle.

removeHandle :: hnd -> m () Source #

Remove a handle from the storage back-end.

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).

The maximum page size the allocator can handle.

Get the maximum key size

The default implementation will repeatedly call calculateMaxKeySize. You might want to cache this value in your own implementation.

Get the maximum value size

The default implementation will repeatedly call calculateMaxValueSize. You might want to cache this value in your own implementation.

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

Read a page and return the actual node and the transaction id when the node was written.

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

Write a node to a physical page.

getOverflow :: Value val => hnd -> Proxy val -> m val Source #

Read a value from an overflow page

putOverflow :: Value val => hnd -> val -> m () Source #

Write a value to an overflow page

listOverflows :: hnd -> m [hnd] Source #

List overflow pages in the specific overflow directory.

The result should include **AT LEAST** the handles in the specified directory, but it may contain more handles, even handles that do not belong to an overflow page.

Instances

# Helpers

arbitrarySearch :: (Ord v, Integral n) => n -> (n -> v) -> v -> n Source #

Search an arbitrary number, less than a limit, greater than a starting value.

Arguments

 :: PageSize Maximum pages size -> (Node Z ZeroEncoded ZeroEncoded -> PageSize) Function that calculates the page size of a node -> Word64 Maximum key size

Calculate the maximum key size.

Return the size for which at least 4 key-value pairs with keys and values of that size can fit in a leaf node.

Arguments

 :: PageSize Maximum page size -> Word64 Maximum key size -> (Node Z ZeroEncoded ZeroEncoded -> PageSize) Function that calculates the page size of a node -> Word64 Maximum value size

Calculate the maximum value size.

Return the size for which at least 4 key-value pairs of the specified maximum key size and values of the returned size can fit in a leaf node. that size can fit in a leaf node.

Data type which encodes the integer using a variable amount of NULL or ONE bytes.

Constructors

 ZeroEncoded Fields

Instances

 Source # Methods Source # Methods Source # MethodsshowList :: [ZeroEncoded] -> ShowS # Source # MethodsputList :: [ZeroEncoded] -> Put # Source # Methods Source # Methods