Safe Haskell | None |
---|---|
Language | Haskell2010 |
Synopsis
- data ContainerHeader = ContainerHeader {
- syncBytes :: ByteString
- decompress :: forall a. Decompress a
- containedSchema :: Schema
- nrSyncBytes :: Integral sb => sb
- newSyncBytes :: IO ByteString
- getContainerHeader :: Get ContainerHeader
- decodeRawBlocks :: ByteString -> Either String (Schema, [Either String (Int, ByteString)])
- getNextBlock :: ByteString -> Decompress ByteString -> ByteString -> Either String (Maybe (Int, ByteString, ByteString))
- extractContainerValuesBytes :: forall a schema. (Schema -> Either String schema) -> (schema -> Get a) -> ByteString -> Either String (Schema, [Either String (a, ByteString)])
- extractContainerValues :: forall a schema. (Schema -> Either String schema) -> (schema -> Get a) -> ByteString -> Either String (Schema, [Either String a])
- packContainerValues :: Codec -> Schema -> [[ByteString]] -> IO ByteString
- packContainerValuesWithSync :: Codec -> Schema -> ByteString -> [[ByteString]] -> ByteString
- packContainerValuesWithSync' :: (Schema -> a -> Builder) -> Codec -> Schema -> ByteString -> [[a]] -> ByteString
- packContainerBlocks :: Codec -> Schema -> [(Int, ByteString)] -> IO ByteString
- packContainerBlocksWithSync :: Codec -> Schema -> ByteString -> [(Int, ByteString)] -> ByteString
- containerHeaderWithSync :: Codec -> Schema -> ByteString -> Builder
- consumeN :: Int64 -> (a -> (a, b)) -> a -> (a, [b])
- parseCodec :: Monad m => Maybe ByteString -> m Codec
- takeWhileInclusive :: (a -> Bool) -> [a] -> [a]
Documentation
data ContainerHeader Source #
ContainerHeader | |
|
nrSyncBytes :: Integral sb => sb Source #
newSyncBytes :: IO ByteString Source #
Generates a new synchronization marker for encoding Avro containers
decodeRawBlocks :: ByteString -> Either String (Schema, [Either String (Int, ByteString)]) Source #
Reads the container as a list of blocks without decoding them into actual values.
This can be useful for streaming splitting merging Avro containers without paying the cost for Avro encoding/decoding.
Each block is returned as a raw ByteString
annotated with the number of Avro values
that are contained in this block.
The "outer" error represents the error in opening the container itself (including problems like reading schemas embedded into the container.)
getNextBlock :: ByteString -> Decompress ByteString -> ByteString -> Either String (Maybe (Int, ByteString, ByteString)) Source #
extractContainerValuesBytes :: forall a schema. (Schema -> Either String schema) -> (schema -> Get a) -> ByteString -> Either String (Schema, [Either String (a, ByteString)]) Source #
Splits container into a list of individual avro-encoded values. This version provides both encoded and decoded values.
This is particularly useful when slicing up containers into one or more smaller files. By extracting the original bytestring it is possible to avoid re-encoding data.
extractContainerValues :: forall a schema. (Schema -> Either String schema) -> (schema -> Get a) -> ByteString -> Either String (Schema, [Either String a]) Source #
packContainerValues :: Codec -> Schema -> [[ByteString]] -> IO ByteString Source #
Packs a container from a given list of already encoded Avro values Each bytestring should represent exactly one one value serialised to Avro.
packContainerValuesWithSync :: Codec -> Schema -> ByteString -> [[ByteString]] -> ByteString Source #
Packs a container from a given list of already encoded Avro values Each bytestring should represent exactly one one value serialised to Avro.
packContainerValuesWithSync' :: (Schema -> a -> Builder) -> Codec -> Schema -> ByteString -> [[a]] -> ByteString Source #
Packs a container from a given list of already encoded Avro values Each bytestring should represent exactly one one value serialised to Avro.
packContainerBlocks :: Codec -> Schema -> [(Int, ByteString)] -> IO ByteString Source #
Packs a new container from a list of already encoded Avro blocks. Each block is denoted as a pair of a number of objects within that block and the block content.
packContainerBlocksWithSync :: Codec -> Schema -> ByteString -> [(Int, ByteString)] -> ByteString Source #
Packs a new container from a list of already encoded Avro blocks. Each block is denoted as a pair of a number of objects within that block and the block content.
containerHeaderWithSync :: Codec -> Schema -> ByteString -> Builder Source #
Creates an Avro container header for a given schema.
parseCodec :: Monad m => Maybe ByteString -> m Codec Source #
takeWhileInclusive :: (a -> Bool) -> [a] -> [a] Source #