Documentation ¶
Index ¶
- Constants
- Variables
- type BoltStatusMapping
- type Request
- func (r *Request) GetData() api.IoBuffer
- func (r *Request) GetHeader() api.HeaderMap
- func (r *Request) GetRequestId() uint64
- func (r *Request) GetStreamType() api.StreamType
- func (r *Request) GetTimeout() int32
- func (r *Request) IsHeartbeatFrame() bool
- func (r *Request) SetData(data api.IoBuffer)
- func (r *Request) SetRequestId(id uint64)
- type RequestHeader
- type Response
- func (r *Response) GetData() api.IoBuffer
- func (r *Response) GetHeader() api.HeaderMap
- func (r *Response) GetRequestId() uint64
- func (r *Response) GetStatusCode() uint32
- func (r *Response) GetStreamType() api.StreamType
- func (r *Response) GetTimeout() int32
- func (r *Response) IsHeartbeatFrame() bool
- func (r *Response) SetData(data api.IoBuffer)
- func (r *Response) SetRequestId(id uint64)
- type ResponseHeader
- type XCodec
Constants ¶
View Source
const ( ProtocolName types.ProtocolName = "bolt" // protocol ProtocolCode byte = 1 ProtocolVersion byte = 1 CmdTypeResponse byte = 0 // cmd type CmdTypeRequest byte = 1 CmdTypeRequestOneway byte = 2 CmdCodeHeartbeat uint16 = 0 // cmd code CmdCodeRpcRequest uint16 = 1 CmdCodeRpcResponse uint16 = 2 Hessian2Serialize byte = 1 // serialize ResponseStatusSuccess uint16 = 0 // 0x00 response status ResponseStatusError uint16 = 1 // 0x01 ResponseStatusServerException uint16 = 2 // 0x02 ResponseStatusUnknown uint16 = 3 // 0x03 ResponseStatusServerThreadpoolBusy uint16 = 4 // 0x04 ResponseStatusErrorComm uint16 = 5 // 0x05 ResponseStatusNoProcessor uint16 = 6 // 0x06 ResponseStatusTimeout uint16 = 7 // 0x07 ResponseStatusClientSendError uint16 = 8 // 0x08 ResponseStatusCodecException uint16 = 9 // 0x09 ResponseStatusConnectionClosed uint16 = 16 // 0x10 ResponseStatusServerSerialException uint16 = 17 // 0x11 ResponseStatusServerDeserialException uint16 = 18 // 0x12 RequestHeaderLen int = 22 // protocol header fields length ResponseHeaderLen int = 20 LessLen int = ResponseHeaderLen // minimal length for decoding RequestIdIndex = 5 RequestHeaderLenIndex = 16 ResponseHeaderLenIndex = 14 )
bolt constants
View Source
const ( // Encode/Decode Exception Msg UnKnownCmdType string = "unknown cmd type" UnKnownCmdCode string = "unknown cmd code" // Sofa Rpc Default HC Parameters SofaRPC = "SofaRpc" DefaultBoltHeartBeatTimeout = 6 * 15 * time.Second DefaultBoltHeartBeatInterval = 15 * time.Second DefaultIntervalJitter = 5 * time.Millisecond DefaultHealthyThreshold uint32 = 2 DefaultUnhealthyThreshold uint32 = 2 )
Variables ¶
View Source
var ( // Encode/Decode Exception ErrUnKnownCmdType = errors.New(UnKnownCmdType) ErrUnKnownCmdCode = errors.New(UnKnownCmdCode) )
View Source
var DefaultSofaRPCHealthCheckConf = v2.HealthCheck{ HealthCheckConfig: v2.HealthCheckConfig{ Protocol: SofaRPC, HealthyThreshold: DefaultHealthyThreshold, UnhealthyThreshold: DefaultUnhealthyThreshold, }, Timeout: DefaultBoltHeartBeatTimeout, Interval: DefaultBoltHeartBeatInterval, IntervalJitter: DefaultIntervalJitter, }
DefaultSofaRPCHealthCheckConf
Functions ¶
This section is empty.
Types ¶
type BoltStatusMapping ¶ added in v0.26.0
type BoltStatusMapping struct{}
func (BoltStatusMapping) MappingHeaderStatusCode ¶ added in v0.26.0
type Request ¶
type Request struct { RequestHeader Data api.IoBuffer // wrapper of raw data Content api.IoBuffer // wrapper of raw content ContentChanged bool // indicate that content changed // contains filtered or unexported fields }
Request is the cmd struct of bolt v1 request
func NewRpcRequest ¶
NewRpcRequest is a utility function which build rpc Request object of bolt protocol.
func (*Request) GetStreamType ¶
func (r *Request) GetStreamType() api.StreamType
func (*Request) GetTimeout ¶ added in v0.22.0
func (*Request) IsHeartbeatFrame ¶
func (*Request) SetRequestId ¶
type RequestHeader ¶
type RequestHeader struct { Protocol byte // meta fields CmdType byte CmdCode uint16 Version byte RequestId uint32 Codec byte Timeout int32 ClassLen uint16 HeaderLen uint16 ContentLen uint32 Class string // payload fields header.BytesHeader }
RequestHeader is the header part of bolt v1 request
type Response ¶
type Response struct { ResponseHeader Data api.IoBuffer // wrapper of raw data Content api.IoBuffer // wrapper of raw content ContentChanged bool // indicate that content changed // contains filtered or unexported fields }
Response is the cmd struct of bolt v1 response
func NewRpcResponse ¶
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) GetStatusCode ¶
func (*Response) GetStreamType ¶
func (r *Response) GetStreamType() api.StreamType
func (*Response) GetTimeout ¶ added in v0.22.0
response contains no timeout
func (*Response) IsHeartbeatFrame ¶
func (*Response) SetRequestId ¶
type ResponseHeader ¶
type ResponseHeader struct { Protocol byte // meta fields CmdType byte CmdCode uint16 Version byte RequestId uint32 Codec byte ResponseStatus uint16 ClassLen uint16 HeaderLen uint16 ContentLen uint32 Class string // payload fields header.BytesHeader }
RequestHeader is the header part of bolt v1 response
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 (*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
Click to show internal directories.
Click to hide internal directories.