thrift

package
v0.0.0-...-a56ec35 Latest Latest
Warning

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

Go to latest
Published: Dec 2, 2013 License: BSD-3-Clause Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TypeStop   = 0
	TypeVoid   = 1
	TypeBool   = 2
	TypeByte   = 3
	TypeI08    = 3
	TypeDouble = 4
	TypeI16    = 6
	TypeI32    = 8
	TypeI64    = 10
	TypeString = 11
	TypeUtf7   = 11
	TypeStruct = 12
	TypeMap    = 13
	TypeSet    = 14
	TypeList   = 15
	TypeUtf8   = 16
	TypeUtf16  = 17
)
View Source
const (
	MessageTypeCall      = 1
	MessageTypeReply     = 2
	MessageTypeException = 3
	MessageTypeOneway    = 4
)
View Source
const (
	ExceptionUnknown            = 0
	ExceptionUnknownMethod      = 1
	ExceptionInvalidMessageType = 2
	ExceptionWrongMethodName    = 3
	ExceptionBadSequenceId      = 4
	ExceptionMissingResult      = 5
	ExceptionInternalError      = 6
	ExceptionProtocolError      = 7
)
View Source
const (
	DefaultMaxFrameSize = 1024 * 1024
)

Variables

View Source
var (
	ErrTooManyPendingRequests = errors.New("thrift.client: too many pending requests")
	ErrOnewayNotEnabled       = errors.New("thrift.client: one way support not enabled on codec")
)
View Source
var (
	ErrUnimplemented = errors.New("thrift: unimplemented")
)

Functions

func Bool

func Bool(v bool) *bool

func Byte

func Byte(v byte) *byte

func CamelCase

func CamelCase(s string) string

func DecodeStruct

func DecodeStruct(r io.Reader, protocol Protocol, v interface{}) (err error)

func Dial

func Dial(network, address string, framed bool, protocol Protocol, supportOnewayRequests bool) (*rpc.Client, error)

Dial connects to a Thrift RPC server at the specified network address using the specified protocol.

func EncodeStruct

func EncodeStruct(w io.Writer, protocol Protocol, v interface{}) (err error)

func Float32

func Float32(v float32) *float32

func Float64

func Float64(v float64) *float64

func Int16

func Int16(v int16) *int16

func Int32

func Int32(v int32) *int32

func Int64

func Int64(v int64) *int64

func NewClient

func NewClient(conn io.ReadWriteCloser, protocol Protocol, supportOnewayRequests bool) *rpc.Client

NewClient returns a new rpc.Client to handle requests to the set of services at the other end of the connection.

func NewClientCodec

func NewClientCodec(conn io.ReadWriteCloser, protocol Protocol, supportOnewayRequests bool) rpc.ClientCodec

NewClientCodec returns a new rpc.ClientCodec using Thrift RPC on conn using the specified protocol.

func NewServerCodec

func NewServerCodec(conn io.ReadWriteCloser, protocol Protocol) rpc.ServerCodec

NewServerCodec returns a new rpc.ServerCodec using Thrift RPC on conn using the specified protocol.

func ReadValue

func ReadValue(r io.Reader, p Protocol, thriftType byte) (interface{}, error)

func ServeConn

func ServeConn(conn io.ReadWriteCloser, protocol Protocol)

ServeConn runs the Thrift RPC server on a single connection. ServeConn blocks, serving the connection until the client hangs up. The caller typically invokes ServeConn in a go statement.

func SkipValue

func SkipValue(r io.Reader, p Protocol, thriftType byte) error

func String

func String(v string) *string

Types

type ApplicationException

type ApplicationException struct {
	Message string `thrift:"1"`
	Type    int32  `thrift:"2"`
}

Application level thrift exception

func (*ApplicationException) String

func (e *ApplicationException) String() string

type Decoder

type Decoder interface {
	DecodeThrift(io.Reader, Protocol) error
}

type Encoder

type Encoder interface {
	EncodeThrift(io.Writer, Protocol) error
}

type ErrFrameTooBig

type ErrFrameTooBig struct {
	Size, MaxSize int64
}

func (ErrFrameTooBig) Error

func (e ErrFrameTooBig) Error() string

type Flusher

type Flusher interface {
	Flush() error
}

