Safe Haskell | None |
---|---|
Language | Haskell2010 |
This module contains structures and functions to decode and encode pages.
- data PageType
- data SPageType t where
- data Page t where
- EmptyPage :: Page TypeEmpty
- ConcurrentMetaPage :: Root root => ConcurrentMeta root -> Page TypeConcurrentMeta
- OverflowPage :: Value v => v -> Page TypeOverflow
- LeafNodePage :: (Key k, Value v) => Height Z -> Node Z k v -> Page TypeLeafNode
- IndexNodePage :: (Key k, Value v) => Height (S h) -> Node (S h) k v -> Page TypeIndexNode
- data SGet t = SGet (SPageType t) (Get (Page t))
- pageType :: SPageType t -> PageType
- encodeZeroChecksum :: Page t -> ByteString
- encode :: Page t -> ByteString
- prependChecksum :: ByteString -> ByteString
- encodeNoChecksum :: Page t -> ByteString
- encodedPageSize :: (Key k, Value v) => Height h -> Node h k v -> PageSize
- decode :: SGet t -> ByteString -> Either String (Page t)
- decodeNoChecksum :: SGet t -> ByteString -> Either String (Page t)
- decodeM :: MonadThrow m => SGet t -> ByteString -> m (Page t)
- putPage :: Page t -> Put
- emptyPage :: SGet TypeEmpty
- leafNodePage :: (Key k, Value v) => Height Z -> Proxy k -> Proxy v -> SGet TypeLeafNode
- indexNodePage :: (Key k, Value v) => Height (S n) -> Proxy k -> Proxy v -> SGet TypeIndexNode
- overflowPage :: Value v => Proxy v -> SGet TypeOverflow
- concurrentMetaPage :: Root root => Proxy root -> SGet TypeConcurrentMeta
- newtype DecodeError = DecodeError String
- checksumSeed :: Word64
Documentation
The type of a page.
A decoded page, of a certain type t
of kind PageType
.
EmptyPage :: Page TypeEmpty | |
ConcurrentMetaPage :: Root root => ConcurrentMeta root -> Page TypeConcurrentMeta | |
OverflowPage :: Value v => v -> Page TypeOverflow | |
LeafNodePage :: (Key k, Value v) => Height Z -> Node Z k v -> Page TypeLeafNode | |
IndexNodePage :: (Key k, Value v) => Height (S h) -> Node (S h) k v -> Page TypeIndexNode |
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
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.
concurrentMetaPage :: Root root => Proxy root -> SGet TypeConcurrentMeta Source #
newtype DecodeError Source #
Exception thrown when decoding of a page fails.