PacketDecoder is the interface providing helpers for reading with Kafka's encoding rules. Types implementing Decoder only need to worry about calling methods like GetString, not about how a string is represented in Kafka.
| 13 | // Types implementing Decoder only need to worry about calling methods like GetString, |
| 14 | // not about how a string is represented in Kafka. |
| 15 | type packetDecoder interface { |
| 16 | // Primitives |
| 17 | getInt8() (int8, error) |
| 18 | getInt16() (int16, error) |
| 19 | getInt32() (int32, error) |
| 20 | getInt64() (int64, error) |
| 21 | getVarint() (int64, error) |
| 22 | getUVarint() (uint64, error) |
| 23 | getFloat64() (float64, error) |
| 24 | getArrayLength() (int, error) |
| 25 | getBool() (bool, error) |
| 26 | getKError() (KError, error) |
| 27 | getDurationMs() (time.Duration, error) |
| 28 | getEmptyTaggedFieldArray() (int, error) |
| 29 | getTaggedFieldArray(taggedFieldDecoders) error |
| 30 | |
| 31 | // Collections |
| 32 | getBytes() ([]byte, error) |
| 33 | getVarintBytes() ([]byte, error) |
| 34 | getRawBytes(length int) ([]byte, error) |
| 35 | getUuid() (Uuid, error) |
| 36 | getString() (string, error) |
| 37 | getNullableString() (*string, error) |
| 38 | getInt32Array() ([]int32, error) |
| 39 | getNullableInt32Array() ([]int32, error) |
| 40 | getInt64Array() ([]int64, error) |
| 41 | getStringArray() ([]string, error) |
| 42 | |
| 43 | // Subsets |
| 44 | remaining() int |
| 45 | getSubset(length int) (packetDecoder, error) |
| 46 | peek(offset, length int) (packetDecoder, error) // similar to getSubset, but it doesn't advance the offset |
| 47 | peekInt8(offset int) (int8, error) // similar to peek, but just one byte |
| 48 | |
| 49 | // Stacks, see PushDecoder |
| 50 | push(in pushDecoder) error |
| 51 | pop() error |
| 52 | |
| 53 | // To record metrics when provided |
| 54 | metricRegistry() metrics.Registry |
| 55 | } |
| 56 | |
| 57 | // PushDecoder is the interface for decoding fields like CRCs and lengths where the validity |
| 58 | // of the field depends on what is after it in the packet. Start them with PacketDecoder.Push() where |
no outgoing calls
no test coverage detected