kayrock v0.1.1 Kayrock.Compression View Source

Handles compression/decompression of messages.

NOTE this is a copy of KafkaEx.Compression: https://github.com/kafkaex/kafka_ex/blob/master/lib/kafka_ex/compression.ex

It is duplicated here to avoid creating a circular dependency.

See https://cwiki.apache.org/confluence/display/KAFKA/A+Guide+To+The+Kafka+Protocol#AGuideToTheKafkaProtocol-Compression

To add new compression types:

  1. Add the appropriate dependency to mix.exs (don't forget to add it to the application list).
  2. Add the appropriate attribute value and compression_type atom.
  3. Add a decompress function clause.
  4. Add a compress function clause.

Link to this section Summary

Functions

This function should pattern match on the compression_type atom and return the compressed data as well as the corresponding attribute value.

This function should pattern match on the attribute value and return the decompressed data.

Link to this section Types

Link to this type

attribute_t() View Source
attribute_t() :: integer()

Link to this type

compression_type_t() View Source
compression_type_t() :: :snappy | :gzip

Link to this section Functions

This function should pattern match on the compression_type atom and return the compressed data as well as the corresponding attribute value.

Link to this function

decompress(int, data) View Source
decompress(attribute_t(), binary()) :: binary()

This function should pattern match on the attribute value and return the decompressed data.

Link to this function

snappy_decompress_chunk(arg, so_far) View Source