rpc

package
v1.17.1 Latest Latest
Warning

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

Go to latest
Published: Mar 29, 2022 License: Apache-2.0 Imports: 22 Imported by: 6

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrInvalidLengthDynamicdiscover        = fmt.Errorf("proto: negative length found during unmarshaling")
	ErrIntOverflowDynamicdiscover          = fmt.Errorf("proto: integer overflow")
	ErrUnexpectedEndOfGroupDynamicdiscover = fmt.Errorf("proto: unexpected end of group")
)
View Source
var (
	ErrInvalidLengthGogorpc        = fmt.Errorf("proto: negative length found during unmarshaling")
	ErrIntOverflowGogorpc          = fmt.Errorf("proto: integer overflow")
	ErrUnexpectedEndOfGroupGogorpc = fmt.Errorf("proto: unexpected end of group")
)
View Source
var LittleEndian bool

Functions

func AppendProcessor

func AppendProcessor(rpcProcessor IRpcProcessor)

func GetProcessorType

func GetProcessorType(param interface{}) (RpcProcessorType, IRpcProcessor)

func ReleaseCall

func ReleaseCall(call *Call)

func ReleaseRpcRequest

func ReleaseRpcRequest(rpcRequest *RpcRequest)

Types

type Call

type Call struct {
	Seq           uint64
	ServiceMethod string
	Reply         interface{}
	Response      *RpcResponse
	Err           error
	// contains filtered or unexported fields
}

func MakeCall

func MakeCall() *Call

func (*Call) Clear

func (call *Call) Clear() *Call

func (*Call) Done

func (call *Call) Done() *Call

func (*Call) IsRef

func (call *Call) IsRef() bool

func (*Call) Ref

func (call *Call) Ref()

func (*Call) Reset

func (call *Call) Reset()

func (*Call) UnRef

func (call *Call) UnRef()

type Client

type Client struct {
	network.TCPClient

	TriggerRpcEvent
	// contains filtered or unexported fields
}

func (*Client) AddPending

func (client *Client) AddPending(call *Call)

func (*Client) AsyncCall

func (client *Client) AsyncCall(rpcHandler IRpcHandler, serviceMethod string, callback reflect.Value, args interface{}, replyParam interface{}) error

func (*Client) Close

func (client *Client) Close(waitDone bool)

func (*Client) Connect

func (client *Client) Connect(id int, addr string, maxRpcParamLen uint32) error

func (*Client) FindPending

func (client *Client) FindPending(seq uint64) *Call

func (*Client) GetClientSeq

func (client *Client) GetClientSeq() uint32

func (*Client) GetId

func (client *Client) GetId() int

func (*Client) Go

func (client *Client) Go(noReply bool, serviceMethod string, args interface{}, reply interface{}) *Call

func (*Client) IsConnected

func (client *Client) IsConnected() bool

func (*Client) NewClientAgent

func (client *Client) NewClientAgent(conn *network.TCPConn) network.Agent

func (*Client) OnClose

func (client *Client) OnClose()

func (*Client) RawGo

func (client *Client) RawGo(processor IRpcProcessor, noReply bool, rpcMethodId uint32, serviceMethod string, args []byte, reply interface{}) *Call

func (*Client) RemovePending

func (client *Client) RemovePending(seq uint64) *Call

func (*Client) ResetPending

func (client *Client) ResetPending()

func (*Client) Run

func (client *Client) Run()

type Empty

type Empty struct {
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

Master->Client

func (*Empty) Descriptor

func (*Empty) Descriptor() ([]byte, []int)

func (*Empty) Marshal

func (m *Empty) Marshal() (dAtA []byte, err error)

func (*Empty) MarshalTo

func (m *Empty) MarshalTo(dAtA []byte) (int, error)

func (*Empty) MarshalToSizedBuffer

func (m *Empty) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*Empty) ProtoMessage

func (*Empty) ProtoMessage()

func (*Empty) Reset

func (m *Empty) Reset()

func (*Empty) Size

func (m *Empty) Size() (n int)

func (*Empty) String

func (m *Empty) String() string

func (*Empty) Unmarshal

func (m *Empty) Unmarshal(dAtA []byte) error

func (*Empty) XXX_DiscardUnknown

