Copyright | (c) 2020 Composewell Technologies |
---|---|
License | Apache-2.0 |
Maintainer | streamly@composewell.com |
Stability | experimental |
Portability | GHC |
Safe Haskell | Safe-Inferred |
Language | Haskell2010 |
Frame and block configuration settings for LZ4.
Synopsis
- newtype FrameConfig = FrameConfig {
- hasEndMark :: Bool
- setFrameContentSize :: Bool -> FrameConfig -> FrameConfig
- setFrameContentChecksum :: Bool -> FrameConfig -> FrameConfig
- setFrameDictionaryId :: Bool -> FrameConfig -> FrameConfig
- setFrameBlockIndependence :: Bool -> FrameConfig -> FrameConfig
- setFrameBlockChecksum :: Bool -> FrameConfig -> FrameConfig
- setFrameEndMark :: Bool -> FrameConfig -> FrameConfig
- defaultFrameConfig :: FrameConfig
- newtype BlockConfig = BlockConfig {}
- data BlockSize
- setBlockMaxSize :: BlockSize -> BlockConfig -> BlockConfig
- setBlockIndependence :: Bool -> BlockConfig -> BlockConfig
- setBlockChecksum :: Bool -> BlockConfig -> BlockConfig
- defaultBlockConfig :: BlockConfig
LZ4 Frame Format
Configuration for a frame consisting of a series of blocks.
setFrameContentSize :: Bool -> FrameConfig -> FrameConfig Source #
Whether the frame header has a content size field.
Unimplemented
setFrameContentChecksum :: Bool -> FrameConfig -> FrameConfig Source #
Whether the frame footer has a content checksum after the end mark. If it is True then it implicitly indicates that setEndMark is set to True.
Unimplemented
setFrameDictionaryId :: Bool -> FrameConfig -> FrameConfig Source #
Whether the frame header has a dictionary ID field.
Unimplemented
setFrameBlockIndependence :: Bool -> FrameConfig -> FrameConfig Source #
When False
, future blocks in the frame may depend on the past blocks.
Block dependency improves compression ratio, especially for small blocks. On
the other hand, it makes random access or multi-threaded decoding
impossible.
Unimplemented
setFrameBlockChecksum :: Bool -> FrameConfig -> FrameConfig Source #
Indicate whether blocks in the frame are followed by a 4-byte checksum field.
Unimplemented
setFrameEndMark :: Bool -> FrameConfig -> FrameConfig Source #
Whether the frame footer has an end mark.
LZ4 Block Format
Configuration for a single compressed block.
newtype BlockConfig Source #
Defines the LZ4 compressed block format. Please note that the
Uncompressed length
field is optional and not in the LZ4 specification.
---------------------------------------------------------------------- | Compressed length | Uncompressed length | Data | Checksum | | (4 byte) | (4 byte) (optional) | | (4 byte) (optional) | ----------------------------------------------------------------------
Compressed length is the length of the Data
field only. Uncompressed
length is present only when the setBlockMaxSize
is set to BlockHasSize
.
Checksum is present when setBlockChecksum
is set to True
. The 4-byte
fields are stored in machine byte order.
Maximum uncompressed size of a data block.
BlockHasSize | Block header has uncompressed size after the compressed size field. Please note that this option is not in the LZ4 specification. |
BlockMax64KB | |
BlockMax256KB | |
BlockMax1MB | |
BlockMax4MB |
setBlockMaxSize :: BlockSize -> BlockConfig -> BlockConfig Source #
Set the maximum uncompressed size of the data block.
setBlockIndependence :: Bool -> BlockConfig -> BlockConfig Source #
When False
, the block may depend on the past blocks.
Unimplemented
setBlockChecksum :: Bool -> BlockConfig -> BlockConfig Source #
Indicate whether the block is followed by a 4-byte checksum field.
Unimplemented
defaultBlockConfig :: BlockConfig Source #
The default settings are: