kafka-interchange-0.2.0.0: Serialization for kafka wire protocol
Safe HaskellSafe-Inferred
LanguageHaskell2010

Kafka.Record.Response

Synopsis

Documentation

data Record Source #

Information about Record from Kafka documentation:

length: varint
attributes: int8
    bit 0~7: unused
timestampDelta: varlong
offsetDelta: varint
keyLength: varint
key: byte[]
valueLen: varint
value: byte[]
Headers => [Header]

Constructors

Record 

Fields

  • attributes :: !Word8

    To the author's understanding, record attributes are unused, and this will always be zero. But just to be safe, this library parses it from the encoded record.

  • timestampDelta :: !Int64
     
  • offsetDelta :: !Int64

    We deviate from the spec here by making this a 64-bit integer instead of a 32-bit integer. We do this so that the integral type is wide enough to hold an absolute offset.

  • key :: !Bytes

    We decode a null key to the empty byte sequence.

  • value :: !Bytes
     
  • headers :: !(SmallArray Header)
     

Instances

Instances details
Show Record Source # 
Instance details

Defined in Kafka.Record.Response

data Header Source #

Information about Header from Kafka documentation:

headerKeyLength: varint
headerKey: String
headerValueLength: varint
value: byte[]

Constructors

Header 

Fields

Instances

Instances details
Show Header Source # 
Instance details

Defined in Kafka.Record.Response

Decode

Relative Offsets

decodeArray :: Bytes -> Maybe (SmallArray Record) Source #

This consumes the entire input. If it succeeds, there were no leftovers.

Decode

Absolute Offsets

decodeArrayAbsolute Source #

Arguments

:: Int64

Base timestamp (from record batch)

-> Int64

Base offset (from record batch)

-> Bytes 
-> Maybe (SmallArray Record) 

Variant of decodeArray that converts the timestamp and offset deltas to absolute timestamps and offsets. In the resulting records, the fields $sel:timestampDelta:Record and $sel:offsetDelta:Record are misnomers.