func (m *Empty) XXX_DiscardUnknown()

func (*Empty) XXX_Marshal

func (m *Empty) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*Empty) XXX_Merge

func (m *Empty) XXX_Merge(src proto.Message)

func (*Empty) XXX_Size

func (m *Empty) XXX_Size() int

func (*Empty) XXX_Unmarshal

func (m *Empty) XXX_Unmarshal(b []byte) error

type FuncRpcClient

type FuncRpcClient func(nodeId int, serviceMethod string, client []*Client) (error, int)

type FuncRpcServer

type FuncRpcServer func() *Server

type GoGoPBProcessor

type GoGoPBProcessor struct {
}

func (*GoGoPBProcessor) GetProcessorType

func (slf *GoGoPBProcessor) GetProcessorType() RpcProcessorType

func (*GoGoPBProcessor) IsParse

func (slf *GoGoPBProcessor) IsParse(param interface{}) bool

func (*GoGoPBProcessor) MakeRpcRequest

func (slf *GoGoPBProcessor) MakeRpcRequest(seq uint64, rpcMethodId uint32, serviceMethod string, noReply bool, inParam []byte) IRpcRequestData

func (*GoGoPBProcessor) MakeRpcResponse

func (slf *GoGoPBProcessor) MakeRpcResponse(seq uint64, err RpcError, reply []byte) IRpcResponseData

func (*GoGoPBProcessor) Marshal

func (slf *GoGoPBProcessor) Marshal(v interface{}) ([]byte, error)

func (*GoGoPBProcessor) ReleaseRpcRequest

func (slf *GoGoPBProcessor) ReleaseRpcRequest(rpcRequestData IRpcRequestData)

func (*GoGoPBProcessor) ReleaseRpcResponse

func (slf *GoGoPBProcessor) ReleaseRpcResponse(rpcResponseData IRpcResponseData)

func (*GoGoPBProcessor) Unmarshal

func (slf *GoGoPBProcessor) Unmarshal(data []byte, msg interface{}) error

type GoGoPBRpcRequestData

