thrift

package
v0.6.1 Latest Latest
Warning

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

Go to latest
Published: Jul 31, 2023 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewThriftCodec

func NewThriftCodec() remote.PayloadCodec

NewThriftCodec creates the thrift binary codec.

func NewThriftCodecDisableFastMode

func NewThriftCodecDisableFastMode(disableFastWrite, disableFastRead bool) remote.PayloadCodec

NewThriftCodecDisableFastMode creates the thrift binary codec which can control if do fast codec. Eg: xxxservice.NewServer(handler, server.WithPayloadCodec(thrift.NewThriftCodecDisableFastMode(true, true)))

func NewThriftCodecWithConfig

func NewThriftCodecWithConfig(c CodecType) remote.PayloadCodec

NewThriftFrugalCodec creates the thrift binary codec powered by frugal. Eg: xxxservice.NewServer(handler, server.WithPayloadCodec(thrift.NewThriftCodecWithConfig(thrift.FastWrite | thrift.FastRead)))

Types

type BinaryProtocol

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

BinaryProtocol ...

func NewBinaryProtocol

func NewBinaryProtocol(t remote.ByteBuffer) *BinaryProtocol

NewBinaryProtocol ...

func (*BinaryProtocol) Flush

func (p *BinaryProtocol) Flush(ctx context.Context) (err error)

Flush ...

func (*BinaryProtocol) ReadBinary

func (p *BinaryProtocol) ReadBinary() ([]byte, error)

ReadBinary ...

func (*BinaryProtocol) ReadBool

func (p *BinaryProtocol) ReadBool() (bool, error)

ReadBool ...

func (*BinaryProtocol) ReadByte

func (p *BinaryProtocol) ReadByte() (value int8, err error)

ReadByte ...

func (*BinaryProtocol) ReadDouble

func (p *BinaryProtocol) ReadDouble() (value float64, err error)

ReadDouble ...

func (*BinaryProtocol) ReadFieldBegin

func (p *BinaryProtocol) ReadFieldBegin() (name string, typeID thrift.TType, id int16, err error)

ReadFieldBegin ...

func (*BinaryProtocol) ReadFieldEnd

func (p *BinaryProtocol) ReadFieldEnd() error

ReadFieldEnd ...

func (*BinaryProtocol) ReadI16

func (p *BinaryProtocol) ReadI16() (value int16, err error)

ReadI16 ...

func (*BinaryProtocol) ReadI32

func (p *BinaryProtocol) ReadI32() (value int32, err error)

ReadI32 ...

func (*BinaryProtocol) ReadI64

func (p *BinaryProtocol) ReadI64() (value int64, err error)

ReadI64 ...

func (*BinaryProtocol) ReadListBegin

func (p *BinaryProtocol) ReadListBegin() (elemType thrift.TType, size int, err error)

ReadListBegin ...

func (*BinaryProtocol) ReadListEnd

func (p *BinaryProtocol) ReadListEnd() error

ReadListEnd ...

func (*BinaryProtocol) ReadMapBegin

func (p *BinaryProtocol) ReadMapBegin() (kType, vType thrift.TType, size int, err error)

ReadMapBegin ...

func (*BinaryProtocol) ReadMapEnd

func (p *BinaryProtocol) ReadMapEnd() error

ReadMapEnd ...

func (*BinaryProtocol) ReadMessageBegin

func (p *BinaryProtocol) ReadMessageBegin() (name string, typeID thrift.TMessageType, seqID int32, err error)

ReadMessageBegin ...

func (*BinaryProtocol) ReadMessageEnd

func (p *BinaryProtocol) ReadMessageEnd() error

ReadMessageEnd ...

func (*BinaryProtocol) ReadSetBegin

func (p *BinaryProtocol) ReadSetBegin() (elemType thrift.TType, size int, err error)

ReadSetBegin ...

func (*BinaryProtocol) ReadSetEnd

func (p *BinaryProtocol) ReadSetEnd() error

ReadSetEnd ...

func (*BinaryProtocol) ReadString

func (p *BinaryProtocol) ReadString() (value string, err error)

ReadString ...

func (*BinaryProtocol) ReadStructBegin

func (p *BinaryProtocol) ReadStructBegin() (name string, err error)

ReadStructBegin ...

func (*BinaryProtocol) ReadStructEnd

func (p *BinaryProtocol) ReadStructEnd() error

ReadStructEnd ...

func (*BinaryProtocol) Recycle

func (p *BinaryProtocol) Recycle()

Recycle ...

func (*BinaryProtocol) Skip

func (p *BinaryProtocol) Skip(fieldType thrift.TType) (err error)

