Safe Haskell | Safe-Inferred |
---|---|
Language | GHC2021 |
Database.LSMTree.Internal.Chunk
Description
Chunks of bytes, typically output during incremental index serialisation.
Synopsis
- newtype Chunk = Chunk (Vector Word8)
- toByteVector :: Chunk -> Vector Word8
- toByteString :: Chunk -> ByteString
- data Baler s = Baler !(MVector s Word8) !(PrimVar s Int)
- createBaler :: Int -> ST s (Baler s)
- feedBaler :: forall s. [Vector Word8] -> Baler s -> ST s (Maybe Chunk)
- unsafeEndBaler :: forall s. Baler s -> ST s (Maybe Chunk)
Chunks
A chunk of bytes, typically output during incremental index serialisation.
Instances
toByteString :: Chunk -> ByteString Source #
Yields the contents of a chunk as a (strict) byte string.
Balers
An object that receives blocks of bytes and repackages them into chunks such that all chunks except for a possible remnant chunk at the end are of at least a given minimum size.
Creates a new baler.
feedBaler :: forall s. [Vector Word8] -> Baler s -> ST s (Maybe Chunk) Source #
Feeds a baler blocks of bytes.
Bytes received by a baler are generally queued for later output, but if feeding new bytes makes the accumulated content exceed the minimum chunk size then a chunk containing all the accumulated content is output.