Documentation ¶
Index ¶
- Constants
- Variables
- func GenerateMsgID() int64
- type DubboCodec
- func (p *DubboCodec) DecodeDubboReqBody(req *Request, bodyBuf *util.ReadBuffer) int
- func (p *DubboCodec) DecodeDubboReqBodyForRegstry(req *Request, bodyBuf *util.ReadBuffer) int
- func (p *DubboCodec) DecodeDubboReqHead(req *Request, header []byte, bodyLen *int) int
- func (p *DubboCodec) DecodeDubboRspBody(buffer *util.ReadBuffer, rsp *DubboRsp) int
- func (p *DubboCodec) DecodeDubboRsqHead(rsp *DubboRsp, header []byte, bodyLen *int) int
- func (p *DubboCodec) EncodeDubboReq(req *Request, buffer *util.WriteBuffer) int
- func (p *DubboCodec) EncodeDubboRsp(rsp *DubboRsp, buffer *util.WriteBuffer) int
- func (p *DubboCodec) GetContentTypeID() byte
- type DubboRPCInvocation
- func (p *DubboRPCInvocation) GetArguments() []util.Argument
- func (p *DubboRPCInvocation) GetAttachment(key string, defaultValue string) string
- func (p *DubboRPCInvocation) GetAttachments() map[string]string
- func (p *DubboRPCInvocation) GetMethodName() string
- func (p *DubboRPCInvocation) SetArguments(agrs []util.Argument)
- func (p *DubboRPCInvocation) SetAttachment(key string, value string)
- func (p *DubboRPCInvocation) SetAttachments(attachs map[string]string)
- func (p *DubboRPCInvocation) SetMethodName(name string)
- func (p *DubboRPCInvocation) SetVersion(ver string)
- type DubboRPCResult
- func (p *DubboRPCResult) GetAttachments() map[string]string
- func (p *DubboRPCResult) GetException() interface{}
- func (p *DubboRPCResult) GetValue() interface{}
- func (p *DubboRPCResult) SetAttachments(attach map[string]string)
- func (p *DubboRPCResult) SetException(e interface{})
- func (p *DubboRPCResult) SetValue(v interface{})
- type DubboRsp
- func (p *DubboRsp) GetErrorMsg() string
- func (p *DubboRsp) GetID() int64
- func (p *DubboRsp) GetStatus() byte
- func (p *DubboRsp) Init()
- func (p *DubboRsp) IsHeartbeat() bool
- func (p *DubboRsp) SetErrorMsg(err string)
- func (p *DubboRsp) SetEvent(bEvt bool)
- func (p *DubboRsp) SetID(reqID int64)
- func (p *DubboRsp) SetStatus(status byte)
- type InvokeContext
- type Request
- func (p *Request) GetData() interface{}
- func (p *Request) GetMsgID() int64
- func (p *Request) GetStatus() byte
- func (p *Request) IsBroken() bool
- func (p *Request) IsEvent() bool
- func (p *Request) IsHeartbeat() bool
- func (p *Request) IsTwoWay() bool
- func (p *Request) SetBroken(broken bool)
- func (p *Request) SetData(data interface{})
- func (p *Request) SetEvent(event string)
- func (p *Request) SetMsgID(id int64)
- func (p *Request) SetTwoWay(is bool)
Constants ¶
const ( HeaderLength = 16 Magic = 0xdabb MagicHigh = byte(0xda) MagicLow = byte(0xbb) FlagRequest = byte(0x80) FlagTwoWay = byte(0x40) FlagEvent = byte(0x20) SerializationMask = byte(0x1f) HeartBeatEvent = "" )
Constants for request and response attributes
const ( DubboVersionKey string = "dubbo" DubboVersion string = "2.0.0" PathKey string = "path" InterfaceKey string = "interface" VersionKey string = "version" CommaSeparator string = "," FileSeparator string = "/" SemicolonSeparator string = ";" )
Constants for dubbo attributes
const ( Success = 0 NeedMore = -1 InvalidFragement = -2 InvalidSerialization = -3 )
Constants
const ( Ok = byte(20) ClientTimeout = byte(30) ServerTimeout = byte(31) BadRequest = byte(40) BadResponse = byte(50) ServiceNotFound = byte(60) ServiceError = byte(70) ServerError = byte(80) ClentError = byte(90) ServerThreadPoolExhaustedError = byte(100) )
const ( ResponseWithException = byte(0) ResponseValue = byte(1) ResponseNullValue = byte(2) )
const (
Hessian2 = byte(2)
)
serialise type
Variables ¶
var GCurMSGID int64
GCurMSGID is a variable of type int64
Functions ¶
func GenerateMsgID ¶
func GenerateMsgID() int64
GenerateMsgID is a function which generates message ID
Types ¶
type DubboCodec ¶
type DubboCodec struct { }
DubboCodec is a struct
func (*DubboCodec) DecodeDubboReqBody ¶
func (p *DubboCodec) DecodeDubboReqBody(req *Request, bodyBuf *util.ReadBuffer) int
DecodeDubboReqBody is a method which decodes dobbo request body
func (*DubboCodec) DecodeDubboReqBodyForRegstry ¶
func (p *DubboCodec) DecodeDubboReqBodyForRegstry(req *Request, bodyBuf *util.ReadBuffer) int
DecodeDubboReqBodyForRegstry is a method which decodes dubbo request body from registry
func (*DubboCodec) DecodeDubboReqHead ¶
func (p *DubboCodec) DecodeDubboReqHead(req *Request, header []byte, bodyLen *int) int
DecodeDubboReqHead is a method which decodes dubbo request header
func (*DubboCodec) DecodeDubboRspBody ¶
func (p *DubboCodec) DecodeDubboRspBody(buffer *util.ReadBuffer, rsp *DubboRsp) int
DecodeDubboRspBody is a method which decodes dubbo response body
func (*DubboCodec) DecodeDubboRsqHead ¶
func (p *DubboCodec) DecodeDubboRsqHead(rsp *DubboRsp, header []byte, bodyLen *int) int
DecodeDubboRsqHead is a method which decodes dubbo response header
func (*DubboCodec) EncodeDubboReq ¶
func (p *DubboCodec) EncodeDubboReq(req *Request, buffer *util.WriteBuffer) int
EncodeDubboReq is a method which encodes dubbo request
func (*DubboCodec) EncodeDubboRsp ¶
func (p *DubboCodec) EncodeDubboRsp(rsp *DubboRsp, buffer *util.WriteBuffer) int
EncodeDubboRsp is a method which encodes dubbo response
func (*DubboCodec) GetContentTypeID ¶
func (p *DubboCodec) GetContentTypeID() byte
GetContentTypeID is a method which returns content type id
type DubboRPCInvocation ¶
type DubboRPCInvocation struct {
// contains filtered or unexported fields
}
DubboRPCInvocation is a struct
func (*DubboRPCInvocation) GetArguments ¶
func (p *DubboRPCInvocation) GetArguments() []util.Argument
GetArguments is a method which gets arguments
func (*DubboRPCInvocation) GetAttachment ¶
func (p *DubboRPCInvocation) GetAttachment(key string, defaultValue string) string
GetAttachment is a method which gets particular attachment
func (*DubboRPCInvocation) GetAttachments ¶
func (p *DubboRPCInvocation) GetAttachments() map[string]string
GetAttachments which gets all attachments
func (*DubboRPCInvocation) GetMethodName ¶
func (p *DubboRPCInvocation) GetMethodName() string
GetMethodName is a method which will get method name
func (*DubboRPCInvocation) SetArguments ¶
func (p *DubboRPCInvocation) SetArguments(agrs []util.Argument)
SetArguments is a method which sets arguments
func (*DubboRPCInvocation) SetAttachment ¶
func (p *DubboRPCInvocation) SetAttachment(key string, value string)
SetAttachment is a method which sets attachment
func (*DubboRPCInvocation) SetAttachments ¶
func (p *DubboRPCInvocation) SetAttachments(attachs map[string]string)
SetAttachments is a method which sets multiple attachment
func (*DubboRPCInvocation) SetMethodName ¶
func (p *DubboRPCInvocation) SetMethodName(name string)
SetMethodName is a method which sets method name
func (*DubboRPCInvocation) SetVersion ¶
func (p *DubboRPCInvocation) SetVersion(ver string)
SetVersion is a method which sets version
type DubboRPCResult ¶
type DubboRPCResult struct {
// contains filtered or unexported fields
}
DubboRPCResult is a struct which has attibutes for dubbo rpc result
func NewDubboRPCResult ¶
func NewDubboRPCResult() *DubboRPCResult
NewDubboRPCResult is a function which create new dubbo rpc result
func (*DubboRPCResult) GetAttachments ¶
func (p *DubboRPCResult) GetAttachments() map[string]string
GetAttachments is a method which gets attachment
func (*DubboRPCResult) GetException ¶
func (p *DubboRPCResult) GetException() interface{}
GetException is a method which gets exception
func (*DubboRPCResult) GetValue ¶
func (p *DubboRPCResult) GetValue() interface{}
GetValue is a method which gets value
func (*DubboRPCResult) SetAttachments ¶
func (p *DubboRPCResult) SetAttachments(attach map[string]string)
SetAttachments is a method which sets attachment
func (*DubboRPCResult) SetException ¶
func (p *DubboRPCResult) SetException(e interface{})
SetException is a method which sets exception
func (*DubboRPCResult) SetValue ¶
func (p *DubboRPCResult) SetValue(v interface{})
SetValue is a method which sets value
type DubboRsp ¶
type DubboRsp struct { DubboRPCResult // contains filtered or unexported fields }
DubboRsp is a struct which has attributes for dubbo response
func (*DubboRsp) GetErrorMsg ¶
GetErrorMsg is a method which gets error message
func (*DubboRsp) IsHeartbeat ¶
IsHeartbeat is a method which checks for heartbeat
func (*DubboRsp) SetErrorMsg ¶
SetErrorMsg is a method which sets error message
type InvokeContext ¶
type InvokeContext struct { Req *Request Rsp *DubboRsp Method *schema.DefMethod SvcName string RemoteAddr string }
InvokeContext is a struct which has attributes for invoke context
type Request ¶
type Request struct { DubboRPCInvocation // contains filtered or unexported fields }
Request is a struct
func NewDubboRequest ¶
func NewDubboRequest() *Request
NewDubboRequest is a function which creates new dubbo request
func (*Request) GetData ¶
func (p *Request) GetData() interface{}
GetData is a method which gets data