Documentation ¶
Index ¶
- Constants
- Variables
- type Frame
- func (r *Frame) Clone() api.HeaderMap
- func (r *Frame) GetData() types.IoBuffer
- func (r *Frame) GetHeader() types.HeaderMap
- func (r *Frame) GetRequestId() uint64
- func (r *Frame) GetStatusCode() uint32
- func (r *Frame) GetStreamType() api.StreamType
- func (r *Frame) GetTimeout() int32
- func (r *Frame) IsHeartbeatFrame() bool
- func (r *Frame) SetData(data types.IoBuffer)
- func (r *Frame) SetRequestId(id uint64)
- type Header
- type Metadata
- type Node
Constants ¶
const ( HeaderLen = 16 IdLen = 8 MagicIdx = 0 FlagIdx = 2 StatusIdx = 3 IdIdx = 4 DataLenIdx = 12 DataLenSize = 4 )
dubbo protocol
const ( CmdTypeResponse byte = 0 // cmd type CmdTypeRequest byte = 1 CmdTypeRequestOneway byte = 2 UnKnownCmdType string = "unknown cmd type" )
req/resp type
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
const ( EventRequest int = 1 // request EventResponse int = 0 // response )
const ( FrameworkVersionNameHeader string = "dubbo" ServiceNameHeader string = "service" MethodNameHeader string = "method" VersionNameHeader string = "version" GroupNameHeader string = "group" InterfaceNameHeader string = "interface" )
const ( EgressDubbo string = "egress_dubbo" IngressDubbo string = "ingress_dubbo" )
const (
ProtocolName = "dubbo"
)
const (
ResponseStatusSuccess uint16 = 0x14 // 0x14 response status
)
Variables ¶
var DubboPubMetadata = &Metadata{}
DubboPubMetadata dubbo pub cache metadata
var DubboSubMetadata = &Metadata{}
DubboSubMetadata dubbo sub cache metadata
var MagicTag = []byte{0xda, 0xbb}
Functions ¶
This section is empty.
Types ¶
type Frame ¶
type Frame struct { Header // contains filtered or unexported fields }
func NewRpcRequest ¶
NewRpcRequest is a utility function which build rpc Request object of bolt protocol.
func NewRpcResponse ¶
NewRpcResponse is a utility function which build rpc Response object of bolt protocol.
func (*Frame) GetStatusCode ¶
func (*Frame) GetStreamType ¶
func (r *Frame) GetStreamType() api.StreamType
func (*Frame) GetTimeout ¶ added in v0.22.0
dubbo frame returns default timeout TODO: use dubbo timeout?
func (*Frame) IsHeartbeatFrame ¶
func (*Frame) SetRequestId ¶
type Header ¶
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) Contains ¶ added in v0.13.0
Contains check if cached pub or sub metatada strict exists. caller should be check match is true