Skip ...

func (*BinaryProtocol) Transport

func (p *BinaryProtocol) Transport() thrift.TTransport

Transport ...

func (*BinaryProtocol) WriteBinary

func (p *BinaryProtocol) WriteBinary(value []byte) error

WriteBinary ...

func (*BinaryProtocol) WriteBool

func (p *BinaryProtocol) WriteBool(value bool) error

WriteBool ...

func (*BinaryProtocol) WriteByte

func (p *BinaryProtocol) WriteByte(value int8) error

WriteByte ...

func (*BinaryProtocol) WriteDouble

func (p *BinaryProtocol) WriteDouble(value float64) error

WriteDouble ...

func (*BinaryProtocol) WriteFieldBegin

func (p *BinaryProtocol) WriteFieldBegin(name string, typeID thrift.TType, id int16) error

WriteFieldBegin ...

func (*BinaryProtocol) WriteFieldEnd

func (p *BinaryProtocol) WriteFieldEnd() error

WriteFieldEnd ...

func (*BinaryProtocol) WriteFieldStop

func (p *BinaryProtocol) WriteFieldStop() error

WriteFieldStop ...

func (*BinaryProtocol) WriteI16

func (p *BinaryProtocol) WriteI16(value int16) error

WriteI16 ...

func (*BinaryProtocol) WriteI32

func (p *BinaryProtocol) WriteI32(value int32) error

WriteI32 ...

func (*BinaryProtocol) WriteI64

func (p *BinaryProtocol) WriteI64(value int64) error

WriteI64 ...

func (*BinaryProtocol) WriteListBegin

func (p *BinaryProtocol) WriteListBegin(elemType thrift.TType, size int) error

WriteListBegin ...

func (*BinaryProtocol) WriteListEnd

func (p *BinaryProtocol) WriteListEnd() error

WriteListEnd ...

func (*BinaryProtocol) WriteMapBegin

func (p *BinaryProtocol) WriteMapBegin(keyType, valueType thrift.TType, size int) error

WriteMapBegin ...

func (*BinaryProtocol) WriteMapEnd

func (p *BinaryProtocol) WriteMapEnd() error

WriteMapEnd ...

func (*BinaryProtocol) WriteMessageBegin

func (p *BinaryProtocol) WriteMessageBegin(name string, typeID thrift.TMessageType, seqID int32) error

WriteMessageBegin ...

func (*BinaryProtocol) WriteMessageEnd

func (p *BinaryProtocol) WriteMessageEnd() error

WriteMessageEnd ...

func (*BinaryProtocol) WriteSetBegin

func (p *BinaryProtocol) WriteSetBegin(elemType thrift.TType, size int) error

WriteSetBegin ...

func (*BinaryProtocol) WriteSetEnd

func (p *BinaryProtocol) WriteSetEnd() error

WriteSetEnd ...

func (*BinaryProtocol) WriteString

func (p *BinaryProtocol) WriteString(value string) error

WriteString ...

func (*BinaryProtocol) WriteStructBegin

func (p *BinaryProtocol) WriteStructBegin(name string) error

WriteStructBegin ...

func (*BinaryProtocol) WriteStructEnd

func (p *BinaryProtocol) WriteStructEnd() error

WriteStructEnd ...

type CodecType

type CodecType int

CodecType is config of the thrift codec. Priority: Frugal > FastMode > Normal

const (
	FastWrite CodecType = 1 << iota
	FastRead
)
const (
	// 0x1 0x10 used for FastWrite and FastRead, so Frugal starts from 0x100
	FrugalWrite CodecType = 1 << (iota + 2)
	FrugalRead
)

type MessageReader

type MessageReader interface {
	Read(oprot thrift.TProtocol) error
}

MessageReader read from thrift.TProtocol

type MessageReaderWithMethodWithContext

type MessageReaderWithMethodWithContext interface {
	Read(ctx context.Context, method string, oprot thrift.TProtocol) error
}

MessageReaderWithMethodWithContext read from thrift.TProtocol with method

type MessageWriter

type MessageWriter interface {
	Write(oprot thrift.TProtocol) error
}

MessageWriter write to thrift.TProtocol

type MessageWriterWithContext

type MessageWriterWithContext interface {
	Write(ctx context.Context, oprot thrift.TProtocol) error
}

MessageWriterWithContext write to thrift.TProtocol

type ThriftMsgFastCodec

type ThriftMsgFastCodec interface {
	BLength() int
	FastWriteNocopy(buf []byte, binaryWriter bthrift.BinaryWriter) int
	FastRead(buf []byte) (int, error)
}

Jump to

Keyboard shortcuts

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