Documentation
¶
Index ¶
- Constants
- Variables
- func CamelCase(s string) string
- func DecodeStruct(r io.Reader, protocol Protocol, v interface{}) (err error)
- func Dial(network, address string, framed bool, protocol Protocol) (*rpc.Client, error)
- func EncodeStruct(w io.Writer, protocol Protocol, v interface{}) (err error)
- func NewClient(conn io.ReadWriteCloser, protocol Protocol) *rpc.Client
- func NewClientCodec(conn io.ReadWriteCloser, protocol Protocol) rpc.ClientCodec
- func NewServerCodec(conn io.ReadWriteCloser, protocol Protocol) rpc.ServerCodec
- func ReadValue(r io.Reader, p Protocol, thriftType byte) (interface{}, error)
- func ServeConn(conn io.ReadWriteCloser, protocol Protocol)
- func SkipValue(r io.Reader, p Protocol, thriftType byte) error
- type ApplicationException
- type Decoder
- type Encoder
- type ErrFrameTooBig
- type Flusher
- type FramedReadWriteCloser
- type MissingRequiredField
- type Protocol
- type UnsupportedTypeError
- type UnsupportedValueError
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 ( 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 ( ErrBadVersion = errors.New("Bad version in ReadMessageBegin") ErrNoProtocolVersionHeader = errors.New("No protocol version header") )
View Source
var (
ErrUnimplemented = errors.New("unimplemented")
)
Functions ¶
func Dial ¶
Dial connects to a Thrift RPC server at the specified network address using the specified protocol.
func NewClient ¶
func NewClient(conn io.ReadWriteCloser, protocol Protocol) *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) 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 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.
Types ¶
type ApplicationException ¶
Application level thrift exception
func (*ApplicationException) String ¶
func (e *ApplicationException) String() string
type ErrFrameTooBig ¶
func (*ErrFrameTooBig) Error ¶
func (e *ErrFrameTooBig) Error() string
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) ReadByte ¶
func (f *FramedReadWriteCloser) ReadByte() (byte, error)
type MissingRequiredField ¶
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 NewCompactProtocol ¶
func NewCompactProtocol() Protocol
func NewTextProtocol ¶
func NewTextProtocol() Protocol
type UnsupportedTypeError ¶
func (*UnsupportedTypeError) Error ¶
func (e *UnsupportedTypeError) Error() string
type UnsupportedValueError ¶
func (*UnsupportedValueError) Error ¶
func (e *UnsupportedValueError) Error() string
Source Files
¶
Click to show internal directories.
Click to hide internal directories.