dubbothrift

package
v1.6.0 Latest Latest
Warning

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

Go to latest
Published: Aug 17, 2023 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MessageLenSize       = 4
	MagicLen             = 2
	MessageLenIdx        = 2
	MessageHeaderLenIdx  = 6
	MessageHeaderLenSize = 2
	HeaderIdx            = 9
	HeaderLen            = 9
	IdLen                = 8
)

thrift protocol

View Source
const (
	EventRequest  int = 1 // request
	EventResponse int = 2 // response
)
View Source
const (
	ServiceNameHeader     string = "service"
	MethodNameHeader      string = "method"
	SeqIdNameHeader       string = "seqId"
	MessageTypeNameHeader string = "messageType"
)
View Source
const (
	ProtocolName = "dubbo-thrift"
)
View Source
const (
	ResponseStatusSuccess = uint16(thrift.REPLY)
)
View Source
const (
	UnKnownCmdType string = "unknown cmd type"
)

req/resp type

Variables

View Source
var MagicTag = []byte{0xda, 0xbc}

*

  • Thrift framed protocol codec for dubbo. *
  • |<- message header ->|<- message body ->|
  • +----------------------+----------------+----------------------+------------------+---------------------------+------------------+
  • message size (4 byte) | magic (2 bytes)|message size (4 bytes)|head size(2 bytes)| version (1 byte) | header | message body |
  • +----------------------+----------------+----------------------+------------------+---------------------------+------------------+
  • |<- message size ->| *
  • header fields in version 1:
  • string - service name
  • long - dubbo request id

Functions

This section is empty.

Types

type Frame

type Frame struct {
	Header
	// contains filtered or unexported fields
}

func NewRpcRequest

func NewRpcRequest(headers types.HeaderMap, data types.IoBuffer) *Frame

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

func NewRpcResponse

func NewRpcResponse(headers types.HeaderMap, data types.IoBuffer) *Frame

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

func (*Frame) Clone

func (r *Frame) Clone() api.HeaderMap

func (*Frame) GetData

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

func (*Frame) GetHeader

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

func (*Frame) GetRequestId

func (r *Frame) GetRequestId() uint64

~ XFrame

func (*Frame) GetStatusCode

func (r *Frame) GetStatusCode() uint32

func (*Frame) GetStreamType

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

func (*Frame) GetTimeout added in v0.22.0

func (r *Frame) GetTimeout() int32

dubbothrift use defualt timeout TODO: use dubbothrift timeout

func (*Frame) IsHeartbeatFrame

func (r *Frame) IsHeartbeatFrame() bool

func (*Frame) SetData

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

func (*Frame) SetRequestId

func (r *Frame) SetRequestId(id uint64)
type Header struct {
	FrameLength   uint32
	Magic         []byte
	MessageLength uint32
	HeaderLength  uint16
	Version       byte
	Id            uint64
	Direction     int
	protocol.CommonHeader
}

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

not implement yet

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