rpc

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Mar 26, 2020 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrInvalidPeerSession = errors.New("rpc: Invalid peer type, require cellnet.RPCSessionGetter or cellnet.Session")
	ErrEmptySession       = errors.New("rpc: Empty session")
)
View Source
var ErrTimeout = errors.New("RPC time out")

Functions

func Call

func Call(sesOrPeer interface{}, reqMsg interface{}, timeout time.Duration, userCallback func(raw interface{}))

ud: peer/session, reqMsg:请求用的消息, userCallback: 返回消息类型回调 func( ackMsg *ackMsgType)

func CallSync

func CallSync(ud interface{}, reqMsg interface{}, timeout time.Duration) (interface{}, error)

发出请求, 接收到服务器返回后才返回, ud: peer/session, reqMsg:请求用的消息, 返回消息为返回值

func ResolveInboundEvent

func ResolveInboundEvent(inputEvent cellnet.Event) (ouputEvent cellnet.Event, handled bool)

func ResolveOutboundEvent

func ResolveOutboundEvent(inputEvent cellnet.Event) (handled bool)

Types

type RPCSessionGetter

type RPCSessionGetter interface {
	RPCSession() cellnet.Session
}

type RecvMsgEvent

type RecvMsgEvent struct {
	Msg interface{}
	// contains filtered or unexported fields
}

func (*RecvMsgEvent) Message

func (self *RecvMsgEvent) Message() interface{}

func (*RecvMsgEvent) Queue

func (self *RecvMsgEvent) Queue() cellnet.EventQueue

func (*RecvMsgEvent) Reply

func (self *RecvMsgEvent) Reply(msg interface{})

func (*RecvMsgEvent) Session

func (self *RecvMsgEvent) Session() cellnet.Session

type RemoteCallACK

type RemoteCallACK struct {
	MsgID  uint16
	Data   []byte
	CallID int64
}

func (*RemoteCallACK) GetCallID

func (self *RemoteCallACK) GetCallID() int64

func (*RemoteCallACK) GetMsgData

func (self *RemoteCallACK) GetMsgData() []byte

func (*RemoteCallACK) GetMsgID

func (self *RemoteCallACK) GetMsgID() uint16

func (*RemoteCallACK) String

func (self *RemoteCallACK) String() string

type RemoteCallMsg

type RemoteCallMsg interface {
	GetMsgID() uint16
	GetMsgData() []byte
	GetCallID() int64
}

type RemoteCallREQ

type RemoteCallREQ struct {
	MsgID  uint16
	Data   []byte
	CallID int64
}

func (*RemoteCallREQ) GetCallID

func (self *RemoteCallREQ) GetCallID() int64

func (*RemoteCallREQ) GetMsgData

func (self *RemoteCallREQ) GetMsgData() []byte

func (*RemoteCallREQ) GetMsgID

func (self *RemoteCallREQ) GetMsgID() uint16

func (*RemoteCallREQ) String

func (self *RemoteCallREQ) String() string

Jump to

Keyboard shortcuts

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