type GoGoPBRpcRequestData struct {
	Seq                  uint64   `protobuf:"varint,1,opt,name=Seq,proto3" json:"Seq,omitempty"`
	RpcMethodId          uint32   `protobuf:"varint,2,opt,name=RpcMethodId,proto3" json:"RpcMethodId,omitempty"`
	ServiceMethod        string   `protobuf:"bytes,3,opt,name=ServiceMethod,proto3" json:"ServiceMethod,omitempty"`
	NoReply              bool     `protobuf:"varint,4,opt,name=NoReply,proto3" json:"NoReply,omitempty"`
	InParam              []byte   `protobuf:"bytes,5,opt,name=InParam,proto3" json:"InParam,omitempty"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

func (*GoGoPBRpcRequestData) Descriptor

func (*GoGoPBRpcRequestData) Descriptor() ([]byte, []int)

func (*GoGoPBRpcRequestData) GetInParam

func (m *GoGoPBRpcRequestData) GetInParam() []byte

func (*GoGoPBRpcRequestData) GetNoReply

func (m *GoGoPBRpcRequestData) GetNoReply() bool

func (*GoGoPBRpcRequestData) GetRpcMethodId

func (m *GoGoPBRpcRequestData) GetRpcMethodId() uint32

func (*GoGoPBRpcRequestData) GetSeq

func (m *GoGoPBRpcRequestData) GetSeq() uint64

func (*GoGoPBRpcRequestData) GetServiceMethod

func (m *GoGoPBRpcRequestData) GetServiceMethod() string

func (*GoGoPBRpcRequestData) IsNoReply

func (slf *GoGoPBRpcRequestData) IsNoReply() bool

func (*GoGoPBRpcRequestData) MakeRequest

func (slf *GoGoPBRpcRequestData) MakeRequest(seq uint64, rpcMethodId uint32, serviceMethod string, noReply bool, inParam []byte) *GoGoPBRpcRequestData

func (*GoGoPBRpcRequestData) Marshal

func (m *GoGoPBRpcRequestData) Marshal() (dAtA []byte, err error)

func (*GoGoPBRpcRequestData) MarshalTo

func (m *GoGoPBRpcRequestData) MarshalTo(dAtA []byte) (int, error)

func (*GoGoPBRpcRequestData) MarshalToSizedBuffer

func (m *GoGoPBRpcRequestData) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*GoGoPBRpcRequestData) ProtoMessage

func (*GoGoPBRpcRequestData) ProtoMessage()

func (*GoGoPBRpcRequestData) Reset

func (m *GoGoPBRpcRequestData) Reset()

func (*GoGoPBRpcRequestData) Size

func (m *GoGoPBRpcRequestData) Size() (n int)

func (*GoGoPBRpcRequestData) String

func (m *GoGoPBRpcRequestData) String() string

func (*GoGoPBRpcRequestData) Unmarshal

func (m *GoGoPBRpcRequestData) Unmarshal(dAtA []byte) error

func (*GoGoPBRpcRequestData) XXX_DiscardUnknown

func (m *GoGoPBRpcRequestData) XXX_DiscardUnknown()

func (*GoGoPBRpcRequestData) XXX_Marshal

func (m *GoGoPBRpcRequestData) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*GoGoPBRpcRequestData) XXX_Merge

func (m *GoGoPBRpcRequestData) XXX_Merge(src proto.Message)

func (*GoGoPBRpcRequestData) XXX_Size

func (m *GoGoPBRpcRequestData) XXX_Size() int

func (*GoGoPBRpcRequestData) XXX_Unmarshal

func (m *GoGoPBRpcRequestData) XXX_Unmarshal(b []byte) error

type GoGoPBRpcResponseData

type GoGoPBRpcResponseData struct {
	Seq                  uint64   `protobuf:"varint,1,opt,name=Seq,proto3" json:"Seq,omitempty"`
	Error                string   `protobuf:"bytes,2,opt,name=Error,proto3" json:"Error,omitempty"`
	Reply                []byte   `protobuf:"bytes,3,opt,name=Reply,proto3" json:"Reply,omitempty"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

func (*GoGoPBRpcResponseData) Descriptor

func (*GoGoPBRpcResponseData) Descriptor() ([]byte, []int)

func (*GoGoPBRpcResponseData) GetErr

func (slf *GoGoPBRpcResponseData) GetErr() *RpcError

func (*GoGoPBRpcResponseData) GetError

func (m *GoGoPBRpcResponseData) GetError() string

func (*GoGoPBRpcResponseData) GetReply

func (m *GoGoPBRpcResponseData) GetReply() []byte

func (*GoGoPBRpcResponseData) GetSeq

func (m *GoGoPBRpcResponseData) GetSeq() uint64

func (*GoGoPBRpcResponseData) MakeRespone

func (slf *GoGoPBRpcResponseData) MakeRespone(seq uint64, err RpcError, reply []byte) *GoGoPBRpcResponseData

func (*GoGoPBRpcResponseData) Marshal

func (m *GoGoPBRpcResponseData) Marshal() (dAtA []byte, err error)

func (*GoGoPBRpcResponseData) MarshalTo

func (m *GoGoPBRpcResponseData) MarshalTo(dAtA []byte) (int, error)

func (*GoGoPBRpcResponseData) MarshalToSizedBuffer

func (m *GoGoPBRpcResponseData) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*GoGoPBRpcResponseData) ProtoMessage

func (*GoGoPBRpcResponseData) ProtoMessage()

func (*GoGoPBRpcResponseData) Reset

func (m *GoGoPBRpcResponseData) Reset()

func (*GoGoPBRpcResponseData) Size

func (m *GoGoPBRpcResponseData) Size() (n int)

func (*GoGoPBRpcResponseData) String

func (m *GoGoPBRpcResponseData) String() string

func (*GoGoPBRpcResponseData) Unmarshal

func (m *GoGoPBRpcResponseData) Unmarshal(dAtA []byte) error

func (*GoGoPBRpcResponseData) XXX_DiscardUnknown

func (m *GoGoPBRpcResponseData) XXX_DiscardUnknown()

func (*GoGoPBRpcResponseData) XXX_Marshal

func (m *GoGoPBRpcResponseData) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*GoGoPBRpcResponseData) XXX_Merge

func (m *GoGoPBRpcResponseData) XXX_Merge(src proto.Message)

func (*GoGoPBRpcResponseData) XXX_Size

