Documentation ¶
Index ¶
- Variables
- func ReleaseCall(call *Call)
- func ReleaseRpcRequest(rpcRequest *RpcRequest)
- func ReleaseRpcResponse(rpcRespone *RpcResponse)
- func SetProcessor(proc IRpcProcessor)
- type Call
- type Client
- func (slf *Client) AddPending(call *Call)
- func (slf *Client) AsycCall(rpcHandler IRpcHandler, serviceMethod string, callback reflect.Value, ...) error
- func (slf *Client) Connect(addr string) error
- func (slf *Client) FindPending(seq uint64) *Call
- func (slf *Client) Go(noReply bool, serviceMethod string, args interface{}, reply interface{}) *Call
- func (slf *Client) IsConnected() bool
- func (slf *Client) NewClientAgent(conn *network.TCPConn) network.Agent
- func (slf *Client) OnClose()
- func (slf *Client) RemovePending(seq uint64) *Call
- func (slf *Client) ResetPending()
- func (slf *Client) Run()
- type FuncRpcClient
- type FuncRpcServer
- type IRpcHandler
- type IRpcProcessor
- type IRpcRequestData
- type IRpcResponseData
- type JsonProcessor
- func (slf *JsonProcessor) MakeRpcRequest(seq uint64, serviceMethod string, noReply bool, inParam []byte) IRpcRequestData
- func (slf *JsonProcessor) MakeRpcResponse(seq uint64, err *RpcError, reply []byte) IRpcResponseData
- func (slf *JsonProcessor) Marshal(v interface{}) ([]byte, error)
- func (slf *JsonProcessor) ReleaseRpcRequest(rpcRequestData IRpcRequestData)
- func (slf *JsonProcessor) ReleaseRpcRespose(rpcRequestData IRpcResponseData)
- func (slf *JsonProcessor) Unmarshal(data []byte, v interface{}) error
- type JsonRpcRequestData
- type JsonRpcResponseData
- type PBProcessor
- func (slf *PBProcessor) MakeRpcRequest(seq uint64, serviceMethod string, noReply bool, inParam []byte) IRpcRequestData
- func (slf *PBProcessor) MakeRpcResponse(seq uint64, err *RpcError, reply []byte) IRpcResponseData
- func (slf *PBProcessor) Marshal(v interface{}) ([]byte, error)
- func (slf *PBProcessor) ReleaseRpcRequest(rpcRequestData IRpcRequestData)
- func (slf *PBProcessor) ReleaseRpcRespose(rpcRequestData IRpcResponseData)
- func (slf *PBProcessor) Unmarshal(data []byte, msg interface{}) error
- type PBRpcRequestData
- func (*PBRpcRequestData) Descriptor() ([]byte, []int)
- func (m *PBRpcRequestData) GetInParam() []byte
- func (m *PBRpcRequestData) GetNoReply() bool
- func (m *PBRpcRequestData) GetSeq() uint64
- func (m *PBRpcRequestData) GetServiceMethod() string
- func (slf *PBRpcRequestData) IsNoReply() bool
- func (slf *PBRpcRequestData) MakeRequest(seq uint64, serviceMethod string, noReply bool, inParam []byte) *PBRpcRequestData
- func (*PBRpcRequestData) ProtoMessage()
- func (m *PBRpcRequestData) Reset()
- func (m *PBRpcRequestData) String() string
- func (m *PBRpcRequestData) XXX_DiscardUnknown()
- func (m *PBRpcRequestData) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *PBRpcRequestData) XXX_Merge(src proto.Message)
- func (m *PBRpcRequestData) XXX_Size() int
- func (m *PBRpcRequestData) XXX_Unmarshal(b []byte) error
- type PBRpcResponseData
- func (*PBRpcResponseData) Descriptor() ([]byte, []int)
- func (slf *PBRpcResponseData) GetErr() *RpcError
- func (m *PBRpcResponseData) GetError() string
- func (m *PBRpcResponseData) GetReply() []byte
- func (m *PBRpcResponseData) GetSeq() uint64
- func (slf *PBRpcResponseData) MakeRespone(seq uint64, err *RpcError, reply []byte) *PBRpcResponseData
- func (*PBRpcResponseData) ProtoMessage()
- func (m *PBRpcResponseData) Reset()
- func (m *PBRpcResponseData) String() string
- func (m *PBRpcResponseData) XXX_DiscardUnknown()
- func (m *PBRpcResponseData) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *PBRpcResponseData) XXX_Merge(src proto.Message)
- func (m *PBRpcResponseData) XXX_Size() int
- func (m *PBRpcResponseData) XXX_Unmarshal(b []byte) error
- type RequestHandler
- type RpcAgent
- func (agent *RpcAgent) Close()
- func (agent *RpcAgent) Destroy()
- func (agent *RpcAgent) LocalAddr() net.Addr
- func (agent *RpcAgent) OnClose()
- func (gate *RpcAgent) OnDestroy()
- func (agent *RpcAgent) RemoteAddr() net.Addr
- func (agent *RpcAgent) Run()
- func (agent *RpcAgent) WriteMsg(msg interface{})
- func (agent *RpcAgent) WriteRespone(serviceMethod string, seq uint64, reply interface{}, err *RpcError)
- type RpcError
- type RpcHandleFinder
- type RpcHandler
- func (slf *RpcHandler) AsyncCall(serviceMethod string, args interface{}, callback interface{}) error
- func (slf *RpcHandler) AsyncCallNode(nodeId int, serviceMethod string, args interface{}, callback interface{}) error
- func (slf *RpcHandler) Call(serviceMethod string, args interface{}, reply interface{}) error
- func (slf *RpcHandler) CallMethod(ServiceMethod string, param interface{}, reply interface{}) error
- func (slf *RpcHandler) CallNode(nodeId int, serviceMethod string, args interface{}, reply interface{}) error
- func (slf *RpcHandler) CastGo(serviceMethod string, args interface{})
- func (slf *RpcHandler) GetName() string
- func (slf *RpcHandler) GetRpcHandler() IRpcHandler
- func (slf *RpcHandler) GetRpcRequestChan() chan *RpcRequest
- func (slf *RpcHandler) GetRpcResponeChan() chan *Call
- func (slf *RpcHandler) Go(serviceMethod string, args interface{}) error
- func (slf *RpcHandler) GoNode(nodeId int, serviceMethod string, args interface{}) error
- func (slf *RpcHandler) HandlerRpcRequest(request *RpcRequest)
- func (slf *RpcHandler) HandlerRpcResponeCB(call *Call)
- func (slf *RpcHandler) InitRpcHandler(rpcHandler IRpcHandler, getClientFun FuncRpcClient, getServerFun FuncRpcServer)
- func (slf *RpcHandler) PushRequest(req *RpcRequest) error
- func (slf *RpcHandler) RegisterRpc(rpcHandler IRpcHandler) error
- type RpcMethodInfo
- type RpcRequest
- type RpcResponse
- type Server
Constants ¶
This section is empty.
Variables ¶
View Source
var LittleEndian bool
Functions ¶
func ReleaseCall ¶
func ReleaseCall(call *Call)
func ReleaseRpcRequest ¶
func ReleaseRpcRequest(rpcRequest *RpcRequest)
func ReleaseRpcResponse ¶
func ReleaseRpcResponse(rpcRespone *RpcResponse)
func SetProcessor ¶
func SetProcessor(proc IRpcProcessor)
Types ¶
type Call ¶
type Call struct { Seq uint64 ServiceMethod string Arg interface{} Reply interface{} Respone *RpcResponse Err error // contains filtered or unexported fields }
type Client ¶
func (*Client) AddPending ¶
func (*Client) FindPending ¶
func (*Client) IsConnected ¶
func (*Client) NewClientAgent ¶
func (*Client) RemovePending ¶
func (*Client) ResetPending ¶
func (slf *Client) ResetPending()
type FuncRpcClient ¶
type FuncRpcServer ¶
type FuncRpcServer func() *Server
type IRpcHandler ¶
type IRpcHandler interface { GetName() string InitRpcHandler(rpcHandler IRpcHandler, getClientFun FuncRpcClient, getServerFun FuncRpcServer) GetRpcHandler() IRpcHandler PushRequest(callinfo *RpcRequest) error HandlerRpcRequest(request *RpcRequest) HandlerRpcResponeCB(call *Call) GetRpcRequestChan() chan *RpcRequest GetRpcResponeChan() chan *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 }
type IRpcProcessor ¶
type IRpcProcessor interface { Marshal(v interface{}) ([]byte, error) //b表示自定义缓冲区,可以填nil,由系统自动分配 Unmarshal(data []byte, v interface{}) error MakeRpcRequest(seq uint64, serviceMethod string, noReply bool, inParam []byte) IRpcRequestData MakeRpcResponse(seq uint64, err *RpcError, reply []byte) IRpcResponseData ReleaseRpcRequest(rpcRequestData IRpcRequestData) ReleaseRpcRespose(rpcRequestData IRpcResponseData) }
type IRpcRequestData ¶
type IRpcResponseData ¶
type JsonProcessor ¶
type JsonProcessor struct { }
func (*JsonProcessor) MakeRpcRequest ¶
func (slf *JsonProcessor) MakeRpcRequest(seq uint64, serviceMethod string, noReply bool, inParam []byte) IRpcRequestData
func (*JsonProcessor) MakeRpcResponse ¶
func (slf *JsonProcessor) MakeRpcResponse(seq uint64, err *RpcError, reply []byte) IRpcResponseData
func (*JsonProcessor) Marshal ¶
func (slf *JsonProcessor) Marshal(v interface{}) ([]byte, error)
func (*JsonProcessor) ReleaseRpcRequest ¶
func (slf *JsonProcessor) ReleaseRpcRequest(rpcRequestData IRpcRequestData)
func (*JsonProcessor) ReleaseRpcRespose ¶
func (slf *JsonProcessor) ReleaseRpcRespose(rpcRequestData IRpcResponseData)
func (*JsonProcessor) Unmarshal ¶
func (slf *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 }
func (*JsonRpcRequestData) GetInParam ¶
func (slf *JsonRpcRequestData) GetInParam() []byte
func (*JsonRpcRequestData) GetSeq ¶
func (slf *JsonRpcRequestData) GetSeq() uint64
func (*JsonRpcRequestData) GetServiceMethod ¶
func (slf *JsonRpcRequestData) GetServiceMethod() string
func (*JsonRpcRequestData) IsNoReply ¶
func (slf *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 (slf *JsonRpcResponseData) GetErr() *RpcError
func (*JsonRpcResponseData) GetReply ¶
func (slf *JsonRpcResponseData) GetReply() []byte
func (*JsonRpcResponseData) GetSeq ¶
func (slf *JsonRpcResponseData) GetSeq() uint64
type PBProcessor ¶
type PBProcessor struct { }
func (*PBProcessor) MakeRpcRequest ¶
func (slf *PBProcessor) MakeRpcRequest(seq uint64, serviceMethod string, noReply bool, inParam []byte) IRpcRequestData
func (*PBProcessor) MakeRpcResponse ¶
func (slf *PBProcessor) MakeRpcResponse(seq uint64, err *RpcError, reply []byte) IRpcResponseData
func (*PBProcessor) Marshal ¶
func (slf *PBProcessor) Marshal(v interface{}) ([]byte, error)
func (*PBProcessor) ReleaseRpcRequest ¶
func (slf *PBProcessor) ReleaseRpcRequest(rpcRequestData IRpcRequestData)
func (*PBProcessor) ReleaseRpcRespose ¶
func (slf *PBProcessor) ReleaseRpcRespose(rpcRequestData IRpcResponseData)
func (*PBProcessor) Unmarshal ¶
func (slf *PBProcessor) Unmarshal(data []byte, msg interface{}) error
type PBRpcRequestData ¶
type PBRpcRequestData struct { Seq *uint64 `protobuf:"varint,1,opt,name=Seq" json:"Seq,omitempty"` ServiceMethod *string `protobuf:"bytes,2,opt,name=ServiceMethod" json:"ServiceMethod,omitempty"` NoReply *bool `protobuf:"varint,3,opt,name=NoReply" json:"NoReply,omitempty"` InParam []byte `protobuf:"bytes,4,opt,name=InParam" json:"InParam,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` }
func (*PBRpcRequestData) Descriptor ¶
func (*PBRpcRequestData) Descriptor() ([]byte, []int)
func (*PBRpcRequestData) GetInParam ¶
func (m *PBRpcRequestData) GetInParam() []byte
func (*PBRpcRequestData) GetNoReply ¶
func (m *PBRpcRequestData) GetNoReply() bool
func (*PBRpcRequestData) GetSeq ¶
func (m *PBRpcRequestData) GetSeq() uint64
func (*PBRpcRequestData) GetServiceMethod ¶
func (m *PBRpcRequestData) GetServiceMethod() string
func (*PBRpcRequestData) IsNoReply ¶
func (slf *PBRpcRequestData) IsNoReply() bool
func (*PBRpcRequestData) MakeRequest ¶
func (slf *PBRpcRequestData) MakeRequest(seq uint64, serviceMethod string, noReply bool, inParam []byte) *PBRpcRequestData
func (*PBRpcRequestData) ProtoMessage ¶
func (*PBRpcRequestData) ProtoMessage()
func (*PBRpcRequestData) Reset ¶
func (m *PBRpcRequestData) Reset()
func (*PBRpcRequestData) String ¶
func (m *PBRpcRequestData) String() string
func (*PBRpcRequestData) XXX_DiscardUnknown ¶
func (m *PBRpcRequestData) XXX_DiscardUnknown()
func (*PBRpcRequestData) XXX_Marshal ¶
func (m *PBRpcRequestData) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
func (*PBRpcRequestData) XXX_Merge ¶
func (m *PBRpcRequestData) XXX_Merge(src proto.Message)
func (*PBRpcRequestData) XXX_Size ¶
func (m *PBRpcRequestData) XXX_Size() int
func (*PBRpcRequestData) XXX_Unmarshal ¶
func (m *PBRpcRequestData) XXX_Unmarshal(b []byte) error
type PBRpcResponseData ¶
type PBRpcResponseData struct { Seq *uint64 `protobuf:"varint,1,opt,name=Seq" json:"Seq,omitempty"` Error *string `protobuf:"bytes,2,opt,name=Error" json:"Error,omitempty"` Reply []byte `protobuf:"bytes,3,opt,name=Reply" json:"Reply,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` }
func (*PBRpcResponseData) Descriptor ¶
func (*PBRpcResponseData) Descriptor() ([]byte, []int)
func (*PBRpcResponseData) GetErr ¶
func (slf *PBRpcResponseData) GetErr() *RpcError
func (*PBRpcResponseData) GetError ¶
func (m *PBRpcResponseData) GetError() string
func (*PBRpcResponseData) GetReply ¶
func (m *PBRpcResponseData) GetReply() []byte
func (*PBRpcResponseData) GetSeq ¶
func (m *PBRpcResponseData) GetSeq() uint64
func (*PBRpcResponseData) MakeRespone ¶
func (slf *PBRpcResponseData) MakeRespone(seq uint64, err *RpcError, reply []byte) *PBRpcResponseData
func (*PBRpcResponseData) ProtoMessage ¶
func (*PBRpcResponseData) ProtoMessage()
func (*PBRpcResponseData) Reset ¶
func (m *PBRpcResponseData) Reset()
func (*PBRpcResponseData) String ¶
func (m *PBRpcResponseData) String() string
func (*PBRpcResponseData) XXX_DiscardUnknown ¶
func (m *PBRpcResponseData) XXX_DiscardUnknown()
func (*PBRpcResponseData) XXX_Marshal ¶
func (m *PBRpcResponseData) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
func (*PBRpcResponseData) XXX_Merge ¶
func (m *PBRpcResponseData) XXX_Merge(src proto.Message)
func (*PBRpcResponseData) XXX_Size ¶
func (m *PBRpcResponseData) XXX_Size() int
func (*PBRpcResponseData) XXX_Unmarshal ¶
func (m *PBRpcResponseData) XXX_Unmarshal(b []byte) error
type RequestHandler ¶
type RequestHandler func(Returns interface{}, Err *RpcError)
type RpcAgent ¶
type RpcAgent struct {
// contains filtered or unexported fields
}
func (*RpcAgent) RemoteAddr ¶
type RpcHandleFinder ¶
type RpcHandleFinder interface {
FindRpcHandler(serviceMethod string) IRpcHandler
}
type RpcHandler ¶
type RpcHandler struct {
// contains filtered or unexported fields
}
func (*RpcHandler) AsyncCall ¶
func (slf *RpcHandler) AsyncCall(serviceMethod string, args interface{}, callback interface{}) error
func (slf *RpcHandler) asyncCallRpc(serviceMethod string,mutiCoroutine bool,callback interface{},args ...interface{}) error { func (slf *RpcHandler) callRpc(serviceMethod string,reply interface{},mutiCoroutine bool,args ...interface{}) error { func (slf *RpcHandler) goRpc(serviceMethod string,mutiCoroutine bool,args ...interface{}) error { (reply *int,err error) {}
func (*RpcHandler) AsyncCallNode ¶
func (slf *RpcHandler) AsyncCallNode(nodeId int, serviceMethod string, args interface{}, callback interface{}) error
func (*RpcHandler) Call ¶
func (slf *RpcHandler) Call(serviceMethod string, args interface{}, reply interface{}) error
func (*RpcHandler) CallMethod ¶
func (slf *RpcHandler) CallMethod(ServiceMethod string, param interface{}, reply interface{}) error
func (*RpcHandler) CallNode ¶
func (slf *RpcHandler) CallNode(nodeId int, serviceMethod string, args interface{}, reply interface{}) error
func (*RpcHandler) CastGo ¶
func (slf *RpcHandler) CastGo(serviceMethod string, args interface{})
func (*RpcHandler) GetName ¶
func (slf *RpcHandler) GetName() string
func (*RpcHandler) GetRpcHandler ¶
func (slf *RpcHandler) GetRpcHandler() IRpcHandler
func (*RpcHandler) GetRpcRequestChan ¶
func (slf *RpcHandler) GetRpcRequestChan() chan *RpcRequest
func (*RpcHandler) GetRpcResponeChan ¶
func (slf *RpcHandler) GetRpcResponeChan() chan *Call
func (*RpcHandler) Go ¶
func (slf *RpcHandler) Go(serviceMethod string, args interface{}) error
func (*RpcHandler) GoNode ¶
func (slf *RpcHandler) GoNode(nodeId int, serviceMethod string, args interface{}) error
func (*RpcHandler) HandlerRpcRequest ¶
func (slf *RpcHandler) HandlerRpcRequest(request *RpcRequest)
func (*RpcHandler) HandlerRpcResponeCB ¶
func (slf *RpcHandler) HandlerRpcResponeCB(call *Call)
func (*RpcHandler) InitRpcHandler ¶
func (slf *RpcHandler) InitRpcHandler(rpcHandler IRpcHandler, getClientFun FuncRpcClient, getServerFun FuncRpcServer)
func (*RpcHandler) PushRequest ¶
func (slf *RpcHandler) PushRequest(req *RpcRequest) error
func (*RpcHandler) RegisterRpc ¶
func (slf *RpcHandler) RegisterRpc(rpcHandler IRpcHandler) error
type RpcMethodInfo ¶
type RpcMethodInfo struct {
// contains filtered or unexported fields
}
type RpcRequest ¶
type RpcRequest struct { RpcRequestData IRpcRequestData // contains filtered or unexported fields }
func MakeRpcRequest ¶
func MakeRpcRequest() *RpcRequest
func (*RpcRequest) Clear ¶
func (slf *RpcRequest) Clear() *RpcRequest
type RpcResponse ¶
type RpcResponse struct {
RpcResponeData IRpcResponseData
}
func MakeRpcResponse ¶
func MakeRpcResponse() *RpcResponse
func (*RpcResponse) Clear ¶
func (slf *RpcResponse) Clear() *RpcResponse
Click to show internal directories.
Click to hide internal directories.