thrift

package
v2.28.0+incompatible Latest Latest
Warning

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

Go to latest
Published: Apr 30, 2021 License: Apache-2.0 Imports: 10 Imported by: 0

README

Apache Thrift

This is a partial copy of Apache Thrift v0.10 (https://github.com/apache/thrift/commit/b2a4d4ae21c789b689dd162deb819665567f481c).

It is vendored code to avoid compatibility issues introduced in Thrift v0.11.

See https://github.com/jaegertracing/jaeger-client-go/pull/303.

Documentation

Index

Constants

View Source
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
)
View Source
const (
	COMPACT_PROTOCOL_ID       = 0x082
	COMPACT_VERSION           = 1
	COMPACT_VERSION_MASK      = 0x1f
	COMPACT_TYPE_MASK         = 0x0E0
	COMPACT_TYPE_BITS         = 0x07
	COMPACT_TYPE_SHIFT_AMOUNT = 5
)
View Source
const (
	COMPACT_BOOLEAN_TRUE  = 0x01
	COMPACT_BOOLEAN_FALSE = 0x02
	COMPACT_BYTE          = 0x03
	COMPACT_I16           = 0x04
	COMPACT_I32           = 0x05
	COMPACT_I64           = 0x06
	COMPACT_DOUBLE        = 0x07
	COMPACT_BINARY        = 0x08
	COMPACT_LIST          = 0x09
	COMPACT_SET           = 0x0A
	COMPACT_MAP           = 0x0B
	COMPACT_STRUCT        = 0x0C
)
View Source
const (
	VERSION_MASK = 0xffff0000
	VERSION_1    = 0x80010000
)
View Source
const (
	UNKNOWN_PROTOCOL_EXCEPTION = 0
	INVALID_DATA               = 1
	NEGATIVE_SIZE              = 2
	SIZE_LIMIT                 = 3
	BAD_VERSION                = 4
	NOT_IMPLEMENTED            = 5
	DEPTH_LIMIT                = 6
)
View Source
const (
	UNKNOWN_TRANSPORT_EXCEPTION = 0
	NOT_OPEN                    = 1
	ALREADY_OPEN                = 2
	TIMED_OUT                   = 3
	END_OF_FILE                 = 4
)
View Source
const (
	STOP   = 0
	VOID   = 1
	BOOL   = 2
	BYTE   = 3
	I08    = 3
	DOUBLE = 4
	I16    = 6
	I32    = 8
	I64    = 10
	STRING = 11
	UTF7   = 11
	STRUCT = 12
	MAP    = 13
	SET    = 14
	LIST   = 15
	UTF8   = 16
	UTF16  = 17
)
View Source
const DEFAULT_RECURSION_DEPTH = 64

The maximum recursive depth the skip() function will traverse

Variables

View Source
var (
	JSON_COMMA                   []byte
	JSON_COLON                   []byte
	JSON_LBRACE                  []byte
	JSON_RBRACE                  []byte
	JSON_LBRACKET                []byte
	JSON_RBRACKET                []byte
	JSON_QUOTE                   byte
	JSON_QUOTE_BYTES             []byte
	JSON_NULL                    []byte
	JSON_TRUE                    []byte
	JSON_FALSE                   []byte
	JSON_INFINITY                string
	JSON_NEGATIVE_INFINITY       string
	JSON_NAN                     string
	JSON_INFINITY_BYTES          []byte
	JSON_NEGATIVE_INFINITY_BYTES []byte
	JSON_NAN_BYTES               []byte
)

Functions

func PrependError

func PrependError(prepend string, err error) error

Prepends additional information to an error without losing the Thrift exception interface

func Skip

func Skip(self TProtocol, fieldType TType, maxDepth int) (err error)

Skips over the next data element from the provided input TProtocol object.

func SkipDefaultDepth

func SkipDefaultDepth(prot TProtocol, typeId TType) (err error)

Skips over the next data element from the provided input TProtocol object.

Types

type Flusher

type Flusher interface {
	Flush() (err error)
}

type Numeric

type Numeric interface {
	Int64() int64
	Int32() int32
	Int16() int16
	Byte() byte
	Int() int
	Float64() float64
	Float32() float32
	String() string
	// contains filtered or unexported methods
}
var (
	INFINITY          Numeric
	NEGATIVE_INFINITY Numeric
	NAN               Numeric
	ZERO              Numeric
	NUMERIC_NULL      Numeric
)