type FramedReadWriteCloser

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

func NewFramedReadWriteCloser

func NewFramedReadWriteCloser(wrapped io.ReadWriteCloser, maxFrameSize int) *FramedReadWriteCloser

func (*FramedReadWriteCloser) Close

func (f *FramedReadWriteCloser) Close() error

func (*FramedReadWriteCloser) Flush

func (f *FramedReadWriteCloser) Flush() error

func (*FramedReadWriteCloser) Read

func (f *FramedReadWriteCloser) Read(p []byte) (int, error)

func (*FramedReadWriteCloser) ReadByte

func (f *FramedReadWriteCloser) ReadByte() (byte, error)

func (*FramedReadWriteCloser) Write

func (f *FramedReadWriteCloser) Write(p []byte) (int, error)

type MissingRequiredField

type MissingRequiredField struct {
	StructName string
	FieldName  string
}

func (*MissingRequiredField) Error

func (e *MissingRequiredField) Error() string

type Protocol

type Protocol interface {
	WriteMessageBegin(w io.Writer, name string, messageType byte, seqid int32) error
	WriteMessageEnd(w io.Writer) error
	WriteStructBegin(w io.Writer, name string) error
	WriteStructEnd(w io.Writer) error
	WriteFieldBegin(w io.Writer, name string, fieldType byte, id int16) error
	WriteFieldEnd(w io.Writer) error
	WriteFieldStop(w io.Writer) error
	WriteMapBegin(w io.Writer, keyType byte, valueType byte, size int) error
	WriteMapEnd(w io.Writer) error
	WriteListBegin(w io.Writer, elementType byte, size int) error
	WriteListEnd(w io.Writer) error
	WriteSetBegin(w io.Writer, elementType byte, size int) error
	WriteSetEnd(w io.Writer) error
	WriteBool(w io.Writer, value bool) error
	WriteByte(w io.Writer, value byte) error
	WriteI16(w io.Writer, value int16) error
	WriteI32(w io.Writer, value int32) error
	WriteI64(w io.Writer, value int64) error
	WriteDouble(w io.Writer, value float64) error
	WriteString(w io.Writer, value string) error
	WriteBytes(w io.Writer, value []byte) error

	ReadMessageBegin(r io.Reader) (name string, messageType byte, seqid int32, err error)
	ReadMessageEnd(r io.Reader) error
	ReadStructBegin(r io.Reader) error
	ReadStructEnd(r io.Reader) error
	ReadFieldBegin(r io.Reader) (fieldType byte, id int16, err error)
	ReadFieldEnd(r io.Reader) error
	ReadMapBegin(r io.Reader) (keyType byte, valueType byte, size int, err error)
	ReadMapEnd(r io.Reader) error
	ReadListBegin(r io.Reader) (elementType byte, size int, err error)
	ReadListEnd(r io.Reader) error
	ReadSetBegin(r io.Reader) (elementType byte, size int, err error)
	ReadSetEnd(r io.Reader) error
	ReadBool(r io.Reader) (bool, error)
	ReadByte(r io.Reader) (byte, error)
	ReadI16(r io.Reader) (int16, error)
	ReadI32(r io.Reader) (int32, error)
	ReadI64(r io.Reader) (int64, error)
	ReadDouble(r io.Reader) (float64, error)
	ReadString(r io.Reader) (string, error)
	ReadBytes(r io.Reader) ([]byte, error)
}

func NewBinaryProtocol

func NewBinaryProtocol(strictWrite bool, strictRead bool) Protocol

func NewCompactProtocol

func NewCompactProtocol() Protocol

func NewTextProtocol

func NewTextProtocol() Protocol

type ProtocolError

type ProtocolError struct {
	Protocol string
	Message  string
}

func (ProtocolError) Error

func (e ProtocolError) Error() string

type UnsupportedTypeError

type UnsupportedTypeError struct {
	Type reflect.Type
}

func (*UnsupportedTypeError) Error

func (e *UnsupportedTypeError) Error() string

type UnsupportedValueError

type UnsupportedValueError struct {
	Value reflect.Value
	Str   string
}

func (*UnsupportedValueError) Error

func (e *UnsupportedValueError) Error() string

Jump to

Keyboard shortcuts

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