Documentation
¶
Index ¶
- Constants
- Variables
- func FastMarshal(msg FastCodec) []byte
- func FastUnmarshal(buf []byte, msg FastCodec) error
- func MarshalFastMsg(method string, msgType TMessageType, seq int32, msg FastCodec) ([]byte, error)
- func PrependError(prepend string, err error) error
- func UnmarshalFastMsg(b []byte, msg FastCodec) (method string, seq int32, err error)
- type ApplicationException
- func (e *ApplicationException) BLength() int
- func (e *ApplicationException) Error() string
- func (e *ApplicationException) FastRead(b []byte) (off int, err error)
- func (e *ApplicationException) FastWrite(b []byte) (off int)
- func (e *ApplicationException) FastWriteNocopy(b []byte, _ NocopyWriter) int
- func (e *ApplicationException) Msg() string
- func (e *ApplicationException) String() string
- func (e *ApplicationException) TypeID() int32
- func (e *ApplicationException) TypeId() int32
- type BinaryProtocol
- func (p BinaryProtocol) AppendBinary(buf, v []byte) []byte
- func (BinaryProtocol) AppendBool(buf []byte, v bool) []byte
- func (BinaryProtocol) AppendByte(buf []byte, v int8) []byte
- func (BinaryProtocol) AppendDouble(buf []byte, v float64) []byte
- func (BinaryProtocol) AppendFieldBegin(buf []byte, typeID TType, id int16) []byte
- func (BinaryProtocol) AppendFieldStop(buf []byte) []byte
- func (BinaryProtocol) AppendI16(buf []byte, v int16) []byte
- func (BinaryProtocol) AppendI32(buf []byte, v int32) []byte
- func (BinaryProtocol) AppendI64(buf []byte, v int64) []byte
- func (p BinaryProtocol) AppendListBegin(buf []byte, et TType, size int) []byte
- func (p BinaryProtocol) AppendMapBegin(buf []byte, kt, vt TType, size int) []byte
- func (p BinaryProtocol) AppendMessageBegin(buf []byte, name string, typeID TMessageType, seq int32) []byte
- func (p BinaryProtocol) AppendSetBegin(buf []byte, et TType, size int) []byte
- func (p BinaryProtocol) AppendString(buf []byte, v string) []byte
- func (BinaryProtocol) BinaryLength(v []byte) int
- func (BinaryProtocol) BinaryLengthNocopy(v []byte) int
- func (BinaryProtocol) BoolLength() int
- func (BinaryProtocol) ByteLength() int
- func (BinaryProtocol) DoubleLength() int
- func (BinaryProtocol) FieldBeginLength() int
- func (BinaryProtocol) FieldStopLength() int
- func (BinaryProtocol) I16Length() int
- func (BinaryProtocol) I32Length() int
- func (BinaryProtocol) I64Length() int
- func (BinaryProtocol) ListBeginLength() int
- func (BinaryProtocol) MapBeginLength() int
- func (BinaryProtocol) MessageBeginLength(method string) int
- func (p BinaryProtocol) ReadBinary(buf []byte) (b []byte, l int, err error)
- func (BinaryProtocol) ReadBool(buf []byte) (v bool, l int, err error)
- func (BinaryProtocol) ReadByte(buf []byte) (v int8, l int, err error)
- func (BinaryProtocol) ReadDouble(buf []byte) (v float64, l int, err error)
- func (BinaryProtocol) ReadFieldBegin(buf []byte) (typeID TType, id int16, l int, err error)
- func (BinaryProtocol) ReadI16(buf []byte) (v int16, l int, err error)
- func (BinaryProtocol) ReadI32(buf []byte) (v int32, l int, err error)
- func (BinaryProtocol) ReadI64(buf []byte) (v int64, l int, err error)
- func (BinaryProtocol) ReadListBegin(buf []byte) (et TType, size, l int, err error)
- func (BinaryProtocol) ReadMapBegin(buf []byte) (kt, vt TType, size, l int, err error)
- func (p BinaryProtocol) ReadMessageBegin(buf []byte) (name string, typeID TMessageType, seq int32, l int, err error)
- func (BinaryProtocol) ReadSetBegin(buf []byte) (et TType, size, l int, err error)
- func (p BinaryProtocol) ReadString(buf []byte) (s string, l int, err error)
- func (BinaryProtocol) SetBeginLength() int
- func (BinaryProtocol) Skip(b []byte, t TType) (int, error)
- func (BinaryProtocol) StringLength(v string) int
- func (BinaryProtocol) StringLengthNocopy(v string) int
- func (BinaryProtocol) WriteBinary(buf, v []byte) int
- func (p BinaryProtocol) WriteBinaryNocopy(buf []byte, w NocopyWriter, v []byte) int
- func (BinaryProtocol) WriteBool(buf []byte, v bool) int
- func (BinaryProtocol) WriteByte(buf []byte, v int8) int
- func (BinaryProtocol) WriteDouble(buf []byte, v float64) int
- func (BinaryProtocol) WriteFieldBegin(buf []byte, typeID TType, id int16) int
- func (BinaryProtocol) WriteFieldStop(buf []byte) int
- func (BinaryProtocol) WriteI16(buf []byte, v int16) int
- func (BinaryProtocol) WriteI32(buf []byte, v int32) int
- func (BinaryProtocol) WriteI64(buf []byte, v int64) int
- func (BinaryProtocol) WriteListBegin(buf []byte, et TType, size int) int
- func (BinaryProtocol) WriteMapBegin(buf []byte, kt, vt TType, size int) int
- func (BinaryProtocol) WriteMessageBegin(buf []byte, name string, typeID TMessageType, seq int32) int
- func (BinaryProtocol) WriteSetBegin(buf []byte, et TType, size int) int
- func (BinaryProtocol) WriteString(buf []byte, v string) int
- func (p BinaryProtocol) WriteStringNocopy(buf []byte, w NocopyWriter, v string) int
- type BinaryReader
- func (r *BinaryReader) ReadBinary() (b []byte, err error)
- func (r *BinaryReader) ReadBool() (v bool, err error)
- func (r *BinaryReader) ReadByte() (v int8, err error)
- func (r *BinaryReader) ReadDouble() (v float64, err error)
- func (r *BinaryReader) ReadFieldBegin() (typeID TType, id int16, err error)
- func (r *BinaryReader) ReadI16() (v int16, err error)
- func (r *BinaryReader) ReadI32() (v int32, err error)
- func (r *BinaryReader) ReadI64() (v int64, err error)
- func (r *BinaryReader) ReadListBegin() (et TType, size int, err error)
- func (r *BinaryReader) ReadMapBegin() (kt, vt TType, size int, err error)
- func (r *BinaryReader) ReadMessageBegin() (name string, typeID TMessageType, seq int32, err error)
- func (r *BinaryReader) ReadSetBegin() (et TType, size int, err error)
- func (r *BinaryReader) ReadString() (s string, err error)
- func (r *BinaryReader) Readn() int64
- func (r *BinaryReader) Release()
- func (r *BinaryReader) Skip(t TType) error
- type BinaryWriter
- func (w *BinaryWriter) Bytes() []byte
- func (w *BinaryWriter) Release()
- func (w *BinaryWriter) Reset()
- func (w *BinaryWriter) WriteBinary(v []byte)
- func (w *BinaryWriter) WriteBool(v bool)
- func (w *BinaryWriter) WriteByte(v int8)
- func (w *BinaryWriter) WriteDouble(v float64)
- func (w *BinaryWriter) WriteFieldBegin(typeID TType, id int16)
- func (w *BinaryWriter) WriteFieldStop()
- func (w *BinaryWriter) WriteI16(v int16)
- func (w *BinaryWriter) WriteI32(v int32)
- func (w *BinaryWriter) WriteI64(v int64)
- func (w *BinaryWriter) WriteListBegin(et TType, size int)
- func (w *BinaryWriter) WriteMapBegin(kt, vt TType, size int)
- func (w *BinaryWriter) WriteMessageBegin(name string, typeID TMessageType, seq int32)
- func (w *BinaryWriter) WriteSetBegin(et TType, size int)
- func (w *BinaryWriter) WriteString(v string)
- type FastCodec
- type NocopyWriter
- type ProtocolException
- type SkipDecoder
- type TMessageType
- type TType
- type TransportException
Constants ¶
const ( UNKNOWN_APPLICATION_EXCEPTION = 0 UNKNOWN_METHOD = 1 INVALID_MESSAGE_TYPE_EXCEPTION = 2 WRONG_METHOD_NAME = 3 BAD_SEQUENCE_ID = 4 MISSING_RESULT = 5 INTERNAL_ERROR = 6 PROTOCOL_ERROR = 7 INVALID_TRANSFORM = 8 INVALID_PROTOCOL = 9 UNSUPPORTED_CLIENT_TYPE = 10 )
const ( UNKNOWN_PROTOCOL_EXCEPTION = 0 INVALID_DATA = 1 NEGATIVE_SIZE = 2 SIZE_LIMIT = 3 BAD_VERSION = 4 NOT_IMPLEMENTED = 5 DEPTH_LIMIT = 6 )
Variables ¶
var NocopyWriteThreshold = 4096
NocopyWriteThreshold represents the threshold of using `NocopyWriter` for binary or string
It's used by `WriteBinaryNocopy` and `WriteStringNocopy` of `BinaryProtocol` which are relied by kitex tool or thriftgo
Functions ¶
func FastMarshal ¶
FastMarshal marshals the msg to buf. The msg should implement FastCodec.
func FastUnmarshal ¶
FastUnmarshal unmarshal the buf into msg. The msg should implement FastCodec.
func MarshalFastMsg ¶
MarshalFastMsg encodes the given msg to buf for generic thrift RPC.
func PrependError ¶
Prepends additional information to an error without losing the Thrift exception interface
func UnmarshalFastMsg ¶
UnmarshalFastMsg parses the given buf and stores the result to msg for generic thrift RPC. for EXCEPTION msgType, it will returns `err` with *ApplicationException type without storing the result to msg.
Types ¶
type ApplicationException ¶
type ApplicationException struct {
// contains filtered or unexported fields
}
ApplicationException is for replacing apache.TApplicationException it implements ThriftFastCodec interface.
func NewApplicationException ¶
func NewApplicationException(t int32, msg string) *ApplicationException
NewApplicationException creates an ApplicationException instance
func (*ApplicationException) BLength ¶
func (e *ApplicationException) BLength() int
BLength returns the len of encoded buffer.
func (*ApplicationException) FastRead ¶
func (e *ApplicationException) FastRead(b []byte) (off int, err error)
FastRead ...
func (*ApplicationException) FastWrite ¶
func (e *ApplicationException) FastWrite(b []byte) (off int)
FastWrite ...
func (*ApplicationException) FastWriteNocopy ¶
func (e *ApplicationException) FastWriteNocopy(b []byte, _ NocopyWriter) int
FastWriteNocopy ...
func (*ApplicationException) TypeID ¶
func (e *ApplicationException) TypeID() int32
TypeID ... for kitex
func (*ApplicationException) TypeId ¶
func (e *ApplicationException) TypeId() int32
TypeId ... for apache ApplicationException compatibility
type BinaryProtocol ¶
type BinaryProtocol struct{}
var Binary BinaryProtocol
func (BinaryProtocol) AppendBinary ¶
func (p BinaryProtocol) AppendBinary(buf, v []byte) []byte
func (BinaryProtocol) AppendBool ¶
func (BinaryProtocol) AppendBool(buf []byte, v bool) []byte
func (BinaryProtocol) AppendByte ¶
func (BinaryProtocol) AppendByte(buf []byte, v int8) []byte
func (BinaryProtocol) AppendDouble ¶
func (BinaryProtocol) AppendDouble(buf []byte, v float64) []byte
func (BinaryProtocol) AppendFieldBegin ¶
func (BinaryProtocol) AppendFieldBegin(buf []byte, typeID TType, id int16) []byte
func (BinaryProtocol) AppendFieldStop ¶
func (BinaryProtocol) AppendFieldStop(buf []byte) []byte
func (BinaryProtocol) AppendListBegin ¶
func (p BinaryProtocol) AppendListBegin(buf []byte, et TType, size int) []byte
func (BinaryProtocol) AppendMapBegin ¶
func (p BinaryProtocol) AppendMapBegin(buf []byte, kt, vt TType, size int) []byte
func (BinaryProtocol) AppendMessageBegin ¶
func (p BinaryProtocol) AppendMessageBegin(buf []byte, name string, typeID TMessageType, seq int32) []byte
func (BinaryProtocol) AppendSetBegin ¶
func (p BinaryProtocol) AppendSetBegin(buf []byte, et TType, size int) []byte
func (BinaryProtocol) AppendString ¶
func (p BinaryProtocol) AppendString(buf []byte, v string) []byte
func (BinaryProtocol) BinaryLength ¶
func (BinaryProtocol) BinaryLength(v []byte) int
func (BinaryProtocol) BinaryLengthNocopy ¶
func (BinaryProtocol) BinaryLengthNocopy(v []byte) int
func (BinaryProtocol) BoolLength ¶
func (BinaryProtocol) BoolLength() int
func (BinaryProtocol) ByteLength ¶
func (BinaryProtocol) ByteLength() int
func (BinaryProtocol) DoubleLength ¶
func (BinaryProtocol) DoubleLength() int
func (BinaryProtocol) FieldBeginLength ¶
func (BinaryProtocol) FieldBeginLength() int
func (BinaryProtocol) FieldStopLength ¶
func (BinaryProtocol) FieldStopLength() int
func (BinaryProtocol) I16Length ¶
func (BinaryProtocol) I16Length() int
func (BinaryProtocol) I32Length ¶
func (BinaryProtocol) I32Length() int
func (BinaryProtocol) I64Length ¶
func (BinaryProtocol) I64Length() int
func (BinaryProtocol) ListBeginLength ¶
func (BinaryProtocol) ListBeginLength() int
func (BinaryProtocol) MapBeginLength ¶
func (BinaryProtocol) MapBeginLength() int
func (BinaryProtocol) MessageBeginLength ¶
func (BinaryProtocol) MessageBeginLength(method string) int
func (BinaryProtocol) ReadBinary ¶
func (p BinaryProtocol) ReadBinary(buf []byte) (b []byte, l int, err error)
func (BinaryProtocol) ReadBool ¶
func (BinaryProtocol) ReadBool(buf []byte) (v bool, l int, err error)
func (BinaryProtocol) ReadByte ¶
func (BinaryProtocol) ReadByte(buf []byte) (v int8, l int, err error)
func (BinaryProtocol) ReadDouble ¶
func (BinaryProtocol) ReadDouble(buf []byte) (v float64, l int, err error)
func (BinaryProtocol) ReadFieldBegin ¶
func (BinaryProtocol) ReadI16 ¶
func (BinaryProtocol) ReadI16(buf []byte) (v int16, l int, err error)
func (BinaryProtocol) ReadI32 ¶
func (BinaryProtocol) ReadI32(buf []byte) (v int32, l int, err error)
func (BinaryProtocol) ReadI64 ¶
func (BinaryProtocol) ReadI64(buf []byte) (v int64, l int, err error)
func (BinaryProtocol) ReadListBegin ¶
func (BinaryProtocol) ReadListBegin(buf []byte) (et TType, size, l int, err error)
func (BinaryProtocol) ReadMapBegin ¶
func (BinaryProtocol) ReadMapBegin(buf []byte) (kt, vt TType, size, l int, err error)
func (BinaryProtocol) ReadMessageBegin ¶
func (p BinaryProtocol) ReadMessageBegin(buf []byte) (name string, typeID TMessageType, seq int32, l int, err error)
func (BinaryProtocol) ReadSetBegin ¶
func (BinaryProtocol) ReadSetBegin(buf []byte) (et TType, size, l int, err error)
func (BinaryProtocol) ReadString ¶
func (p BinaryProtocol) ReadString(buf []byte) (s string, l int, err error)
func (BinaryProtocol) SetBeginLength ¶
func (BinaryProtocol) SetBeginLength() int
func (BinaryProtocol) Skip ¶
func (BinaryProtocol) Skip(b []byte, t TType) (int, error)
Skip skips over the value for the given type using Go implementation.
func (BinaryProtocol) StringLength ¶
func (BinaryProtocol) StringLength(v string) int
func (BinaryProtocol) StringLengthNocopy ¶
func (BinaryProtocol) StringLengthNocopy(v string) int
func (BinaryProtocol) WriteBinary ¶
func (BinaryProtocol) WriteBinary(buf, v []byte) int
func (BinaryProtocol) WriteBinaryNocopy ¶
func (p BinaryProtocol) WriteBinaryNocopy(buf []byte, w NocopyWriter, v []byte) int
func (BinaryProtocol) WriteDouble ¶
func (BinaryProtocol) WriteDouble(buf []byte, v float64) int
func (BinaryProtocol) WriteFieldBegin ¶
func (BinaryProtocol) WriteFieldBegin(buf []byte, typeID TType, id int16) int
func (BinaryProtocol) WriteFieldStop ¶
func (BinaryProtocol) WriteFieldStop(buf []byte) int
func (BinaryProtocol) WriteListBegin ¶
func (BinaryProtocol) WriteListBegin(buf []byte, et TType, size int) int
func (BinaryProtocol) WriteMapBegin ¶
func (BinaryProtocol) WriteMapBegin(buf []byte, kt, vt TType, size int) int
func (BinaryProtocol) WriteMessageBegin ¶
func (BinaryProtocol) WriteMessageBegin(buf []byte, name string, typeID TMessageType, seq int32) int
func (BinaryProtocol) WriteSetBegin ¶
func (BinaryProtocol) WriteSetBegin(buf []byte, et TType, size int) int
func (BinaryProtocol) WriteString ¶
func (BinaryProtocol) WriteString(buf []byte, v string) int
func (BinaryProtocol) WriteStringNocopy ¶
func (p BinaryProtocol) WriteStringNocopy(buf []byte, w NocopyWriter, v string) int
type BinaryReader ¶
type BinaryReader struct {
// contains filtered or unexported fields
}
BinaryReader represents a reader for binary protocol
func NewBinaryReader ¶
func NewBinaryReader(r io.Reader) *BinaryReader
NewBinaryReader ... call Release if no longer use for reusing
func (*BinaryReader) ReadBinary ¶
func (r *BinaryReader) ReadBinary() (b []byte, err error)
ReadBinary ...
func (*BinaryReader) ReadDouble ¶
func (r *BinaryReader) ReadDouble() (v float64, err error)
ReadDouble ...
func (*BinaryReader) ReadFieldBegin ¶
func (r *BinaryReader) ReadFieldBegin() (typeID TType, id int16, err error)
ReadFieldBegin ...
func (*BinaryReader) ReadListBegin ¶
func (r *BinaryReader) ReadListBegin() (et TType, size int, err error)
ReadListBegin ...
func (*BinaryReader) ReadMapBegin ¶
func (r *BinaryReader) ReadMapBegin() (kt, vt TType, size int, err error)
ReadMapBegin ...
func (*BinaryReader) ReadMessageBegin ¶
func (r *BinaryReader) ReadMessageBegin() (name string, typeID TMessageType, seq int32, err error)
ReadMessageBegin ...
func (*BinaryReader) ReadSetBegin ¶
func (r *BinaryReader) ReadSetBegin() (et TType, size int, err error)
ReadSetBegin ...
func (*BinaryReader) ReadString ¶
func (r *BinaryReader) ReadString() (s string, err error)
ReadString ...
func (*BinaryReader) Readn ¶
func (r *BinaryReader) Readn() int64
Readn returns total bytes read from underlying reader
type BinaryWriter ¶
type BinaryWriter struct {
// contains filtered or unexported fields
}
func NewBinaryWriter ¶
func NewBinaryWriter() *BinaryWriter
func NewBinaryWriterSize ¶
func NewBinaryWriterSize(sz int) *BinaryWriter
func (*BinaryWriter) Bytes ¶
func (w *BinaryWriter) Bytes() []byte
func (*BinaryWriter) Release ¶
func (w *BinaryWriter) Release()
func (*BinaryWriter) Reset ¶
func (w *BinaryWriter) Reset()
func (*BinaryWriter) WriteBinary ¶
func (w *BinaryWriter) WriteBinary(v []byte)
func (*BinaryWriter) WriteBool ¶
func (w *BinaryWriter) WriteBool(v bool)
func (*BinaryWriter) WriteByte ¶
func (w *BinaryWriter) WriteByte(v int8)
func (*BinaryWriter) WriteDouble ¶
func (w *BinaryWriter) WriteDouble(v float64)
func (*BinaryWriter) WriteFieldBegin ¶
func (w *BinaryWriter) WriteFieldBegin(typeID TType, id int16)
func (*BinaryWriter) WriteFieldStop ¶
func (w *BinaryWriter) WriteFieldStop()
func (*BinaryWriter) WriteI16 ¶
func (w *BinaryWriter) WriteI16(v int16)
func (*BinaryWriter) WriteI32 ¶
func (w *BinaryWriter) WriteI32(v int32)
func (*BinaryWriter) WriteI64 ¶
func (w *BinaryWriter) WriteI64(v int64)
func (*BinaryWriter) WriteListBegin ¶
func (w *BinaryWriter) WriteListBegin(et TType, size int)
func (*BinaryWriter) WriteMapBegin ¶
func (w *BinaryWriter) WriteMapBegin(kt, vt TType, size int)
func (*BinaryWriter) WriteMessageBegin ¶
func (w *BinaryWriter) WriteMessageBegin(name string, typeID TMessageType, seq int32)
func (*BinaryWriter) WriteSetBegin ¶
func (w *BinaryWriter) WriteSetBegin(et TType, size int)
func (*BinaryWriter) WriteString ¶
func (w *BinaryWriter) WriteString(v string)
type FastCodec ¶
type FastCodec interface {
BLength() int
FastWriteNocopy(buf []byte, bw NocopyWriter) int
FastRead(buf []byte) (int, error)
}
FastCodec represents the interface of thrift fastcodec generated structs
type NocopyWriter ¶
BinaryWriter represents the method used in thrift encoding for nocopy writes It supports netpoll nocopy feature, see: https://github.com/cloudwego/netpoll/blob/develop/nocopy.go
type ProtocolException ¶
type ProtocolException struct {
ApplicationException // same implementation ...
// contains filtered or unexported fields
}
ProtocolException is for replacing apache.ProtocolException it implements ThriftFastCodec interface.
func NewProtocolException ¶
func NewProtocolException(t int32, m string) *ProtocolException
NewTransportExceptionWithType
func NewProtocolExceptionWithErr ¶
func NewProtocolExceptionWithErr(err error) *ProtocolException
NewProtocolException ...
func (*ProtocolException) Unwrap ¶
func (e *ProtocolException) Unwrap() error
Unwrap ... for errors pkg
type SkipDecoder ¶
type SkipDecoder struct {
// contains filtered or unexported fields
}
SkipDecoder scans the underlying io.Reader and returns the bytes of a type
func NewSkipDecoder ¶
func NewSkipDecoder(r io.Reader) *SkipDecoder
NewSkipDecoder ... call Release if no longer use
type TMessageType ¶
type TMessageType = int32 // use alias for better flexibility of interfaces
TMessageType represents message type constants in the Thrift protocol. originally from github.com/apache/thrift
const ( INVALID_TMESSAGE_TYPE TMessageType = 0 CALL TMessageType = 1 REPLY TMessageType = 2 EXCEPTION TMessageType = 3 ONEWAY TMessageType = 4 )
type TType ¶
type TType = int8 // use alias for better flexibility of interfaces
TType represents field type constants in the Thrift protocol originally from github.com/apache/thrift
type TransportException ¶
type TransportException struct {
ApplicationException // same implementation ...
}
TransportException is for replacing apache.TransportException it implements ThriftFastCodec interface.
func NewTransportException ¶
func NewTransportException(t int32, m string) *TransportException
NewTransportException ...
Source Files
¶
Directories
¶
| Path | Synopsis |
|---|---|
|
Package apache contains code for working with apache thrift indirectly
|
Package apache contains code for working with apache thrift indirectly |
|
Code generated by thriftgo (0.3.15) (fastgo).
|
Code generated by thriftgo (0.3.15) (fastgo). |