Safe Haskell | Safe-Inferred |
---|---|
Language | GHC2021 |
Database.LSMTree.Internal.Serialise
Contents
Description
Newtype wrappers and utilities for serialised keys, values and blobs.
Synopsis
- class SerialiseKey k
- class SerialiseValue v
- newtype SerialisedKey where
- SerialisedKey RawBytes
- pattern SerialisedKey' :: Vector Word8 -> SerialisedKey
- serialiseKey :: SerialiseKey k => k -> SerialisedKey
- deserialiseKey :: SerialiseKey k => SerialisedKey -> k
- sizeofKey :: SerialisedKey -> Int
- sizeofKey16 :: SerialisedKey -> Word16
- sizeofKey32 :: SerialisedKey -> Word32
- sizeofKey64 :: SerialisedKey -> Word64
- serialisedKey :: SerialisedKey -> Builder
- keyTopBits64 :: SerialisedKey -> Word64
- newtype SerialisedValue where
- SerialisedValue RawBytes
- pattern SerialisedValue' :: Vector Word8 -> SerialisedValue
- serialiseValue :: SerialiseValue v => v -> SerialisedValue
- deserialiseValue :: SerialiseValue v => SerialisedValue -> v
- sizeofValue :: SerialisedValue -> Int
- sizeofValue16 :: SerialisedValue -> Word16
- sizeofValue32 :: SerialisedValue -> Word32
- sizeofValue64 :: SerialisedValue -> Word64
- serialisedValue :: SerialisedValue -> Builder
- newtype SerialisedBlob where
- SerialisedBlob RawBytes
- pattern SerialisedBlob' :: Vector Word8 -> SerialisedBlob
- serialiseBlob :: SerialiseValue v => v -> SerialisedBlob
- deserialiseBlob :: SerialiseValue v => SerialisedBlob -> v
- sizeofBlob :: SerialisedBlob -> Int
- sizeofBlob64 :: SerialisedBlob -> Word64
- serialisedBlob :: SerialisedBlob -> Builder
Re-exports
class SerialiseKey k Source #
Serialisation of keys.
Instances should satisfy the following:
- Identity
deserialiseKey
(serialiseKey
x) == x- Identity up to slicing
deserialiseKey
(packSlice
prefix (serialiseKey
x) suffix) == x
Instances may satisfy the following:
- Ordering-preserving
x `
compare
` y ==serialiseKey
x `compare
`serialiseKey
y
Raw bytes are lexicographically ordered, so in particular this means that values should be serialised into big-endian formats. This constraint mainly exists for range queries, where the range is specified in terms of unserialised values, but the internal implementation works on the serialised representation.
Minimal complete definition
Instances
SerialiseKey Word64 Source # | |
Defined in Database.LSMTree.Internal.Serialise.Class | |
SerialiseKey ByteString Source # | Placeholder instance, not optimised |
Defined in Database.LSMTree.Internal.Serialise.Class Methods serialiseKey :: ByteString -> RawBytes Source # deserialiseKey :: RawBytes -> ByteString Source # | |
SerialiseKey ByteString Source # | Placeholder instance, not optimised |
Defined in Database.LSMTree.Internal.Serialise.Class Methods serialiseKey :: ByteString -> RawBytes Source # deserialiseKey :: RawBytes -> ByteString Source # | |
SerialiseKey ShortByteString Source # | |
Defined in Database.LSMTree.Internal.Serialise.Class Methods |
class SerialiseValue v Source #
Serialisation of values and blobs.
Instances should satisfy the following:
- Identity
deserialiseValue
(serialiseValue
x) == x- Identity up to slicing
deserialiseValue
(packSlice
prefix (serialiseValue
x) suffix) == x
Minimal complete definition
Instances
Keys
newtype SerialisedKey Source #
Representation of a serialised key.
Serialisation should preserve equality and ordering. The Ord
instance for
SerialisedKey
uses lexicographical ordering.
Constructors
SerialisedKey RawBytes |
Bundled Patterns
pattern SerialisedKey' :: Vector Word8 -> SerialisedKey |
Instances
serialiseKey :: SerialiseKey k => k -> SerialisedKey Source #
deserialiseKey :: SerialiseKey k => SerialisedKey -> k Source #
sizeofKey :: SerialisedKey -> Int Source #
Size of key in number of bytes.
sizeofKey16 :: SerialisedKey -> Word16 Source #
Size of key in number of bytes.
sizeofKey32 :: SerialisedKey -> Word32 Source #
Size of key in number of bytes.
sizeofKey64 :: SerialisedKey -> Word64 Source #
Size of key in number of bytes.
serialisedKey :: SerialisedKey -> Builder Source #
keyTopBits64 :: SerialisedKey -> Word64 Source #
See topBits64
Values
newtype SerialisedValue Source #
Representation of a serialised value.
Constructors
SerialisedValue RawBytes |
Bundled Patterns
pattern SerialisedValue' :: Vector Word8 -> SerialisedValue |
Instances
Show SerialisedValue Source # | |
Defined in Database.LSMTree.Internal.Serialise Methods showsPrec :: Int -> SerialisedValue -> ShowS # show :: SerialisedValue -> String # showList :: [SerialisedValue] -> ShowS # | |
NFData SerialisedValue Source # | |
Defined in Database.LSMTree.Internal.Serialise Methods rnf :: SerialisedValue -> () # | |
Eq SerialisedValue Source # | |
Defined in Database.LSMTree.Internal.Serialise Methods (==) :: SerialisedValue -> SerialisedValue -> Bool # (/=) :: SerialisedValue -> SerialisedValue -> Bool # | |
Ord SerialisedValue Source # | |
Defined in Database.LSMTree.Internal.Serialise Methods compare :: SerialisedValue -> SerialisedValue -> Ordering # (<) :: SerialisedValue -> SerialisedValue -> Bool # (<=) :: SerialisedValue -> SerialisedValue -> Bool # (>) :: SerialisedValue -> SerialisedValue -> Bool # (>=) :: SerialisedValue -> SerialisedValue -> Bool # max :: SerialisedValue -> SerialisedValue -> SerialisedValue # min :: SerialisedValue -> SerialisedValue -> SerialisedValue # |
serialiseValue :: SerialiseValue v => v -> SerialisedValue Source #
deserialiseValue :: SerialiseValue v => SerialisedValue -> v Source #
sizeofValue :: SerialisedValue -> Int Source #
sizeofValue16 :: SerialisedValue -> Word16 Source #
Size of value in number of bytes.
sizeofValue32 :: SerialisedValue -> Word32 Source #
Size of value in number of bytes.
sizeofValue64 :: SerialisedValue -> Word64 Source #
Size of value in number of bytes.
Blobs
newtype SerialisedBlob Source #
Representation of a serialised blob.
Constructors
SerialisedBlob RawBytes |
Bundled Patterns
pattern SerialisedBlob' :: Vector Word8 -> SerialisedBlob |
Instances
Show SerialisedBlob Source # | |
Defined in Database.LSMTree.Internal.Serialise Methods showsPrec :: Int -> SerialisedBlob -> ShowS # show :: SerialisedBlob -> String # showList :: [SerialisedBlob] -> ShowS # | |
NFData SerialisedBlob Source # | |
Defined in Database.LSMTree.Internal.Serialise Methods rnf :: SerialisedBlob -> () # | |
Eq SerialisedBlob Source # | |
Defined in Database.LSMTree.Internal.Serialise Methods (==) :: SerialisedBlob -> SerialisedBlob -> Bool # (/=) :: SerialisedBlob -> SerialisedBlob -> Bool # | |
Ord SerialisedBlob Source # | |
Defined in Database.LSMTree.Internal.Serialise Methods compare :: SerialisedBlob -> SerialisedBlob -> Ordering # (<) :: SerialisedBlob -> SerialisedBlob -> Bool # (<=) :: SerialisedBlob -> SerialisedBlob -> Bool # (>) :: SerialisedBlob -> SerialisedBlob -> Bool # (>=) :: SerialisedBlob -> SerialisedBlob -> Bool # max :: SerialisedBlob -> SerialisedBlob -> SerialisedBlob # min :: SerialisedBlob -> SerialisedBlob -> SerialisedBlob # |
serialiseBlob :: SerialiseValue v => v -> SerialisedBlob Source #
deserialiseBlob :: SerialiseValue v => SerialisedBlob -> v Source #
sizeofBlob :: SerialisedBlob -> Int Source #
Size of blob in number of bytes.
sizeofBlob64 :: SerialisedBlob -> Word64 Source #