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

Safe HaskellNone
LanguageHaskell2010

Database.Haskey.Store.Page

Description

This module contains structures and functions to decode and encode pages.

Synopsis

Documentation

data Page t where Source #

A decoded page, of a certain type t of kind PageType.

data SGet t Source #

A decoder with its type.

Constructors

SGet (SPageType t) (Get (Page t)) 

pageType :: SPageType t -> PageType Source #

Get the type of a Page.

encodeZeroChecksum :: Page t -> ByteString Source #

Encode a page to a lazy byte string, but with the checksum set to zero.

encode :: Page t -> ByteString Source #

Encode a page to a lazy byte string, and prepend the calculated checksum.

prependChecksum :: ByteString -> ByteString Source #

Prepend the xxHash 64-bit checksum of a bytestring to itself.

encodeNoChecksum :: Page t -> ByteString Source #

Encode a page to a lazy byte string, without prepending the checksum.

encodedPageSize :: (Key k, Value v) => Height h -> Node h k v -> PageSize Source #

Size of a node, if it were to be encoded.

decode :: SGet t -> ByteString -> Either String (Page t) Source #

Decode a page, and verify the checksum.

decodeNoChecksum :: SGet t -> ByteString -> Either String (Page t) Source #

Decode a page with a specific decoder, or return the error.

decodeM :: MonadThrow m => SGet t -> ByteString -> m (Page t) Source #

Monadic wrapper around decode

putPage :: Page t -> Put Source #

The encoder of a Page.

emptyPage :: SGet TypeEmpty Source #

Decoder for an empty page.

leafNodePage :: (Key k, Value v) => Height Z -> Proxy k -> Proxy v -> SGet TypeLeafNode Source #

Decoder for a leaf node page.

indexNodePage :: (Key k, Value v) => Height (S n) -> Proxy k -> Proxy v -> SGet TypeIndexNode Source #

Decoder for a leaf node page.

overflowPage :: Value v => Proxy v -> SGet TypeOverflow Source #

Decoder for an overflow page.