boltv2

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Oct 28, 2022 License: Apache-2.0 Imports: 14 Imported by: 1

Documentation

Index

Constants

View Source
const (
	ProtocolName    types.ProtocolName = "boltv2" // protocol
	ProtocolCode    byte               = 2
	ProtocolVersion byte               = 1 // see details in: https://github.com/sofastack/sofa-bolt/blob/master/src/main/java/com/alipay/remoting/rpc/protocol/RpcCommandEncoderV2.java

	RequestHeaderLen  int = 24 // protocol header fields length
	ResponseHeaderLen int = 22
	LessLen           int = ResponseHeaderLen // minimal length for decoding

	RequestIdIndex         = 6
	RequestHeaderLenIndex  = 18
	ResponseHeaderLenIndex = 16

	ProtocolVersion1 byte = 0x01 // define in https://github.com/sofastack/sofa-bolt/blob/master/src/main/java/com/alipay/remoting/rpc/protocol/RpcProtocolV2.java
)

boltv2 constants

Variables

This section is empty.

Functions

This section is empty.

Types

type Request

type Request struct {
	RequestHeader

	Data    types.IoBuffer // wrapper of raw data
	Content types.IoBuffer // wrapper of raw content

	ContentChanged bool // indicate that content changed
	// contains filtered or unexported fields
}

Request is the cmd struct of bolt v2 request

func NewRpcRequest added in v0.26.0

func NewRpcRequest(requestId uint32, headers api.HeaderMap, data api.IoBuffer) *Request

NewRpcRequest is a utility function which build rpc Request object of bolt protocol.

func (*Request) GetData

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

func (*Request) GetHeader

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

func (*Request) GetRequestId

func (r *Request) GetRequestId() uint64

~ XFrame

func (*Request) GetStreamType

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

func (*Request) GetTimeout added in v0.22.0

func (r *Request) GetTimeout() int32

func (*Request) IsHeartbeatFrame

func (r *Request) IsHeartbeatFrame() bool

func (*Request) SetData

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

func (*Request) SetRequestId

func (r *Request) SetRequestId(id uint64)

type RequestHeader

type RequestHeader struct {
	bolt.RequestHeader
	Version1   byte // default 0x01, 0x02 will use crc
	SwitchCode byte // version1 should be 0x02, not support yet.
}

type Response

type Response struct {
	ResponseHeader

	Data    types.IoBuffer // wrapper of raw data
	Content types.IoBuffer // wrapper of raw content

	ContentChanged bool // indicate that content changed
	// contains filtered or unexported fields
}

Response is the cmd struct of bolt v2 response

func NewRpcResponse added in v0.26.0

func NewRpcResponse(requestId uint32, statusCode uint16, headers api.HeaderMap, data api.IoBuffer) *Response

NewRpcResponse is a utility function which build rpc Response object of bolt protocol.

func (*Response) GetData

func (r *Response) GetData() types.IoBuffer

func (*Response) GetHeader

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

func (*Response) GetRequestId

func (r *Response) GetRequestId() uint64

~ XRespFrame

func (*Response) GetStatusCode

func (r *Response) GetStatusCode() uint32

func (*Response) GetStreamType

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

func (*Response) GetTimeout added in v0.22.0

func (r *Response) GetTimeout() int32

response contains no timeout

func (*Response) IsHeartbeatFrame

func (r *Response) IsHeartbeatFrame() bool

func (*Response) SetData

func (r *Response) SetData(data types.IoBuffer)

func (*Response) SetRequestId

func (r *Response) SetRequestId(id uint64)

type ResponseHeader

type ResponseHeader struct {
	bolt.ResponseHeader
	Version1   byte //00
	SwitchCode byte
}

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