func NewNullNumeric

func NewNullNumeric() Numeric

func NewNumericFromDouble

func NewNumericFromDouble(dValue float64) Numeric

func NewNumericFromI32

func NewNumericFromI32(iValue int32) Numeric

func NewNumericFromI64

func NewNumericFromI64(iValue int64) Numeric

func NewNumericFromJSONString

func NewNumericFromJSONString(sValue string, isNull bool) Numeric

func NewNumericFromString

func NewNumericFromString(sValue string) Numeric

type ReadSizeProvider

type ReadSizeProvider interface {
	RemainingBytes() (num_bytes uint64)
}

type RichTransport

type RichTransport struct {
	TTransport
}

func NewTRichTransport

func NewTRichTransport(trans TTransport) *RichTransport

Wraps Transport to provide TRichTransport interface

func (*RichTransport) ReadByte

func (r *RichTransport) ReadByte() (c byte, err error)

func (*RichTransport) RemainingBytes

func (r *RichTransport) RemainingBytes() (num_bytes uint64)

func (*RichTransport) WriteByte

func (r *RichTransport) WriteByte(c byte) error

func (*RichTransport) WriteString

func (r *RichTransport) WriteString(s string) (n int, err error)

type TApplicationException

type TApplicationException interface {
	TException
	TypeId() int32
	Read(iprot TProtocol) (TApplicationException, error)
	Write(oprot TProtocol) error
}

Application level Thrift exception

func NewTApplicationException

func NewTApplicationException(type_ int32, message string) TApplicationException

type TBinaryProtocol

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

func NewTBinaryProtocol

func NewTBinaryProtocol(t TTransport, strictRead, strictWrite bool) *TBinaryProtocol

func NewTBinaryProtocolTransport

func NewTBinaryProtocolTransport(t TTransport) *TBinaryProtocol

func (*TBinaryProtocol) Flush

func (p *TBinaryProtocol) Flush() (err error)

func (*TBinaryProtocol) ReadBinary

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

func (*TBinaryProtocol) ReadBool

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

func (*TBinaryProtocol) ReadByte

func (p *TBinaryProtocol) ReadByte() (int8, error)

func (*TBinaryProtocol) ReadDouble

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

func (*TBinaryProtocol) ReadFieldBegin

func (p *TBinaryProtocol) ReadFieldBegin() (name string, typeId TType, seqId int16, err error)

func (*TBinaryProtocol) ReadFieldEnd

func (p *TBinaryProtocol) ReadFieldEnd() error

func (*TBinaryProtocol) ReadI16

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

func (*TBinaryProtocol) ReadI32

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

func (*TBinaryProtocol) ReadI64

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

func (*TBinaryProtocol) ReadListBegin

func (p *TBinaryProtocol) ReadListBegin() (elemType TType, size int, err error)

func (*TBinaryProtocol) ReadListEnd

func (p *TBinaryProtocol) ReadListEnd() error

func (*TBinaryProtocol) ReadMapBegin

func (p *TBinaryProtocol) ReadMapBegin() (kType, vType TType, size int, err error)

func (*TBinaryProtocol) ReadMapEnd

func (p *TBinaryProtocol) ReadMapEnd() error

func (*TBinaryProtocol) ReadMessageBegin

func (p *TBinaryProtocol) ReadMessageBegin() (name string, typeId TMessageType, seqId int32, err error)

func (*TBinaryProtocol) ReadMessageEnd

func (p *TBinaryProtocol) ReadMessageEnd() error

func (*TBinaryProtocol) ReadSetBegin

func (p *TBinaryProtocol) ReadSetBegin() (elemType TType, size int, err error)

func (*TBinaryProtocol) ReadSetEnd

func (p *TBinaryProtocol) ReadSetEnd() error

func (*TBinaryProtocol) ReadString

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

func (*TBinaryProtocol) ReadStructBegin

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

func (*TBinaryProtocol) ReadStructEnd

func (p *TBinaryProtocol) ReadStructEnd() error

func (*TBinaryProtocol) Skip

func (p *TBinaryProtocol) Skip(fieldType TType) (err error)

func (*TBinaryProtocol) Transport

func (p *TBinaryProtocol) Transport() TTransport

