Documentation ¶
Index ¶
- Constants
- func Engine() types.ProtocolEngine
- func Register(prot SubProtocol, factory CodecFactory)
- type CodecFactory
- type Coder
- type Multiplexing
- type ProtocolConvertor
- type RequestRouting
- type SubProtocol
- type Tracing
- type XCmd
- type XRpcCmd
- func (XRpcCmd *XRpcCmd) BuildHeartbeat(headers types.HeaderMap) []byte
- func (xRpcCmd *XRpcCmd) ByteSize() (size uint64)
- func (xRpcCmd *XRpcCmd) Clone() types.HeaderMap
- func (xRpcCmd *XRpcCmd) Convert(data []byte) (map[string]string, []byte)
- func (xRpcCmd *XRpcCmd) Data() types.IoBuffer
- func (xRpcCmd *XRpcCmd) Del(key string)
- func (xRpcCmd *XRpcCmd) Get(key string) (value string, ok bool)
- func (xRpcCmd *XRpcCmd) GetMetas(data []byte) map[string]string
- func (xRpcCmd *XRpcCmd) GetMethodName(data []byte) string
- func (xRpcCmd *XRpcCmd) GetServiceName(data []byte) string
- func (xRpcCmd *XRpcCmd) GetStreamID(data []byte) string
- func (xRpcCmd *XRpcCmd) Header() map[string]string
- func (xRpcCmd *XRpcCmd) ProtocolCode() byte
- func (xRpcCmd *XRpcCmd) Range(f func(key, value string) bool)
- func (xRpcCmd *XRpcCmd) RequestID() uint64
- func (xRpcCmd *XRpcCmd) Set(key string, value string)
- func (xRpcCmd *XRpcCmd) SetData(data types.IoBuffer)
- func (xRpcCmd *XRpcCmd) SetHeader(header map[string]string)
- func (xRpcCmd *XRpcCmd) SetRequestID(requestID uint64)
- func (xRpcCmd *XRpcCmd) SetStreamID(data []byte, streamID string) []byte
- func (xRpcCmd *XRpcCmd) SplitFrame(data []byte) [][]byte
Constants ¶
const ( Response_OK byte = 20 Response_CLIENT_TIMEOUT byte = 30 Response_SERVER_TIMEOUT byte = 31 Response_BAD_REQUEST byte = 40 Response_BAD_RESPONSE byte = 50 Response_SERVICE_NOT_FOUND byte = 60 Response_SERVICE_ERROR byte = 70 Response_SERVER_ERROR byte = 80 Response_CLIENT_ERROR byte = 90 )
Response related consts
Variables ¶
This section is empty.
Functions ¶
func Engine ¶
func Engine() types.ProtocolEngine
Types ¶
type CodecFactory ¶
type CodecFactory interface {
CreateSubProtocolCodec(context context.Context) Multiplexing
}
CodecFactory subprotocol plugin factory
type Multiplexing ¶
type Multiplexing interface { SplitFrame(data []byte) [][]byte GetStreamID(data []byte) string SetStreamID(data []byte, streamID string) []byte BuildHeartbeatResp(headers types.HeaderMap) []byte }
Multiplexing Accesslog Rate limit Curcuit Breakers
func CreateSubProtocolCodec ¶
func CreateSubProtocolCodec(context context.Context, prot SubProtocol) Multiplexing
CreateSubProtocolCodec return SubProtocol Client
type ProtocolConvertor ¶
type ProtocolConvertor interface { Multiplexing Convert(data []byte) (map[string]string, []byte) }
ProtocolConvertor change protocol base on Multiplexing
type RequestRouting ¶
type RequestRouting interface { Multiplexing GetMetas(data []byte) map[string]string }
RequestRouting RequestAccessControl RequesstFaultInjection base on Multiplexing
type Tracing ¶
type Tracing interface { Multiplexing GetServiceName(data []byte) string GetMethodName(data []byte) string }
Tracing base on Multiplexing
type XRpcCmd ¶
type XRpcCmd struct {
// contains filtered or unexported fields
}
TODO should change the multiplexing interface to support decode into a data and header XRpcCmd In XProtocol Mode , XRpcCmd is a codec wrapper , so data and header is useless currently
func (*XRpcCmd) BuildHeartbeat ¶
func (*XRpcCmd) GetMethodName ¶
func (*XRpcCmd) GetStreamID ¶
func (*XRpcCmd) ProtocolCode ¶
ProtocolEngine no use util we change multiplexing interface
func (*XRpcCmd) Range ¶
Range calls f sequentially for each key and value present in the map. If f returns false, range stops the iteration.
func (*XRpcCmd) Set ¶
Set key-value pair in header map, the previous pair will be replaced if exists
func (*XRpcCmd) SetRequestID ¶
SetRequestID no use util we change multiplexing interface