func (m *GoGoPBRpcResponseData) XXX_Size() int

func (*GoGoPBRpcResponseData) XXX_Unmarshal

func (m *GoGoPBRpcResponseData) XXX_Unmarshal(b []byte) error

type IRawInputArgs

type IRawInputArgs interface {
	GetRawData() []byte //获取原始数据
	DoFree()            //处理完成,回收内存
	DoEscape()          //逃逸,GC自动回收
}

type IRpcHandler

type IRpcHandler interface {
	IRpcHandlerChannel
	GetName() string
	InitRpcHandler(rpcHandler IRpcHandler, getClientFun FuncRpcClient, getServerFun FuncRpcServer, rpcHandlerChannel IRpcHandlerChannel)
	GetRpcHandler() IRpcHandler
	HandlerRpcRequest(request *RpcRequest)
	HandlerRpcResponseCB(call *Call)
	CallMethod(ServiceMethod string, param interface{}, reply interface{}) error
	AsyncCall(serviceMethod string, args interface{}, callback interface{}) error
	Call(serviceMethod string, args interface{}, reply interface{}) error
	Go(serviceMethod string, args interface{}) error
	AsyncCallNode(nodeId int, serviceMethod string, args interface{}, callback interface{}) error
	CallNode(nodeId int, serviceMethod string, args interface{}, reply interface{}) error
	GoNode(nodeId int, serviceMethod string, args interface{}) error
	RawGoNode(rpcProcessorType RpcProcessorType, nodeId int, rpcMethodId uint32, serviceName string, rawArgs IRawInputArgs) error
	CastGo(serviceMethod string, args interface{}) error
	IsSingleCoroutine() bool
	UnmarshalInParam(rpcProcessor IRpcProcessor, serviceMethod string, rawRpcMethodId uint32, inParam []byte) (interface{}, error)
}

type IRpcHandlerChannel

type IRpcHandlerChannel interface {
	PushRpcResponse(call *Call) error
	PushRpcRequest(rpcRequest *RpcRequest) error
}

type IRpcListener

type IRpcListener interface {
	OnNodeConnected(nodeId int)
	OnNodeDisconnect(nodeId int)
}

type IRpcProcessor

type IRpcProcessor interface {
	Marshal(v interface{}) ([]byte, error) //b表示自定义缓冲区,可以填nil,由系统自动分配
	Unmarshal(data []byte, v interface{}) error
	MakeRpcRequest(seq uint64, rpcMethodId uint32, serviceMethod string, noReply bool, inParam []byte) IRpcRequestData
	MakeRpcResponse(seq uint64, err RpcError, reply []byte) IRpcResponseData

	ReleaseRpcRequest(rpcRequestData IRpcRequestData)
	ReleaseRpcResponse(rpcRequestData IRpcResponseData)
	IsParse(param interface{}) bool //是否可解析
	GetProcessorType() RpcProcessorType
}

func GetProcessor

func GetProcessor(processorType uint8) IRpcProcessor

type IRpcRequestData

type IRpcRequestData interface {
	GetSeq() uint64
	GetServiceMethod() string
	GetInParam() []byte
	IsNoReply() bool
	GetRpcMethodId() uint32
}

type IRpcResponseData

type IRpcResponseData interface {
	GetSeq() uint64
	GetErr() *RpcError
	GetReply() []byte
}

type JsonProcessor

type JsonProcessor struct {
}

func (*JsonProcessor) GetProcessorType

func (jsonProcessor *JsonProcessor) GetProcessorType() RpcProcessorType

func (*JsonProcessor) IsParse

func (jsonProcessor *JsonProcessor) IsParse(param interface{}) bool

func (*JsonProcessor) MakeRpcRequest

func (jsonProcessor *JsonProcessor) MakeRpcRequest(seq uint64, rpcMethodId uint32, serviceMethod string, noReply bool, inParam []byte) IRpcRequestData

func (*JsonProcessor) MakeRpcResponse

func (jsonProcessor *JsonProcessor) MakeRpcResponse(seq uint64, err RpcError, reply []byte) IRpcResponseData

func (*JsonProcessor) Marshal

func (jsonProcessor *JsonProcessor) Marshal(v interface{}) ([]byte, error)

