Safe Haskell | Safe-Inferred |
---|---|
Language | GHC2021 |
Database.LSMTree.Internal.RawOverflowPage
Synopsis
- data RawOverflowPage = RawOverflowPage !Int !ByteArray
- makeRawOverflowPage :: ByteArray -> Int -> Int -> RawOverflowPage
- unsafeMakeRawOverflowPage :: ByteArray -> Int -> RawOverflowPage
- rawOverflowPageRawBytes :: RawOverflowPage -> RawBytes
- rawOverflowPageToByteString :: RawOverflowPage -> ByteString
- rawBytesToOverflowPages :: RawBytes -> [RawOverflowPage]
- pinnedByteArrayToOverflowPages :: Int -> Int -> ByteArray -> [RawOverflowPage]
- unpinnedByteArrayToOverflowPages :: Int -> Int -> ByteArray -> [RawOverflowPage]
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 | |
Instances
Show RawOverflowPage Source # | |
Defined in Database.LSMTree.Internal.RawOverflowPage Methods showsPrec :: Int -> RawOverflowPage -> ShowS # show :: RawOverflowPage -> String # showList :: [RawOverflowPage] -> ShowS # | |
NFData RawOverflowPage Source # | |
Defined in Database.LSMTree.Internal.RawOverflowPage Methods rnf :: RawOverflowPage -> () # | |
Eq RawOverflowPage Source # | This instance assumes pages are 4096 bytes in size |
Defined in Database.LSMTree.Internal.RawOverflowPage Methods (==) :: RawOverflowPage -> RawOverflowPage -> Bool # (/=) :: RawOverflowPage -> RawOverflowPage -> Bool # |
Arguments
:: ByteArray | bytearray |
-> Int | offset in bytes into the bytearray |
-> Int | length in bytes, must be |
-> 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 RawOverflowPage
s.
This will avoid copying where possible.
pinnedByteArrayToOverflowPages :: Int -> Int -> ByteArray -> [RawOverflowPage] Source #
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