func (*TBinaryProtocol) WriteBinary

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

func (*TBinaryProtocol) WriteBool

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

func (*TBinaryProtocol) WriteByte

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

func (*TBinaryProtocol) WriteDouble

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

func (*TBinaryProtocol) WriteFieldBegin

func (p *TBinaryProtocol) WriteFieldBegin(name string, typeId TType, id int16) error

func (*TBinaryProtocol) WriteFieldEnd

func (p *TBinaryProtocol) WriteFieldEnd() error

func (*TBinaryProtocol) WriteFieldStop

func (p *TBinaryProtocol) WriteFieldStop() error

func (*TBinaryProtocol) WriteI16

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

func (*TBinaryProtocol) WriteI32

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

func (*TBinaryProtocol) WriteI64

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

func (*TBinaryProtocol) WriteListBegin

func (p *TBinaryProtocol) WriteListBegin(elemType TType, size int) error

func (*TBinaryProtocol) WriteListEnd

func (p *TBinaryProtocol) WriteListEnd() error

func (*TBinaryProtocol) WriteMapBegin

func (p *TBinaryProtocol) WriteMapBegin(keyType TType, valueType TType, size int) error

func (*TBinaryProtocol) WriteMapEnd

func (p *TBinaryProtocol) WriteMapEnd() error

func (*TBinaryProtocol) WriteMessageBegin

func (p *TBinaryProtocol) WriteMessageBegin(name string, typeId TMessageType, seqId int32) error

func (*TBinaryProtocol) WriteMessageEnd

func (p *TBinaryProtocol) WriteMessageEnd() error

func (*TBinaryProtocol) WriteSetBegin

func (p *TBinaryProtocol) WriteSetBegin(elemType TType, size int) error

func (*TBinaryProtocol) WriteSetEnd

func (p *TBinaryProtocol) WriteSetEnd() error

func (*TBinaryProtocol) WriteString

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

func (*TBinaryProtocol) WriteStructBegin

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

func (*TBinaryProtocol) WriteStructEnd

func (p *TBinaryProtocol) WriteStructEnd() error

type TBinaryProtocolFactory

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

func NewTBinaryProtocolFactory

func NewTBinaryProtocolFactory(strictRead, strictWrite bool) *TBinaryProtocolFactory

func NewTBinaryProtocolFactoryDefault

func NewTBinaryProtocolFactoryDefault() *TBinaryProtocolFactory

func (*TBinaryProtocolFactory) GetProtocol

func (p *TBinaryProtocolFactory) GetProtocol(t TTransport) TProtocol

type TCompactProtocol

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

func NewTCompactProtocol

func NewTCompactProtocol(trans TTransport) *TCompactProtocol

Create a TCompactProtocol given a TTransport

func (*TCompactProtocol) Flush

func (p *TCompactProtocol) Flush() (err error)

func (*TCompactProtocol) ReadBinary

func (p *TCompactProtocol) ReadBinary() (value []byte, err error)

Read a []byte from the wire.

func (*TCompactProtocol) ReadBool

func (p *TCompactProtocol) ReadBool() (value bool, err error)

Read a boolean off the wire. If this is a boolean field, the value should already have been read during readFieldBegin, so we'll just consume the pre-stored value. Otherwise, read a byte.

func (*TCompactProtocol) ReadByte

func (p *TCompactProtocol) ReadByte() (int8, error)

Read a single byte off the wire. Nothing interesting here.

func (*TCompactProtocol) ReadDouble

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

No magic here - just read a double off the wire.

func (*TCompactProtocol) ReadFieldBegin

func (p *TCompactProtocol) ReadFieldBegin() (name string, typeId TType, id int16, err error)

Read a field header off the wire.

func (*TCompactProtocol) ReadFieldEnd

func (p *TCompactProtocol) ReadFieldEnd() error

func (*TCompactProtocol) ReadI16

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

Read an i16 from the wire as a zigzag varint.

func (*TCompactProtocol) ReadI32

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

Read an i32 from the wire as a zigzag varint.

func (*TCompactProtocol) ReadI64

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

Read an i64 from the wire as a zigzag varint.

func (*TCompactProtocol) ReadListBegin

func (p *TCompactProtocol) ReadListBegin() (elemType TType, size int, err error)

