codec

package
v0.0.0-...-fcf41b5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 3, 2022 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrInsufficientData = errors.New("kafka: insufficient data to decode packet, more bytes expected")
View Source
var ErrInvalidBool = errors.New("kafka: invalid bool")
View Source
var ErrUVarIntOverflow = errors.New("kafka: uvarint overflow")
View Source
var ErrVarIntOverflow = errors.New("kafka: varint overflow")

Functions

This section is empty.

Types

type PackerReader

type PackerReader struct {
	*RawDecoder
}

func NewPacketReader

func NewPacketReader(packet *Packet) *PackerReader

type Packet

type Packet struct {
	ReqHeader *RequestHeader

	Key     *int16
	Version *int16
	Data    *bytes.Buffer
}

func DecodePacket

func DecodePacket(encodedData []byte) (*Packet, error)

func (*Packet) Encode

func (p *Packet) Encode(correlationId int32) ([]byte, error)

type PacketBuilder

type PacketBuilder struct {
	Encoder RawEncoder
	// contains filtered or unexported fields
}

func NewPacketBuilder

func NewPacketBuilder(key int16, version int16) *PacketBuilder

func (*PacketBuilder) ToPacket

func (builder *PacketBuilder) ToPacket() *Packet

type RawDecoder

type RawDecoder struct {
	Buff *bytes.Buffer
}

func (*RawDecoder) ArrayLength

func (pd *RawDecoder) ArrayLength() (int32, error)

func (*RawDecoder) Bool

func (pd *RawDecoder) Bool() (bool, error)

func (*RawDecoder) Bytes

func (pd *RawDecoder) Bytes() ([]byte, error)

func (*RawDecoder) Close

func (pd *RawDecoder) Close() error

func (*RawDecoder) CompactArrayLength

func (pd *RawDecoder) CompactArrayLength() (uint64, error)

func (*RawDecoder) CompactBytes

func (pd *RawDecoder) CompactBytes() ([]byte, error)

func (*RawDecoder) CompactNullableBytes

func (pd *RawDecoder) CompactNullableBytes() ([]byte, error)

func (*RawDecoder) CompactNullableString

func (pd *RawDecoder) CompactNullableString() (*string, error)

func (*RawDecoder) CompactRecords

func (pd *RawDecoder) CompactRecords() ([]byte, error)

func (*RawDecoder) CompactString

func (pd *RawDecoder) CompactString() (string, error)

func (*RawDecoder) Int16

func (pd *RawDecoder) Int16() (int16, error)

func (*RawDecoder) Int32

func (pd *RawDecoder) Int32() (int32, error)

func (*RawDecoder) Int64

func (pd *RawDecoder) Int64() (int64, error)

func (*RawDecoder) Int8

func (pd *RawDecoder) Int8() (int8, error)

func (*RawDecoder) NullableArrayLength

func (pd *RawDecoder) NullableArrayLength() (*int32, error)

func (*RawDecoder) NullableBytes

func (pd *RawDecoder) NullableBytes() ([]byte, error)

func (*RawDecoder) NullableString

func (pd *RawDecoder) NullableString() (*string, error)

func (*RawDecoder) Records

func (pd *RawDecoder) Records() ([]byte, error)

func (*RawDecoder) String

func (pd *RawDecoder) String() (string, error)

func (*RawDecoder) UVarInt

func (pd *RawDecoder) UVarInt() (uint64, error)

func (*RawDecoder) VarInt

func (pd *RawDecoder) VarInt() (int64, error)

type RawEncoder

type RawEncoder struct {
	Buff *bytes.Buffer
}

func (*RawEncoder) ArrayLength

func (pe *RawEncoder) ArrayLength(in int)

func (*RawEncoder) Bool

func (pe *RawEncoder) Bool(in bool)

func (*RawEncoder) Bytes

func (pe *RawEncoder) Bytes(in []byte)

func (*RawEncoder) CompactArrayLength

func (pe *RawEncoder) CompactArrayLength(in int)

func (*RawEncoder) CompactBytes

func (pe *RawEncoder) CompactBytes(in []byte)

func (*RawEncoder) CompactNullableBytes

func (pe *RawEncoder) CompactNullableBytes(in []byte)

func (*RawEncoder) CompactNullableString

func (pe *RawEncoder) CompactNullableString(in *string)

func (*RawEncoder) CompactRecords

func (pe *RawEncoder) CompactRecords(in []byte)

func (*RawEncoder) CompactString

func (pe *RawEncoder) CompactString(in string)

func (*RawEncoder) Int16

func (pe *RawEncoder) Int16(in int16)

func (*RawEncoder) Int32

func (pe *RawEncoder) Int32(in int32)

func (*RawEncoder) Int64

func (pe *RawEncoder) Int64(in int64)

func (*RawEncoder) Int8

func (pe *RawEncoder) Int8(in int8)

func (*RawEncoder) NullableBytes

func (pe *RawEncoder) NullableBytes(in []byte)

func (*RawEncoder) NullableString

func (pe *RawEncoder) NullableString(in *string)

func (*RawEncoder) RawBytes

func (pe *RawEncoder) RawBytes(in []byte)

func (*RawEncoder) Records

func (pe *RawEncoder) Records(in []byte)

func (*RawEncoder) String

func (pe *RawEncoder) String(in string)

func (*RawEncoder) ToBytes

func (pe *RawEncoder) ToBytes() []byte

func (*RawEncoder) UVarInt

func (pe *RawEncoder) UVarInt(in uint64) int

func (*RawEncoder) VarInt

func (pe *RawEncoder) VarInt(in int64) int

type RequestHeader

type RequestHeader struct {
	Key           int16
	Version       int16
	CorrelationId int32
	ClientID      *string
}

func (*RequestHeader) Decode

func (h *RequestHeader) Decode(pd *RawDecoder) (err error)

type ResponseHeader

type ResponseHeader struct {
	Length        int32
	CorrelationId int32
	Version       int16
}

func (*ResponseHeader) Encode

func (h *ResponseHeader) Encode(pe *RawEncoder) (err error)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL