haskey-0.3.0.2: A transactional, 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 PageType #

The type of a page.

Instances
Eq PageType # 
Instance details

Defined in Database.Haskey.Store.Page

Show PageType # 
Instance details

Defined in Database.Haskey.Store.Page

Binary PageType # 
Instance details

Defined in Database.Haskey.Store.Page

Methods

put :: PageType -> Put #

get :: Get PageType #

putList :: [PageType] -> Put #

data Page (t :: PageType) where #

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

data SGet t #

A decoder with its type.

Constructors

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

pageType :: SPageType t -> PageType #

Get the type of a Page.

encodeZeroChecksum :: Page t -> ByteString #

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

encode :: Page t -> ByteString #

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

prependChecksum :: ByteString -> ByteString #

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

encodeNoChecksum :: Page t -> ByteString #

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

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

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

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

Decode a page, and verify the checksum.

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

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

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

Monadic wrapper around decode

putPage :: Page t -> Put #

The encoder of a Page.

emptyPage :: SGet TypeEmpty #

Decoder for an empty page.

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

Decoder for a leaf node page.

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

Decoder for a leaf node page.

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

Decoder for an overflow page.

newtype DecodeError #

Exception thrown when decoding of a page fails.

Constructors

DecodeError String