Read a list header off the wire. If the list size is 0-14, the size will be packed into the element type header. If it's a longer list, the 4 MSB of the element type header will be 0xF, and a varint will follow with the true size.

func (*TCompactProtocol) ReadListEnd

func (p *TCompactProtocol) ReadListEnd() error

func (*TCompactProtocol) ReadMapBegin

func (p *TCompactProtocol) ReadMapBegin() (keyType TType, valueType TType, size int, err error)

Read a map header off the wire. If the size is zero, skip reading the key and value type. This means that 0-length maps will yield TMaps without the "correct" types.

func (*TCompactProtocol) ReadMapEnd

func (p *TCompactProtocol) ReadMapEnd() error

func (*TCompactProtocol) ReadMessageBegin

func (p *TCompactProtocol) ReadMessageBegin() (name string, typeId TMessageType, seqId int32, err error)

Read a message header.

func (*TCompactProtocol) ReadMessageEnd

func (p *TCompactProtocol) ReadMessageEnd() error

func (*TCompactProtocol) ReadSetBegin

func (p *TCompactProtocol) ReadSetBegin() (elemType TType, size int, err error)

Read a set header off the wire. If the set size is 0-14, the size will be packed into the element type header. If it's a longer set, the 4 MSB of the element type header will be 0xF, and a varint will follow with the true size.

func (*TCompactProtocol) ReadSetEnd

func (p *TCompactProtocol) ReadSetEnd() error

func (*TCompactProtocol) ReadString

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

Reads a []byte (via readBinary), and then UTF-8 decodes it.

func (*TCompactProtocol) ReadStructBegin

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

Read a struct begin. There's nothing on the wire for this, but it is our opportunity to push a new struct begin marker onto the field stack.

func (*TCompactProtocol) ReadStructEnd

func (p *TCompactProtocol) ReadStructEnd() error

Doesn't actually consume any wire data, just removes the last field for this struct from the field stack.

func (*TCompactProtocol) Skip

func (p *TCompactProtocol) Skip(fieldType TType) (err error)

func (*TCompactProtocol) Transport

func (p *TCompactProtocol) Transport() TTransport

func (*TCompactProtocol) WriteBinary

func (p *TCompactProtocol) WriteBinary(bin []byte) error

Write a byte array, using a varint for the size.

func (*TCompactProtocol) WriteBool

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

func (*TCompactProtocol) WriteByte

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

Write a byte. Nothing to see here!

func (*TCompactProtocol) WriteDouble

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

Write a double to the wire as 8 bytes.

func (*TCompactProtocol) WriteFieldBegin

func (p *TCompactProtocol) WriteFieldBegin(name string, typeId TType, id int16) error

func (*TCompactProtocol) WriteFieldEnd

func (p *TCompactProtocol) WriteFieldEnd() error

func (*TCompactProtocol) WriteFieldStop

func (p *TCompactProtocol) WriteFieldStop() error

func (*TCompactProtocol) WriteI16

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

Write an I16 as a zigzag varint.

func (*TCompactProtocol) WriteI32

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

Write an i32 as a zigzag varint.

func (*TCompactProtocol) WriteI64

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

Write an i64 as a zigzag varint.

func (*TCompactProtocol) WriteListBegin

func (p *TCompactProtocol) WriteListBegin(elemType TType, size int) error

Write a list header.

func (*TCompactProtocol) WriteListEnd

func (p *TCompactProtocol) WriteListEnd() error

func (*TCompactProtocol) WriteMapBegin

func (p *TCompactProtocol) WriteMapBegin(keyType TType, valueType TType, size int) error

func (*TCompactProtocol) WriteMapEnd

func (p *TCompactProtocol) WriteMapEnd() error

func (*TCompactProtocol) WriteMessageBegin

func (p *TCompactProtocol) WriteMessageBegin(name string, typeId TMessageType, seqid int32) error

Write a message header to the wire. Compact Protocol messages contain the protocol version so we can migrate forwards in the future if need be.

func (*TCompactProtocol) WriteMessageEnd

func (p *TCompactProtocol) WriteMessageEnd() error

func (*TCompactProtocol) WriteSetBegin

func (p *TCompactProtocol) WriteSetBegin(elemType TType, size int) error

Write a set header.

func (*TCompactProtocol) WriteSetEnd

func (p *TCompactProtocol) WriteSetEnd() error

func (*TCompactProtocol) WriteString

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

Write a string to the wire with a varint size preceding.

func (*TCompactProtocol) WriteStructBegin

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

Write a struct begin. This doesn't actually put anything on the wire. We use it as an opportunity to put special placeholder markers on the field stack so we can get the field id deltas correct.

func (*TCompactProtocol) WriteStructEnd

func (p *TCompactProtocol) WriteStructEnd() error

Write a struct end. This doesn't actually put anything on the wire. We use this as an opportunity to pop the last field from the current struct off of the field stack.

type TCompactProtocolFactory

type TCompactProtocolFactory struct{}

func NewTCompactProtocolFactory

func NewTCompactProtocolFactory() *TCompactProtocolFactory

func (*TCompactProtocolFactory) GetProtocol

func (p *TCompactProtocolFactory) GetProtocol(trans TTransport) TProtocol

type TException

type TException interface {
	error
}

Generic Thrift exception

type TMemoryBuffer

type TMemoryBuffer struct {
	*bytes.Buffer
	// contains filtered or unexported fields
}

Memory buffer-based implementation of the TTransport interface.

func NewTMemoryBuffer

func NewTMemoryBuffer() *TMemoryBuffer

func NewTMemoryBufferLen

func NewTMemoryBufferLen(size int) *TMemoryBuffer

func (*TMemoryBuffer) Close

func (p *TMemoryBuffer) Close() error

func (*TMemoryBuffer) Flush

func (p *TMemoryBuffer) Flush() error

Flushing a memory buffer is a no-op

func (*TMemoryBuffer) IsOpen

func (p *TMemoryBuffer) IsOpen() bool

func (*TMemoryBuffer) Open

func (p *TMemoryBuffer) Open() error

func (*TMemoryBuffer) RemainingBytes

func (p *TMemoryBuffer) RemainingBytes() (num_bytes uint64)

type TMemoryBufferTransportFactory

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

func NewTMemoryBufferTransportFactory

func NewTMemoryBufferTransportFactory(size int) *TMemoryBufferTransportFactory

func (*TMemoryBufferTransportFactory) GetTransport

func (p *TMemoryBufferTransportFactory) GetTransport(trans TTransport) TTransport

type TMessageType

type TMessageType int32

Message type constants in the Thrift protocol.

const (
	INVALID_TMESSAGE_TYPE TMessageType = 0
	CALL                  TMessageType = 1
	REPLY                 TMessageType = 2
	EXCEPTION             TMessageType = 3
	ONEWAY                TMessageType = 4
)

type TProcessor

type TProcessor interface {
	Process(in, out TProtocol) (bool, TException)
}

A processor is a generic object which operates upon an input stream and writes to some output stream.

type TProcessorFunction

type TProcessorFunction interface {
	Process(seqId int32, in, out TProtocol) (bool, TException)
}

type TProtocol

type TProtocol interface {
	WriteMessageBegin(name string, typeId TMessageType, seqid int32) error
	WriteMessageEnd() error
	WriteStructBegin(name string) error
	WriteStructEnd() error
	WriteFieldBegin(name string, typeId TType, id int16) error
	WriteFieldEnd() error
	WriteFieldStop() error
	WriteMapBegin(keyType TType, valueType TType, size int) error
	WriteMapEnd() error
	WriteListBegin(elemType TType, size int) error
	WriteListEnd() error
	WriteSetBegin(elemType TType, size int) error
	WriteSetEnd() error
	WriteBool(value bool) error
	WriteByte(value int8) error
	WriteI16(value int16) error
	WriteI32(value int32) error
	WriteI64(value int64) error
	WriteDouble(value float64) error
	WriteString(value string) error
	WriteBinary(value []byte) error

	ReadMessageBegin() (name string, typeId TMessageType, seqid int32, err error)
	ReadMessageEnd() error
	ReadStructBegin() (name string, err error)
	ReadStructEnd() error
	ReadFieldBegin() (name string, typeId TType, id int16, err error)
	ReadFieldEnd() error
	ReadMapBegin() (keyType TType, valueType TType, size int, err error)
	ReadMapEnd() error
	ReadListBegin() (elemType TType, size int, err error)
	ReadListEnd() error
	ReadSetBegin() (elemType TType, size int, err error)
	ReadSetEnd() error
	ReadBool() (value bool, err error)
	ReadByte() (value int8, err error)
	ReadI16() (value int16, err error)
	ReadI32() (value int32, err error)
	ReadI64() (value int64, err error)
	ReadDouble() (value float64, err error)
	ReadString() (value string, err error)
	ReadBinary() (value []byte, err error)

	Skip(fieldType TType) (err error)
	Flush() (err error)

	Transport() TTransport
}

