Documentation ¶
Index ¶
- Constants
- Variables
- type KeyValueEntry
- type Matcher
- type Request
- func (r *Request) GetData() api.IoBuffer
- func (r *Request) GetHeader() api.HeaderMap
- func (r *Request) GetRequestId() uint64
- func (r *Request) GetStreamType() api.StreamType
- func (r *Request) GetTimeout() int32
- func (r *Request) IsHeartbeatFrame() bool
- func (r *Request) SetData(data api.IoBuffer)
- func (r *Request) SetRequestId(id uint64)
- type Response
- func (r *Response) GetData() api.IoBuffer
- func (r *Response) GetHeader() api.HeaderMap
- func (r *Response) GetRequestId() uint64
- func (r *Response) GetStatusCode() uint32
- func (r *Response) GetStreamType() api.StreamType
- func (r *Response) GetTimeout() int32
- func (r *Response) IsHeartbeatFrame() bool
- func (r *Response) SetData(data api.IoBuffer)
- func (r *Response) SetRequestId(id uint64)
- type StatusMapping
- type XmlHeader
- type XrProtocol
- func (proto *XrProtocol) Decode(ctx context.Context, buf api.IoBuffer) (interface{}, error)
- func (proto *XrProtocol) EnableWorkerPool() bool
- func (proto *XrProtocol) Encode(ctx context.Context, model interface{}) (api.IoBuffer, error)
- func (proto *XrProtocol) GenerateRequestID(streamID *uint64) uint64
- func (proto *XrProtocol) Hijack(context context.Context, request api.XFrame, statusCode uint32) api.XRespFrame
- func (proto *XrProtocol) Mapping(httpStatusCode uint32) uint32
- func (proto *XrProtocol) Name() api.ProtocolName
- func (proto *XrProtocol) PoolMode() api.PoolMode
- func (proto *XrProtocol) PutStreamId(ctx context.Context, key string, val uint64) (err error)
- func (proto *XrProtocol) RemoveStreamId(ctx context.Context, key string)
- func (proto *XrProtocol) Reply(context context.Context, request api.XFrame) api.XRespFrame
- func (proto *XrProtocol) StreamId(ctx context.Context, key string) (val uint64, found bool)
- func (proto *XrProtocol) Trigger(context context.Context, requestId uint64) api.XFrame
Constants ¶
View Source
const ( ResponseStatusSuccess uint32 = 0 // 0 response status RequestHeaderLen int = 8 // fix 8 byte header length )
Variables ¶
View Source
var Xr api.ProtocolName = "xr" // protocol
Functions ¶
This section is empty.
Types ¶
type KeyValueEntry ¶
type Matcher ¶
type Matcher struct{}
func (*Matcher) XrProtocolMatcher ¶
func (m *Matcher) XrProtocolMatcher(data []byte) api.MatchResult
type Request ¶
type Request struct { common.Header // request key value pair RequestId string // request id (biz id) SteamId interface{} // sidecar request id (replaced by sidecar, uint64 or nil) Timeout uint32 // request timeout Content api.IoBuffer // it refers to the service parameters of a packet Data api.IoBuffer // full package bytes Changed bool // indicates whether the packet payload is modified }
func NewRpcRequest ¶
NewRpcRequest is a utility function which build rpc Request object of xr protocol.
func (*Request) GetRequestId ¶
func (*Request) GetStreamType ¶
func (r *Request) GetStreamType() api.StreamType
func (*Request) GetTimeout ¶
func (*Request) IsHeartbeatFrame ¶
func (*Request) SetRequestId ¶
type Response ¶
type Response struct { common.Header // response key value pair RequestId string // response id SteamId interface{} // sidecar request id (replaced by sidecar id) Status uint32 // response status Data api.IoBuffer // full package bytes Content api.IoBuffer // it refers to the service parameters of a packet Changed bool // indicates whether the packet payload is modified }
func NewRpcResponse ¶
NewRpcResponse is a utility function which build rpc Response object of xr protocol.
func (*Response) GetRequestId ¶
func (*Response) GetStatusCode ¶
func (*Response) GetStreamType ¶
func (r *Response) GetStreamType() api.StreamType
func (*Response) GetTimeout ¶
func (*Response) IsHeartbeatFrame ¶
func (*Response) SetRequestId ¶
type XmlHeader ¶
XmlHeader xml key value pair. Protocol-specific, depending on traditional protocol data structures
func (XmlHeader) MarshalXML ¶
func (*XmlHeader) UnmarshalXML ¶
type XrProtocol ¶
type XrProtocol struct {
// contains filtered or unexported fields
}
func (*XrProtocol) EnableWorkerPool ¶
func (proto *XrProtocol) EnableWorkerPool() bool
func (*XrProtocol) GenerateRequestID ¶
func (proto *XrProtocol) GenerateRequestID(streamID *uint64) uint64
func (*XrProtocol) Hijack ¶
func (proto *XrProtocol) Hijack(context context.Context, request api.XFrame, statusCode uint32) api.XRespFrame
Hijack hijack request, maybe timeout
func (*XrProtocol) Mapping ¶
func (proto *XrProtocol) Mapping(httpStatusCode uint32) uint32
func (*XrProtocol) Name ¶
func (proto *XrProtocol) Name() api.ProtocolName
func (*XrProtocol) PoolMode ¶
func (proto *XrProtocol) PoolMode() api.PoolMode
PoolMode returns whether ping-pong or multiplex
func (*XrProtocol) PutStreamId ¶
PutStreamId put mapping stream id
func (*XrProtocol) RemoveStreamId ¶
func (proto *XrProtocol) RemoveStreamId(ctx context.Context, key string)
func (*XrProtocol) Reply ¶
func (proto *XrProtocol) Reply(context context.Context, request api.XFrame) api.XRespFrame
Click to show internal directories.
Click to hide internal directories.