protocol

package
v0.0.0-...-4eb61ea Latest Latest
Warning

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

Go to latest
Published: Aug 6, 2014 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var EncodingError = errors.New("kafka: Error while encoding packet.")
View Source
var InsufficientData = errors.New("kafka: Insufficient data while decoding packet.")
View Source
var PacketSizeError = errors.New("kafka: Unsupported packet size.")

Functions

func ReadPacket

func ReadPacket(r io.Reader) (packet []byte, err error)

func WritePacket

func WritePacket(w io.Writer, packet []byte) (n int, err error)

Types

type BytesDecoder

type BytesDecoder struct {
	// contains filtered or unexported fields
}

func NewBytesDecoder

func NewBytesDecoder(buf []byte) *BytesDecoder

func (*BytesDecoder) GetBytes

func (d *BytesDecoder) GetBytes() ([]byte, error)

func (*BytesDecoder) GetInt16

func (d *BytesDecoder) GetInt16() (int16, error)

func (*BytesDecoder) GetInt32

func (d *BytesDecoder) GetInt32() (int32, error)

func (*BytesDecoder) GetInt32Array

func (d *BytesDecoder) GetInt32Array() ([]int32, error)

func (*BytesDecoder) GetInt64

func (d *BytesDecoder) GetInt64() (int64, error)

func (*BytesDecoder) GetInt64Array

func (d *BytesDecoder) GetInt64Array() ([]int64, error)

func (*BytesDecoder) GetInt8

func (d *BytesDecoder) GetInt8() (int8, error)

func (*BytesDecoder) GetNullString

func (d *BytesDecoder) GetNullString() (NullString, error)

func (*BytesDecoder) GetRaw

func (d *BytesDecoder) GetRaw(n int) ([]byte, error)

func (*BytesDecoder) GetString

func (d *BytesDecoder) GetString() (string, error)

func (*BytesDecoder) Pop

func (d *BytesDecoder) Pop() error

func (*BytesDecoder) Push

func (d *BytesDecoder) Push(in DeferredDecoder) error

func (*BytesDecoder) Rest

func (d *BytesDecoder) Rest() []byte

type BytesEncoder

type BytesEncoder struct {
	// contains filtered or unexported fields
}

func NewBytesEncoder

func NewBytesEncoder() *BytesEncoder

func (*BytesEncoder) Bytes

func (e *BytesEncoder) Bytes() []byte

func (*BytesEncoder) Pop

func (e *BytesEncoder) Pop() error

func (*BytesEncoder) Push

func (e *BytesEncoder) Push(in DeferredEncoder)

func (*BytesEncoder) PutBytes

func (e *BytesEncoder) PutBytes(in []byte) error

func (*BytesEncoder) PutInt16

func (e *BytesEncoder) PutInt16(in int16)

func (*BytesEncoder) PutInt32

func (e *BytesEncoder) PutInt32(in int32)

func (*BytesEncoder) PutInt32Array

func (e *BytesEncoder) PutInt32Array(in []int32) error

func (*BytesEncoder) PutInt64

func (e *BytesEncoder) PutInt64(in int64)

func (*BytesEncoder) PutInt64Array

func (e *BytesEncoder) PutInt64Array(in []int64) error

func (*BytesEncoder) PutInt8

func (e *BytesEncoder) PutInt8(in int8)

func (*BytesEncoder) PutNullString

func (e *BytesEncoder) PutNullString(in NullString) error

func (*BytesEncoder) PutRaw

func (e *BytesEncoder) PutRaw(in []byte)

func (*BytesEncoder) PutString

func (e *BytesEncoder) PutString(in string) error

type CRC32Field

type CRC32Field struct{}

func (CRC32Field) Decode

func (c CRC32Field) Decode(buf []byte) error

func (CRC32Field) Encode

func (c CRC32Field) Encode(buf []byte) error

func (CRC32Field) Length

func (c CRC32Field) Length() int

type Decoder

type Decoder interface {
	Decode(pd PacketDecoder) error
}

type DecodingError

type DecodingError string

func (DecodingError) Error

func (err DecodingError) Error() string

type DeferredDecoder

type DeferredDecoder interface {
	Length() int
	Decode(buf []byte) error
}

type DeferredEncoder

type DeferredEncoder interface {
	Length() int
	Encode(buf []byte) error
}

type Encoder

type Encoder interface {
	Encode(pe PacketEncoder) error
}

type LengthField

type LengthField struct{}

func (LengthField) Decode

func (l LengthField) Decode(buf []byte) error

func (LengthField) Encode

func (l LengthField) Encode(buf []byte) error

func (LengthField) Length

func (l LengthField) Length() int

type NullString

type NullString struct {
	String string
	Valid  bool
}

type PacketDecoder

type PacketDecoder interface {
	GetInt8() (int8, error)
	GetInt16() (int16, error)
	GetInt32() (int32, error)
	GetInt64() (int64, error)
	GetRaw(n int) ([]byte, error)

	GetBytes() ([]byte, error)
	GetString() (string, error)
	GetNullString() (NullString, error)
	GetInt32Array() ([]int32, error)
	GetInt64Array() ([]int64, error)

	Push(in DeferredDecoder) error
	Pop() error
}

type PacketEncoder

type PacketEncoder interface {
	PutInt8(in int8)
	PutInt16(in int16)
	PutInt32(in int32)
	PutInt64(in int64)
	PutRaw(in []byte)

	PutBytes(in []byte) error
	PutString(in string) error
	PutNullString(in NullString) error
	PutInt32Array(in []int32) error
	PutInt64Array(in []int64) error

	Push(in DeferredEncoder)
	Pop() error
}

type RequestHeader

type RequestHeader struct {
	ApiKey        int16
	ApiVersion    int16
	CorrelationId int32
	ClientId      string
}

func (*RequestHeader) Decode

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

func (*RequestHeader) Encode

func (h *RequestHeader) Encode(pe PacketEncoder) (err error)

type ResponseHeader

type ResponseHeader struct {
	CorrelationId int32
}

func (*ResponseHeader) Decode

func (h *ResponseHeader) Decode(pd PacketDecoder) (err error)

func (*ResponseHeader) Encode

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

Jump to

Keyboard shortcuts

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