type TProtocolException

type TProtocolException interface {
	TException
	TypeId() int
}

Thrift Protocol exception

func NewTProtocolException

func NewTProtocolException(err error) TProtocolException

func NewTProtocolExceptionWithType

func NewTProtocolExceptionWithType(errType int, err error) TProtocolException

type TProtocolFactory

type TProtocolFactory interface {
	GetProtocol(trans TTransport) TProtocol
}

Factory interface for constructing protocol instances.

type TRichTransport

type TRichTransport interface {
	io.ReadWriter
	io.ByteReader
	io.ByteWriter

	Flusher
	ReadSizeProvider
	// contains filtered or unexported methods
}

This is "enchanced" transport with extra capabilities. You need to use one of these to construct protocol. Notably, TSocket does not implement this interface, and it is always a mistake to use TSocket directly in protocol.

type TSerializer

type TSerializer struct {
	Transport *TMemoryBuffer
	Protocol  TProtocol
}

func NewTSerializer

func NewTSerializer() *TSerializer

func (*TSerializer) Write

func (t *TSerializer) Write(msg TStruct) (b []byte, err error)

func (*TSerializer) WriteString

func (t *TSerializer) WriteString(msg TStruct) (s string, err error)

type TSimpleJSONProtocol

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

JSON protocol implementation for thrift.

This protocol produces/consumes a simple output format suitable for parsing by scripting languages. It should not be confused with the full-featured TJSONProtocol.

func NewTSimpleJSONProtocol

func NewTSimpleJSONProtocol(t TTransport) *TSimpleJSONProtocol

Constructor

func (*TSimpleJSONProtocol) Flush

func (p *TSimpleJSONProtocol) Flush() (err error)

func (*TSimpleJSONProtocol) OutputBool

func (p *TSimpleJSONProtocol) OutputBool(value bool) error

func (*TSimpleJSONProtocol) OutputElemListBegin

func (p *TSimpleJSONProtocol) OutputElemListBegin(elemType TType, size int) error

func (*TSimpleJSONProtocol) OutputF64

func (p *TSimpleJSONProtocol) OutputF64(value float64) error

func (*TSimpleJSONProtocol) OutputI64

func (p *TSimpleJSONProtocol) OutputI64(value int64) error

func (*TSimpleJSONProtocol) OutputListBegin

func (p *TSimpleJSONProtocol) OutputListBegin() error

func (*TSimpleJSONProtocol) OutputListEnd

func (p *TSimpleJSONProtocol) OutputListEnd() error

func (*TSimpleJSONProtocol) OutputNull

func (p *TSimpleJSONProtocol) OutputNull() error

func (*TSimpleJSONProtocol) OutputObjectBegin

func (p *TSimpleJSONProtocol) OutputObjectBegin() error

func (*TSimpleJSONProtocol) OutputObjectEnd

func (p *TSimpleJSONProtocol) OutputObjectEnd() error

func (*TSimpleJSONProtocol) OutputPostValue

func (p *TSimpleJSONProtocol) OutputPostValue() error

func (*TSimpleJSONProtocol) OutputPreValue

func (p *TSimpleJSONProtocol) OutputPreValue() error

func (*TSimpleJSONProtocol) OutputString

func (p *TSimpleJSONProtocol) OutputString(s string) error

func (*TSimpleJSONProtocol) OutputStringData

func (p *TSimpleJSONProtocol) OutputStringData(s string) error

func (*TSimpleJSONProtocol) ParseBase64EncodedBody

func (p *TSimpleJSONProtocol) ParseBase64EncodedBody() ([]byte, error)

func (*TSimpleJSONProtocol) ParseElemListBegin

func (p *TSimpleJSONProtocol) ParseElemListBegin() (elemType TType, size int, e error)

func (*TSimpleJSONProtocol) ParseF64

func (p *TSimpleJSONProtocol) ParseF64() (float64, bool, error)