func (*JsonProcessor) ReleaseRpcRequest

func (jsonProcessor *JsonProcessor) ReleaseRpcRequest(rpcRequestData IRpcRequestData)

func (*JsonProcessor) ReleaseRpcResponse

func (jsonProcessor *JsonProcessor) ReleaseRpcResponse(rpcResponseData IRpcResponseData)

func (*JsonProcessor) Unmarshal

func (jsonProcessor *JsonProcessor) Unmarshal(data []byte, v interface{}) error

type JsonRpcRequestData

type JsonRpcRequestData struct {
	//packhead
	Seq uint64 // sequence number chosen by client

	ServiceMethod string // format: "Service.Method"
	NoReply       bool   //是否需要返回
	//packbody
	InParam []byte
	// contains filtered or unexported fields
}

func (*JsonRpcRequestData) GetInParam

func (jsonRpcRequestData *JsonRpcRequestData) GetInParam() []byte

func (*JsonRpcRequestData) GetRpcMethodId

func (jsonRpcRequestData *JsonRpcRequestData) GetRpcMethodId() uint32

func (*JsonRpcRequestData) GetSeq

func (jsonRpcRequestData *JsonRpcRequestData) GetSeq() uint64

func (*JsonRpcRequestData) GetServiceMethod

func (jsonRpcRequestData *JsonRpcRequestData) GetServiceMethod() string

func (*JsonRpcRequestData) IsNoReply

func (jsonRpcRequestData *JsonRpcRequestData) IsNoReply() bool

type JsonRpcResponseData

type JsonRpcResponseData struct {
	//head
	Seq uint64 // sequence number chosen by client
	Err string

	//returns
	Reply []byte
}

func (*JsonRpcResponseData) GetErr

func (jsonRpcResponseData *JsonRpcResponseData) GetErr() *RpcError

func (*JsonRpcResponseData) GetReply

func (jsonRpcResponseData *JsonRpcResponseData) GetReply() []byte

func (*JsonRpcResponseData) GetSeq

func (jsonRpcResponseData *JsonRpcResponseData) GetSeq() uint64

type NodeInfo

