dubbo

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: 14 Imported by: 4

Documentation

Index

Constants

View Source
const (
	HeaderLen   = 16
	IdLen       = 8
	MagicIdx    = 0
	FlagIdx     = 2
	StatusIdx   = 3
	IdIdx       = 4
	DataLenIdx  = 12
	DataLenSize = 4
)

dubbo protocol

View Source
const (
	CmdTypeResponse      byte   = 0 // cmd type
	CmdTypeRequest       byte   = 1
	CmdTypeRequestOneway byte   = 2
	UnKnownCmdType       string = "unknown cmd type"
)

req/resp type

View Source
const (
	RespStatusOK                             = 20
	RespStatusClientTimeout                  = 30
	RespStatusServerTimeout                  = 31
	RespStatusBadRequest                     = 40
	RespStatusBadResponse                    = 50
	RespStatusServiceNotFound                = 60
	RespStatusServiceError                   = 70
	RespStatusServerError                    = 80
	RespStatusClientError                    = 90
	RespStatusServerThreadpoolExhaustedError = 100
)

* https://dubbo.apache.org/zh/docs/v2.7/dev/implementation/#%E8%BF%9C%E7%A8%8B%E9%80%9A%E8%AE%AF%E7%BB%86%E8%8A%82 * 20 - OK * 30 - CLIENT_TIMEOUT * 31 - SERVER_TIMEOUT * 40 - BAD_REQUEST * 50 - BAD_RESPONSE * 60 - SERVICE_NOT_FOUND * 70 - SERVICE_ERROR * 80 - SERVER_ERROR * 90 - CLIENT_ERROR * 100 - SERVER_THREADPOOL_EXHAUSTED_ERROR

View Source
const (
	EventRequest  int = 1 // request
	EventResponse int = 0 // response
)
View Source
const (
	FrameworkVersionNameHeader string = "dubbo"
	ServiceNameHeader          string = "service"
	MethodNameHeader           string = "method"
	VersionNameHeader          string = "version"
	GroupNameHeader            string = "group"
	InterfaceNameHeader        string = "interface"
)
View Source
const (
	EgressDubbo  string = "egress_dubbo"
	IngressDubbo string = "ingress_dubbo"
)
View Source
const (
	ProtocolName api.ProtocolName = "dubbo"
)
View Source
const (
	ResponseStatusSuccess uint16 = 0x14 // 0x14 response status
)

Variables

View Source
var DubboPubMetadata = &Metadata{}

DubboPubMetadata dubbo pub cache metadata

View Source
var DubboSubMetadata = &Metadata{}

DubboSubMetadata dubbo sub cache metadata

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

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 added in v0.15.0

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

dubbo frame returns default timeout TODO: use dubbo 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 {
	Magic   []byte
	Flag    byte
	Status  byte
	Id      uint64
	DataLen uint32

	IsEvent         bool // true: heartbeat or readonly event
	IsTwoWay        bool // true: send request and expect response, false: just request without response
	Direction       int  // 1 mean req
	SerializationId int  // 2 mean hessian
	protocol.CommonHeader
}

type Metadata added in v0.13.0

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

Metadata cache service pub or sub metadata. speed up for decode or encode dubbo performance. please do not use outside of the dubbo framework.

func (*Metadata) Clear added in v0.13.0

func (m *Metadata) Clear()

Clear all cache data

func (*Metadata) Contains added in v0.13.0

func (m *Metadata) Contains(path, version, group string) (node *Node, matched bool)

Contains check if cached pub or sub metadata strict exists. caller should check match is true

func (*Metadata) Find added in v0.13.0

func (m *Metadata) Find(path, version string) (node *Node, matched bool)

Find cached pub or sub metadata. caller should check match is true

func (*Metadata) Register added in v0.13.0

func (m *Metadata) Register(path string, node *Node)

Register pub or sub metadata

type Node added in v0.13.0

type Node struct {
	Service string // interface name
	Version string // interface version
	Group   string // interface group

	Next *Node // next node
	// contains filtered or unexported fields
}

Node pub or sub host metadata, Keep the structure as simple as possible.

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

TODO: 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