func (*TSimpleJSONProtocol) ParseI64

func (p *TSimpleJSONProtocol) ParseI64() (int64, bool, error)

func (*TSimpleJSONProtocol) ParseListBegin

func (p *TSimpleJSONProtocol) ParseListBegin() (isNull bool, err error)

func (*TSimpleJSONProtocol) ParseListEnd

func (p *TSimpleJSONProtocol) ParseListEnd() error

func (*TSimpleJSONProtocol) ParseObjectEnd

func (p *TSimpleJSONProtocol) ParseObjectEnd() error

func (*TSimpleJSONProtocol) ParseObjectStart

func (p *TSimpleJSONProtocol) ParseObjectStart() (bool, error)

func (*TSimpleJSONProtocol) ParsePostValue

func (p *TSimpleJSONProtocol) ParsePostValue() error

func (*TSimpleJSONProtocol) ParsePreValue

func (p *TSimpleJSONProtocol) ParsePreValue() error

func (*TSimpleJSONProtocol) ParseQuotedStringBody

func (p *TSimpleJSONProtocol) ParseQuotedStringBody() (string, error)

func (*TSimpleJSONProtocol) ParseStringBody

func (p *TSimpleJSONProtocol) ParseStringBody() (string, error)

func (*TSimpleJSONProtocol) ReadBinary

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

func (*TSimpleJSONProtocol) ReadBool

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

func (*TSimpleJSONProtocol) ReadByte

func (p *TSimpleJSONProtocol) ReadByte() (int8, error)

func (*TSimpleJSONProtocol) ReadDouble

func (p *TSimpleJSONProtocol) ReadDouble() (float64, error)

func (*TSimpleJSONProtocol) ReadFieldBegin

func (p *TSimpleJSONProtocol) ReadFieldBegin() (string, TType, int16, error)

func (*TSimpleJSONProtocol) ReadFieldEnd

func (p *TSimpleJSONProtocol) ReadFieldEnd() error

func (*TSimpleJSONProtocol) ReadI16

func (p *TSimpleJSONProtocol) ReadI16() (int16, error)

func (*TSimpleJSONProtocol) ReadI32

func (p *TSimpleJSONProtocol) ReadI32() (int32, error)

func (*TSimpleJSONProtocol) ReadI64

func (p *TSimpleJSONProtocol) ReadI64() (int64, error)

func (*TSimpleJSONProtocol) ReadListBegin

func (p *TSimpleJSONProtocol) ReadListBegin() (elemType TType, size int, e error)

func (*TSimpleJSONProtocol) ReadListEnd

func (p *TSimpleJSONProtocol) ReadListEnd() error

func (*TSimpleJSONProtocol) ReadMapBegin

func (p *TSimpleJSONProtocol) ReadMapBegin() (keyType TType, valueType TType, size int, e error)

func (*TSimpleJSONProtocol) ReadMapEnd

func (p *TSimpleJSONProtocol) ReadMapEnd() error

func (*TSimpleJSONProtocol) ReadMessageBegin

func (p *TSimpleJSONProtocol) ReadMessageBegin() (name string, typeId TMessageType, seqId int32, err error)

Reading methods.

func (*TSimpleJSONProtocol) ReadMessageEnd

func (p *TSimpleJSONProtocol) ReadMessageEnd() error

func (*TSimpleJSONProtocol) ReadSetBegin

func (p *TSimpleJSONProtocol) ReadSetBegin() (elemType TType, size int, e error)

func (*TSimpleJSONProtocol) ReadSetEnd

func (p *TSimpleJSONProtocol) ReadSetEnd() error

func (*TSimpleJSONProtocol) ReadString

func (p *TSimpleJSONProtocol) ReadString() (string, error)

func (*TSimpleJSONProtocol) ReadStructBegin

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

func (*TSimpleJSONProtocol) ReadStructEnd

func (p *TSimpleJSONProtocol) ReadStructEnd() error

func (*TSimpleJSONProtocol) Skip

func (p *TSimpleJSONProtocol) Skip(fieldType TType) (err error)

func (*TSimpleJSONProtocol) Transport

func (p *TSimpleJSONProtocol) Transport() TTransport

func (*TSimpleJSONProtocol) WriteBinary

func (p *TSimpleJSONProtocol) WriteBinary(v []byte) error

