lsm-tree-0.1.0.0: Log-structured merge-trees
Safe HaskellSafe-Inferred
LanguageGHC2021

Database.LSMTree.Internal.RawOverflowPage

Synopsis

Documentation

data RawOverflowPage Source #

When a key/op pair is too large to fit in a single disk page, the representation is split into a normal page, and one or more overflow pages. The normal RawPage follows the run page format, and contains the key, optional blob reference and a prefix of the value, while the overflow pages contain the suffix of a large value that didn't fit in the normal page.

Each overflow page is the same size as normal pages (currently 4096 only).

Constructors

RawOverflowPage 

Fields

Instances

Instances details
Show RawOverflowPage Source # 
Instance details

Defined in Database.LSMTree.Internal.RawOverflowPage

NFData RawOverflowPage Source # 
Instance details

Defined in Database.LSMTree.Internal.RawOverflowPage

Methods

rnf :: RawOverflowPage -> () #

Eq RawOverflowPage Source #

This instance assumes pages are 4096 bytes in size

Instance details

Defined in Database.LSMTree.Internal.RawOverflowPage

makeRawOverflowPage Source #

Arguments

:: ByteArray

bytearray

-> Int

offset in bytes into the bytearray

-> Int

length in bytes, must be >= 0 && <= 4096

-> RawOverflowPage 

Create a RawOverflowPage.

The length must be 4096 or less.

This function will copy data if the byte array is not pinned, or the length is strictly less than 4096.

unsafeMakeRawOverflowPage Source #

Arguments

:: ByteArray

bytearray, must be pinned and contain 4096 bytes (after offset)

-> Int

offset in bytes

-> RawOverflowPage 

Create a RawOverflowPage without copying. The byte array and offset must satisfy the invariant for RawOverflowPage.

rawOverflowPageToByteString :: RawOverflowPage -> ByteString Source #

\( O(1) \) since we can avoid copying the pinned byte array.

rawBytesToOverflowPages :: RawBytes -> [RawOverflowPage] Source #

Convert RawBytes representing the "overflow" part of a value into one or more RawOverflowPages.

This will avoid copying where possible.

unpinnedByteArrayToOverflowPages :: Int -> Int -> ByteArray -> [RawOverflowPage] Source #

Not pinned, in principle shouldn't happen much because if the value is big enough to overflow then it's big enough to be pinned. It is possible however if a page has a huge key and a small value.

Unfortunately, with GHC versions 9.6.x we also get this because the meaning of pinned has changed. Sigh. See https://gitlab.haskell.org/ghc/ghc/-/issues/22255