codecs

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Jul 25, 2025 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	CustomMessageCodecs = []message.Codec{
		&partialQueryCodec{}, &partialExecuteCodec{}, &partialBatchCodec{},
	}

	CustomRawCodec = frame.NewRawCodec(CustomMessageCodecs...)

	CustomRawCodecsWithCompression = map[string]frame.RawCodec{
		"lz4":    frame.NewRawCodecWithCompression(&lz4.Compressor{}, CustomMessageCodecs...),
		"snappy": frame.NewRawCodecWithCompression(&snappy.Compressor{}, CustomMessageCodecs...),
	}

	DefaultRawCodec                 = frame.NewRawCodec()
	DefaultRawCodecsWithCompression = map[string]frame.RawCodec{
		"lz4":    frame.NewRawCodecWithCompression(&lz4.Compressor{}),
		"snappy": frame.NewRawCodecWithCompression(&snappy.Compressor{}),
	}

	CompressionNames = []string{"lz4", "snappy"}
)

Functions

func DecodeType

func DecodeType(dt datatype.DataType, version primitive.ProtocolVersion, bytes []byte) (interface{}, error)

func EncodeType

func EncodeType(dt datatype.DataType, version primitive.ProtocolVersion, val interface{}) ([]byte, error)

Types

type FrameBodyReader

type FrameBodyReader struct {
	*bytes.Reader
	Body []byte
}

FrameBodyReader is an io.Reader that also contains a reference to the underlying bytes buffer for a frame body. This is used to decode "partial" decode message types without requiring copying the underlying data for certain frame fields. This can avoid extra allocations and copies.

func NewFrameBodyReader

func NewFrameBodyReader(b []byte) *FrameBodyReader

func (*FrameBodyReader) BytesSince

func (r *FrameBodyReader) BytesSince(pos int64) []byte

func (*FrameBodyReader) Position

func (r *FrameBodyReader) Position() int64

func (*FrameBodyReader) RemainingBytes

func (r *FrameBodyReader) RemainingBytes() []byte

type PartialBatch

type PartialBatch struct {
	Type        primitive.BatchType
	Queries     []PartialBatchQuery
	Consistency primitive.ConsistencyLevel
	Parameters  []byte // The rest of the batch message
}

func (PartialBatch) DeepCopyMessage

func (p PartialBatch) DeepCopyMessage() message.Message

func (PartialBatch) GetOpCode

func (p PartialBatch) GetOpCode() primitive.OpCode

func (PartialBatch) IsResponse

func (p PartialBatch) IsResponse() bool

func (PartialBatch) String

func (p PartialBatch) String() string

type PartialBatchQuery

type PartialBatchQuery struct {
	QueryOrId interface{}
	Values    []byte
}

type PartialExecute

type PartialExecute struct {
	QueryId          []byte
	ResultMetadataId []byte
	Consistency      primitive.ConsistencyLevel
	Parameters       []byte // The rest of the execute message
}

func (*PartialExecute) DeepCopyMessage

func (m *PartialExecute) DeepCopyMessage() message.Message

func (*PartialExecute) GetOpCode

func (m *PartialExecute) GetOpCode() primitive.OpCode

func (*PartialExecute) IsResponse

func (m *PartialExecute) IsResponse() bool

func (*PartialExecute) String

func (m *PartialExecute) String() string

type PartialQuery

type PartialQuery struct {
	Query       string
	Consistency primitive.ConsistencyLevel
	Parameters  []byte // The rest of the query message
}

func (*PartialQuery) DeepCopyMessage

func (p *PartialQuery) DeepCopyMessage() message.Message

func (*PartialQuery) GetOpCode

func (p *PartialQuery) GetOpCode() primitive.OpCode

func (*PartialQuery) IsResponse

func (p *PartialQuery) IsResponse() bool

func (*PartialQuery) String

func (p *PartialQuery) String() string

Jump to

Keyboard shortcuts

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