func (*TSimpleJSONProtocol) WriteBool

func (p *TSimpleJSONProtocol) WriteBool(b bool) error

func (*TSimpleJSONProtocol) WriteByte

func (p *TSimpleJSONProtocol) WriteByte(b int8) error

func (*TSimpleJSONProtocol) WriteDouble

func (p *TSimpleJSONProtocol) WriteDouble(v float64) error

func (*TSimpleJSONProtocol) WriteFieldBegin

func (p *TSimpleJSONProtocol) WriteFieldBegin(name string, typeId TType, id int16) error

func (*TSimpleJSONProtocol) WriteFieldEnd

func (p *TSimpleJSONProtocol) WriteFieldEnd() error

func (*TSimpleJSONProtocol) WriteFieldStop

func (p *TSimpleJSONProtocol) WriteFieldStop() error

func (*TSimpleJSONProtocol) WriteI16

func (p *TSimpleJSONProtocol) WriteI16(v int16) error

func (*TSimpleJSONProtocol) WriteI32

func (p *TSimpleJSONProtocol) WriteI32(v int32) error

func (*TSimpleJSONProtocol) WriteI64

func (p *TSimpleJSONProtocol) WriteI64(v int64) error

func (*TSimpleJSONProtocol) WriteListBegin

func (p *TSimpleJSONProtocol) WriteListBegin(elemType TType, size int) error

func (*TSimpleJSONProtocol) WriteListEnd

func (p *TSimpleJSONProtocol) WriteListEnd() error

func (*TSimpleJSONProtocol) WriteMapBegin

func (p *TSimpleJSONProtocol) WriteMapBegin(keyType TType, valueType TType, size int) error

func (*TSimpleJSONProtocol) WriteMapEnd

func (p *TSimpleJSONProtocol) WriteMapEnd() error

func (*TSimpleJSONProtocol) WriteMessageBegin

func (p *TSimpleJSONProtocol) WriteMessageBegin(name string, typeId TMessageType, seqId int32) error

func (*TSimpleJSONProtocol) WriteMessageEnd

func (p *TSimpleJSONProtocol) WriteMessageEnd() error

func (*TSimpleJSONProtocol) WriteSetBegin

func (p *TSimpleJSONProtocol) WriteSetBegin(elemType TType, size int) error

func (*TSimpleJSONProtocol) WriteSetEnd

func (p *TSimpleJSONProtocol) WriteSetEnd() error

func (*TSimpleJSONProtocol) WriteString

func (p *TSimpleJSONProtocol) WriteString(v string) error

func (*TSimpleJSONProtocol) WriteStructBegin

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

func (*TSimpleJSONProtocol) WriteStructEnd

func (p *TSimpleJSONProtocol) WriteStructEnd() error

type TSimpleJSONProtocolFactory

type TSimpleJSONProtocolFactory struct{}

Factory

func NewTSimpleJSONProtocolFactory

func NewTSimpleJSONProtocolFactory() *TSimpleJSONProtocolFactory

func (*TSimpleJSONProtocolFactory) GetProtocol

func (p *TSimpleJSONProtocolFactory) GetProtocol(trans TTransport) TProtocol

type TStruct

type TStruct interface {
	Write(p TProtocol) error
	Read(p TProtocol) error
}

type TTransport

type TTransport interface {
	io.ReadWriteCloser
	Flusher
	ReadSizeProvider

	// Opens the transport for communication
	Open() error

	// Returns true if the transport is open
	IsOpen() bool
}

Encapsulates the I/O layer

type TTransportException

type TTransportException interface {
	TException
	TypeId() int
	Err() error
}

Thrift Transport exception

func NewTTransportException

func NewTTransportException(t int, e string) TTransportException

func NewTTransportExceptionFromError

func NewTTransportExceptionFromError(e error) TTransportException

type TTransportFactory

type TTransportFactory interface {
	GetTransport(trans TTransport) TTransport
}

Factory class used to create wrapped instance of Transports. This is used primarily in servers, which get Transports from a ServerTransport and then may want to mutate them (i.e. create a BufferedTransport from the underlying base transport)

func NewTTransportFactory

func NewTTransportFactory() TTransportFactory

type TType

type TType byte

Type constants in the Thrift protocol

func (TType) String

func (p TType) String() string

Jump to

Keyboard shortcuts

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