dubbo

package
v0.0.0-...-4d3f714 Latest Latest
Warning

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

Go to latest
Published: Jul 20, 2018 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
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

View Source
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

View Source
const (
	Success              = 0
	NeedMore             = -1
	InvalidFragement     = -2
	InvalidSerialization = -3
)

Constants

View Source
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)
)
View Source
const (
	ResponseWithException = byte(0)
	ResponseValue         = byte(1)
	ResponseNullValue     = byte(2)
)
View Source
const (
	Hessian2 = byte(2)
)

serialise type

Variables

View Source
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

func (p *DubboRsp) GetErrorMsg() string

GetErrorMsg is a method which gets error message

func (*DubboRsp) GetID

func (p *DubboRsp) GetID() int64

GetID is a method which gets ID

func (*DubboRsp) GetStatus

func (p *DubboRsp) GetStatus() byte

GetStatus is a method which gets status

func (*DubboRsp) Init

func (p *DubboRsp) Init()

Init method initializes value

func (*DubboRsp) IsHeartbeat

func (p *DubboRsp) IsHeartbeat() bool

IsHeartbeat is a method which checks for heartbeat

func (*DubboRsp) SetErrorMsg

func (p *DubboRsp) SetErrorMsg(err string)

SetErrorMsg is a method which sets error message

func (*DubboRsp) SetEvent

func (p *DubboRsp) SetEvent(bEvt bool)

SetEvent is a method which sets event

func (*DubboRsp) SetID

func (p *DubboRsp) SetID(reqID int64)

SetID is a method which sets ID

func (*DubboRsp) SetStatus

func (p *DubboRsp) SetStatus(status byte)

SetStatus is a method which sets status

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

func (*Request) GetMsgID

func (p *Request) GetMsgID() int64

GetMsgID gets message ID

func (*Request) GetStatus

func (p *Request) GetStatus() byte

GetStatus gets the status

func (*Request) IsBroken

func (p *Request) IsBroken() bool

IsBroken check whether the connection is broken

func (*Request) IsEvent

func (p *Request) IsEvent() bool

IsEvent checks whether event is present

func (*Request) IsHeartbeat

func (p *Request) IsHeartbeat() bool

IsHeartbeat is method

func (*Request) IsTwoWay

func (p *Request) IsTwoWay() bool

IsTwoWay is a method which checks whether it is two-way connection

func (*Request) SetBroken

func (p *Request) SetBroken(broken bool)

SetBroken sets connection as broken

func (*Request) SetData

func (p *Request) SetData(data interface{})

SetData is a method which sets data

func (*Request) SetEvent

func (p *Request) SetEvent(event string)

SetEvent sets event to be true

func (*Request) SetMsgID

func (p *Request) SetMsgID(id int64)

SetMsgID sets message ID

func (*Request) SetTwoWay

func (p *Request) SetTwoWay(is bool)

SetTwoWay is a method which set the connection to two-way

Jump to

Keyboard shortcuts

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