dubbo

package
v0.24.0 Latest Latest
Warning

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

Go to latest
Published: Aug 5, 2021 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-cn/blog/dubbo-protocol.html * 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 = "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 peformance. please do not use outside of the dubbo framwork.

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 metatada strict exists. caller should be 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 metatada. caller should be 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.

Jump to

Keyboard shortcuts

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