example

package
v1.6.1 Latest Latest
Warning

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

Go to latest
Published: Aug 1, 2024 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ProtocolName types.ProtocolName = "x_example" // protocol

	Magic       byte = 'x' //magic
	DirRequest  byte = 0   // dir
	DirResponse byte = 1   // dir

	TypeHeartbeat byte = 0 // cmd code
	TypeMessage   byte = 1
	TypeGoAway    byte = 2

	ResponseStatusSuccess uint16 = 0 // 0x00 response status
	ResponseStatusError   uint16 = 1 // 0x01

	RequestHeaderLen  int = 11 // protocol header fields length
	ResponseHeaderLen int = 13
	MinimalDecodeLen  int = RequestHeaderLen // minimal length for decoding

	RequestIdIndex = 3
)

protocol constants

Variables

This section is empty.

Functions

func NewCodec

func NewCodec() api.Protocol

Types

type MessageAckCommand

type MessageAckCommand struct {
	Response

	// TODO: pb deserialize target, extract from Payload
	Message interface{}
}

type MessageCommand

type MessageCommand struct {
	Request

	// TODO: pb deserialize target, extract from Payload
	Message interface{}
}

type Request

type Request struct {
	Type       byte
	RequestId  uint32
	PayloadLen uint32
	Payload    []byte
	Content    types.IoBuffer
	header.CommonHeader
}

func (*Request) GetData added in v0.27.0

func (r *Request) GetData() api.IoBuffer

func (*Request) GetHeader added in v0.27.0

func (r *Request) GetHeader() api.HeaderMap

func (*Request) GetRequestId

func (r *Request) GetRequestId() uint64

func (*Request) GetStreamType

func (r *Request) GetStreamType() api.StreamType

func (*Request) GetTimeout added in v0.27.0

func (r *Request) GetTimeout() int32

func (*Request) IsGoAwayFrame added in v0.27.0

func (r *Request) IsGoAwayFrame() bool

func (*Request) IsHeartbeatFrame added in v0.27.0

func (r *Request) IsHeartbeatFrame() bool

func (*Request) SetData added in v0.27.0

func (r *Request) SetData(data api.IoBuffer)

func (*Request) SetRequestId

func (r *Request) SetRequestId(id uint64)

type Response

type Response struct {
	Request
	Status uint16
}

func (*Response) GetHeader added in v0.27.0

func (r *Response) GetHeader() api.HeaderMap

func (*Response) GetRequestId

func (r *Response) GetRequestId() uint64

func (*Response) GetStatusCode added in v0.27.0

func (r *Response) GetStatusCode() uint32

func (*Response) GetStreamType

func (r *Response) GetStreamType() api.StreamType

func (*Response) SetRequestId

func (r *Response) SetRequestId(id uint64)

type XCodec added in v0.26.0

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

func (*XCodec) HTTPMapping added in v0.26.0

func (codec *XCodec) HTTPMapping() api.HTTPMapping

func (*XCodec) NewXProtocol added in v0.26.0

func (codec *XCodec) NewXProtocol(_ context.Context) api.XProtocol

func (*XCodec) ProtocolMatch added in v0.26.0

func (codec *XCodec) ProtocolMatch() api.ProtocolMatch

func (*XCodec) ProtocolName added in v0.26.0

func (codec *XCodec) ProtocolName() api.ProtocolName

Jump to

Keyboard shortcuts

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