codec

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Jun 11, 2018 License: Apache-2.0 Imports: 3 Imported by: 2

Documentation

Index

Constants

View Source
const (
	Error     MessageType = 0x01
	Request               = 0x02
	Response              = 0x04
	Heartbeat             = 0x08
)

Variables

View Source
var (
	ErrHeaderNotEnough = errors.New("header buffer too short")
	ErrBodyNotEnough   = errors.New("body buffer too short")
	ErrJavaException   = errors.New("got java exception")
	ErrIllegalPackage  = errors.New("illegal package!")
)

Functions

This section is empty.

Types

type Codec

type Codec interface {
	ReadHeader(*Message, MessageType) error
	ReadBody(interface{}) error
	Write(m *Message, args interface{}) error
	Close() error
	String() string
}

type CodecType

type CodecType int
const (
	CODECTYPE_BEGIN CodecType = iota
	CODECTYPE_JSONRPC
	CODECTYPE_DUBBO
	CODECTYPE_UNKNOWN
)

func GetCodecType added in v0.2.0

func GetCodecType(t string) CodecType

func (CodecType) String

func (c CodecType) String() string

type Message

type Message struct {
	ID          int64
	Version     string
	Type        MessageType
	ServicePath string // service path
	Target      string // Service
	Method      string
	Timeout     time.Duration // request timeout
	Error       string
	Header      map[string]string
	BodyLen     int
}

type MessageType

type MessageType int

type NewCodec

type NewCodec func(io.ReadWriteCloser) Codec

Takes in a connection/buffer and returns a new Codec

type TransportType added in v0.2.0

type TransportType int
const (
	TRANSPORTTYPE_BEGIN TransportType = iota
	TRANSPORT_TCP
	TRANSPORT_HTTP
	TRANSPORTTYPE_UNKNOWN
)

func GetTransportType added in v0.2.0

func GetTransportType(t string) TransportType

func (TransportType) String added in v0.2.0

func (t TransportType) String() string

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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