type NodeInfo struct {
	NodeId               int32    `protobuf:"varint,1,opt,name=NodeId,proto3" json:"NodeId,omitempty"`
	NodeName             string   `protobuf:"bytes,2,opt,name=NodeName,proto3" json:"NodeName,omitempty"`
	ListenAddr           string   `protobuf:"bytes,3,opt,name=ListenAddr,proto3" json:"ListenAddr,omitempty"`
	MaxRpcParamLen       uint32   `protobuf:"varint,4,opt,name=MaxRpcParamLen,proto3" json:"MaxRpcParamLen,omitempty"`
	Private              bool     `protobuf:"varint,5,opt,name=Private,proto3" json:"Private,omitempty"`
	PublicServiceList    []string `protobuf:"bytes,6,rep,name=PublicServiceList,proto3" json:"PublicServiceList,omitempty"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

func (*NodeInfo) Descriptor

func (*NodeInfo) Descriptor() ([]byte, []int)

func (*NodeInfo) GetListenAddr

func (m *NodeInfo) GetListenAddr() string

func (*NodeInfo) GetMaxRpcParamLen

func (m *NodeInfo) GetMaxRpcParamLen() uint32

func (*NodeInfo) GetNodeId

func (m *NodeInfo) GetNodeId() int32

func (*NodeInfo) GetNodeName

func (m *NodeInfo) GetNodeName() string

func (*NodeInfo) GetPrivate

func (m *NodeInfo) GetPrivate() bool

func (*NodeInfo) GetPublicServiceList

func (m *NodeInfo) GetPublicServiceList() []string

func (*NodeInfo) Marshal

func (m *NodeInfo) Marshal() (dAtA []byte, err error)

func (*NodeInfo) MarshalTo

func (m *NodeInfo) MarshalTo(dAtA []byte) (int, error)

func (*NodeInfo) MarshalToSizedBuffer

func (m *NodeInfo) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*NodeInfo) ProtoMessage

func (*NodeInfo) ProtoMessage()

func (*NodeInfo) Reset

func (m *NodeInfo) Reset()

func (*NodeInfo) Size

func (m *NodeInfo) Size() (n int)

func (*NodeInfo) String

func (m *NodeInfo) String() string

func (*NodeInfo) Unmarshal

func (m *NodeInfo) Unmarshal(dAtA []byte) error

func (*NodeInfo) XXX_DiscardUnknown

func (m *NodeInfo) XXX_DiscardUnknown()

func (*NodeInfo) XXX_Marshal

func (m *NodeInfo) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*NodeInfo) XXX_Merge

func (m *NodeInfo) XXX_Merge(src proto.Message)

func (*NodeInfo) XXX_Size

func (m *NodeInfo) XXX_Size() int

func (*NodeInfo) XXX_Unmarshal

func (m *NodeInfo) XXX_Unmarshal(b []byte) error

type RawRpcCallBack

type RawRpcCallBack interface {
	Unmarshal(data []byte) (interface{}, error)
	CB(data interface{})
}

type RequestHandler

type RequestHandler func(Returns interface{}, Err RpcError)

type Responder

type Responder = RequestHandler

func (*Responder) IsInvalid

func (r *Responder) IsInvalid() bool

type RpcAgent

type RpcAgent struct {
	// contains filtered or unexported fields
}

func (*RpcAgent) Close

func (agent *RpcAgent) Close()

func (*RpcAgent) Destroy

func (agent *RpcAgent) Destroy()

func (*RpcAgent) LocalAddr

func (agent *RpcAgent) LocalAddr() net.Addr

func (*RpcAgent) OnClose

func (agent *RpcAgent) OnClose()

func (*RpcAgent) OnDestroy

func (agent *RpcAgent) OnDestroy()

func (*RpcAgent) RemoteAddr

func (agent *RpcAgent) RemoteAddr() net.Addr

func (*RpcAgent) Run

func (agent *RpcAgent) Run()

func (*RpcAgent) WriteMsg

func (agent *RpcAgent) WriteMsg(msg interface{})

func (*RpcAgent) WriteResponse

func (agent *RpcAgent) WriteResponse(processor IRpcProcessor, serviceMethod string, seq uint64, reply interface{}, rpcError RpcError)

type RpcError

type RpcError string
var NilError RpcError

func ConvertError

func ConvertError(e error) RpcError

func (RpcError) Error

func (e RpcError) Error() string

type RpcHandleFinder

type RpcHandleFinder interface {
	FindRpcHandler(serviceMethod string) IRpcHandler
}

type RpcHandler

type RpcHandler struct {
	IRpcHandlerChannel
	// contains filtered or unexported fields
}

func (*RpcHandler) AsyncCall

func (handler *RpcHandler) AsyncCall(serviceMethod string, args interface{}, callback interface{}) error

func (*RpcHandler) AsyncCallNode

func (handler *RpcHandler) AsyncCallNode(nodeId int, serviceMethod string, args interface{}, callback interface{}) error

func (*RpcHandler) Call

func (handler *RpcHandler) Call(serviceMethod string, args interface{}, reply interface{}) error

func (*RpcHandler) CallMethod

func (handler *RpcHandler) CallMethod(ServiceMethod string, param interface{}, reply interface{}) error

func (*RpcHandler) CallNode

func (handler *RpcHandler) CallNode(nodeId int, serviceMethod string, args interface{}, reply interface{}) error

func (*RpcHandler) CastGo

func (handler *RpcHandler) CastGo(serviceMethod string, args interface{}) error

func (*RpcHandler) GetName

func (handler *RpcHandler) GetName() string

func (*RpcHandler) GetRpcHandler

func (handler *RpcHandler) GetRpcHandler() IRpcHandler

func (*RpcHandler) Go

func (handler *RpcHandler) Go(serviceMethod string, args interface{}) error

func (*RpcHandler) GoNode

func (handler *RpcHandler) GoNode(nodeId int, serviceMethod string, args interface{}) error

func (*RpcHandler) HandlerRpcRequest

func (handler *RpcHandler) HandlerRpcRequest(request *RpcRequest)

func (*RpcHandler) HandlerRpcResponseCB

func (handler *RpcHandler) HandlerRpcResponseCB(call *Call)

func (*RpcHandler) InitRpcHandler

func (handler *RpcHandler) InitRpcHandler(rpcHandler IRpcHandler, getClientFun FuncRpcClient, getServerFun FuncRpcServer, rpcHandlerChannel IRpcHandlerChannel)

func (*RpcHandler) IsSingleCoroutine

func (handler *RpcHandler) IsSingleCoroutine() bool

func (*RpcHandler) RawGoNode

func (handler *RpcHandler) RawGoNode(rpcProcessorType RpcProcessorType, nodeId int, rpcMethodId uint32, serviceName string, rawArgs IRawInputArgs) error

func (*RpcHandler) RegRawRpc

func (handler *RpcHandler) RegRawRpc(rpcMethodId uint32, rawRpcCB RawRpcCallBack)

func (*RpcHandler) RegisterRpc

func (handler *RpcHandler) RegisterRpc(rpcHandler IRpcHandler) error

func (*RpcHandler) UnmarshalInParam

func (handler *RpcHandler) UnmarshalInParam(rpcProcessor IRpcProcessor, serviceMethod string, rawRpcMethodId uint32, inParam []byte) (interface{}, error)

type RpcMethodInfo

type RpcMethodInfo struct {
	// contains filtered or unexported fields
}

type RpcProcessorType

type RpcProcessorType uint8
const (
	RpcProcessorJson   RpcProcessorType = 0
	RpcProcessorGoGoPB RpcProcessorType = 1
)

type RpcRequest

type RpcRequest struct {
	RpcRequestData IRpcRequestData
	// contains filtered or unexported fields
}

func MakeRpcRequest

func MakeRpcRequest(rpcProcessor IRpcProcessor, seq uint64, rpcMethodId uint32, serviceMethod string, noReply bool, inParam []byte) *RpcRequest

func (*RpcRequest) Clear

func (slf *RpcRequest) Clear() *RpcRequest

func (*RpcRequest) IsRef

func (slf *RpcRequest) IsRef() bool

func (*RpcRequest) Ref

func (slf *RpcRequest) Ref()

func (*RpcRequest) Reset

func (slf *RpcRequest) Reset()

func (*RpcRequest) UnRef

func (slf *RpcRequest) UnRef()

type RpcResponse

type RpcResponse struct {
	RpcResponseData IRpcResponseData
}

func (*RpcResponse) Clear

func (rpcResponse *RpcResponse) Clear() *RpcResponse

type Server

type Server struct {
	// contains filtered or unexported fields
}

func (*Server) Init

func (server *Server) Init(rpcHandleFinder RpcHandleFinder)

func (*Server) NewAgent

func (server *Server) NewAgent(c *network.TCPConn) network.Agent

func (*Server) Start

func (server *Server) Start(listenAddr string, maxRpcParamLen uint32)

type ServiceDiscoverReq

type ServiceDiscoverReq struct {
	NodeInfo             *NodeInfo `protobuf:"bytes,1,opt,name=nodeInfo,proto3" json:"nodeInfo,omitempty"`
	XXX_NoUnkeyedLiteral struct{}  `json:"-"`
	XXX_unrecognized     []byte    `json:"-"`
	XXX_sizecache        int32     `json:"-"`
}

Client->Master

func (*ServiceDiscoverReq) Descriptor

func (*ServiceDiscoverReq) Descriptor() ([]byte, []int)

func (*ServiceDiscoverReq) GetNodeInfo

func (m *ServiceDiscoverReq) GetNodeInfo() *NodeInfo

func (*ServiceDiscoverReq) Marshal

func (m *ServiceDiscoverReq) Marshal() (dAtA []byte, err error)

func (*ServiceDiscoverReq) MarshalTo

func (m *ServiceDiscoverReq) MarshalTo(dAtA []byte) (int, error)

func (*ServiceDiscoverReq) MarshalToSizedBuffer

func (m *ServiceDiscoverReq) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*ServiceDiscoverReq) ProtoMessage

func (*ServiceDiscoverReq) ProtoMessage()

func (*ServiceDiscoverReq) Reset

func (m *ServiceDiscoverReq) Reset()

func (*ServiceDiscoverReq) Size

func (m *ServiceDiscoverReq) Size() (n int)

func (*ServiceDiscoverReq) String

func (m *ServiceDiscoverReq) String() string

func (*ServiceDiscoverReq) Unmarshal

func (m *ServiceDiscoverReq) Unmarshal(dAtA []byte) error

func (*ServiceDiscoverReq) XXX_DiscardUnknown

func (m *ServiceDiscoverReq) XXX_DiscardUnknown()

func (*ServiceDiscoverReq) XXX_Marshal

func (m *ServiceDiscoverReq) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*ServiceDiscoverReq) XXX_Merge

func (m *ServiceDiscoverReq) XXX_Merge(src proto.Message)

func (*ServiceDiscoverReq) XXX_Size

func (m *ServiceDiscoverReq) XXX_Size() int

func (*ServiceDiscoverReq) XXX_Unmarshal

func (m *ServiceDiscoverReq) XXX_Unmarshal(b []byte) error

type SubscribeDiscoverNotify

type SubscribeDiscoverNotify struct {
	MasterNodeId         int32       `protobuf:"varint,1,opt,name=MasterNodeId,proto3" json:"MasterNodeId,omitempty"`
	IsFull               bool        `protobuf:"varint,2,opt,name=IsFull,proto3" json:"IsFull,omitempty"`
	DelNodeId            int32       `protobuf:"varint,3,opt,name=DelNodeId,proto3" json:"DelNodeId,omitempty"`
	NodeInfo             []*NodeInfo `protobuf:"bytes,4,rep,name=nodeInfo,proto3" json:"nodeInfo,omitempty"`
	XXX_NoUnkeyedLiteral struct{}    `json:"-"`
	XXX_unrecognized     []byte      `json:"-"`
	XXX_sizecache        int32       `json:"-"`
}

Master->Client

func (*SubscribeDiscoverNotify) Descriptor

func (*SubscribeDiscoverNotify) Descriptor() ([]byte, []int)

func (*SubscribeDiscoverNotify) GetDelNodeId

func (m *SubscribeDiscoverNotify) GetDelNodeId() int32

func (*SubscribeDiscoverNotify) GetIsFull

func (m *SubscribeDiscoverNotify) GetIsFull() bool

func (*SubscribeDiscoverNotify) GetMasterNodeId

func (m *SubscribeDiscoverNotify) GetMasterNodeId() int32

func (*SubscribeDiscoverNotify) GetNodeInfo

func (m *SubscribeDiscoverNotify) GetNodeInfo() []*NodeInfo

func (*SubscribeDiscoverNotify) Marshal

func (m *SubscribeDiscoverNotify) Marshal() (dAtA []byte, err error)

func (*SubscribeDiscoverNotify) MarshalTo

func (m *SubscribeDiscoverNotify) MarshalTo(dAtA []byte) (int, error)

func (*SubscribeDiscoverNotify) MarshalToSizedBuffer

func (m *SubscribeDiscoverNotify) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*SubscribeDiscoverNotify) ProtoMessage

func (*SubscribeDiscoverNotify) ProtoMessage()

func (*SubscribeDiscoverNotify) Reset

func (m *SubscribeDiscoverNotify) Reset()

func (*SubscribeDiscoverNotify) Size

func (m *SubscribeDiscoverNotify) Size() (n int)

func (*SubscribeDiscoverNotify) String

func (m *SubscribeDiscoverNotify) String() string

func (*SubscribeDiscoverNotify) Unmarshal

func (m *SubscribeDiscoverNotify) Unmarshal(dAtA []byte) error

func (*SubscribeDiscoverNotify) XXX_DiscardUnknown

func (m *SubscribeDiscoverNotify) XXX_DiscardUnknown()

func (*SubscribeDiscoverNotify) XXX_Marshal

func (m *SubscribeDiscoverNotify) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*SubscribeDiscoverNotify) XXX_Merge

func (m *SubscribeDiscoverNotify) XXX_Merge(src proto.Message)

func (*SubscribeDiscoverNotify) XXX_Size

func (m *SubscribeDiscoverNotify) XXX_Size() int

func (*SubscribeDiscoverNotify) XXX_Unmarshal

func (m *SubscribeDiscoverNotify) XXX_Unmarshal(b []byte) error

type TriggerRpcEvent

type TriggerRpcEvent func(bConnect bool, clientSeq uint32, nodeId int)

Jump to

Keyboard shortcuts

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