Documentation ¶
Index ¶
- Constants
- Variables
- func MakeRequestData(msg proto.Message, seqID int32, senderID int32) []byte
- func MakeResponseData(msg proto.Message, seqID int32, senderID int32) []byte
- func MakeServer2ServerData(msg proto.Message, senderID int32) []byte
- func MakeServer2SessionData(msg proto.Message, sesID int32, senderID int32) []byte
- func MakeSession2ServerData(msg proto.Message, sesID int32, senderID int32) []byte
- type Call
- type Client
- func (p *Client) Answer(serverTopic string, seqid int32, msg proto.Message)
- func (p *Client) Call(serverTopic string, req proto.Message, resp proto.Message) error
- func (p *Client) Close() (err error)
- func (p *Client) ReadLoop() error
- func (p *Client) RegisterSend2Session(send2Session func(sesID int32, msgID uint32, data []byte))
- func (p *Client) Request(serverTopic string, msg proto.Message, cb interface{}) error
- func (p *Client) RouteGate(gateTopic string, sesID int32, msg proto.Message)
- func (p *Client) RouteSession2Server(topic string, sesID int32, msg proto.Message)
- func (p *Client) Run()
- func (p *Client) SendMsg(serverTopic string, msg proto.Message)
- type GateSessionID
- type Processor
- func (p *Processor) GetCallWithDel(seqID int32) (*Call, bool)
- func (p *Processor) HandleMsg(server Server, msgID uint32, data []byte) error
- func (p *Processor) HandleRequest(server RequestServer, msgID uint32, data []byte) error
- func (p *Processor) HandleResponse(seqID int32, data []byte) error
- func (p *Processor) HandleSessionMsg(session Session, msgID uint32, data []byte) error
- func (p *Processor) NewSeqID() int32
- func (p *Processor) RegisterCall(resp proto.Message, onRecv func(error)) *Call
- func (p *Processor) RegisterRequestMsgHandler(msg proto.Message, f RequestHandler)
- func (p *Processor) RegisterServerMsgHandler(msg proto.Message, f ServerMsgHandler)
- func (p *Processor) RegisterSessionMsgHandler(msg proto.Message, f SessionMsgHandler)
- type RPC
- func (p *RPC) Close()
- func (p *RPC) GetServerById(serverID int32) Server
- func (p *RPC) GetServerByType(serverType ServerType) Server
- func (p *RPC) RegisterRequestMsgHandler(cb interface{})
- func (p *RPC) RegisterSend2Session(send2Session func(sesID int32, msgID uint32, data []byte))
- func (p *RPC) RegisterServerMsgHandler(cb interface{})
- func (p *RPC) RegisterSessionMsgHandler(cb interface{})
- func (p *RPC) Run()
- func (p *RPC) Session(gateID, sesID int32) Session
- type RequestHandler
- type RequestInfo
- type RequestServer
- type Server
- type ServerMsgHandler
- type ServerMsgInfo
- type ServerType
- type Session
- type SessionMsgHandler
- type SessionMsgInfo
Constants ¶
View Source
const CALL_TIMEOUT = 10 * time.Second
Variables ¶
View Source
var ErrNoKnow = errors.New("rpc: unknow")
View Source
var ErrTimeOut = errors.New("rpc: timeout")
Functions ¶
func MakeResponseData ¶
func MakeServer2SessionData ¶
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
func (*Client) RegisterSend2Session ¶
func (*Client) RouteSession2Server ¶
type GateSessionID ¶
type Processor ¶
type Processor struct {
// contains filtered or unexported fields
}
func NewProcessor ¶
func NewProcessor() *Processor
func (*Processor) HandleRequest ¶
func (p *Processor) HandleRequest(server RequestServer, msgID uint32, data []byte) error
func (*Processor) HandleResponse ¶
func (*Processor) HandleSessionMsg ¶
func (*Processor) RegisterCall ¶
func (*Processor) RegisterRequestMsgHandler ¶
func (p *Processor) RegisterRequestMsgHandler(msg proto.Message, f RequestHandler)
func (*Processor) RegisterServerMsgHandler ¶
func (p *Processor) RegisterServerMsgHandler(msg proto.Message, f ServerMsgHandler)
func (*Processor) RegisterSessionMsgHandler ¶
func (p *Processor) RegisterSessionMsgHandler(msg proto.Message, f SessionMsgHandler)
type RPC ¶
func (*RPC) GetServerById ¶
func (*RPC) RegisterRequestMsgHandler ¶
func (p *RPC) RegisterRequestMsgHandler(cb interface{})
func (*RPC) RegisterSend2Session ¶
func (*RPC) RegisterServerMsgHandler ¶
func (p *RPC) RegisterServerMsgHandler(cb interface{})
func (*RPC) RegisterSessionMsgHandler ¶
func (p *RPC) RegisterSessionMsgHandler(cb interface{})
type RequestHandler ¶
type RequestHandler func(RequestServer, proto.Message)
type RequestInfo ¶
type RequestInfo struct {
// contains filtered or unexported fields
}
type RequestServer ¶
func NewRequestServer ¶
func NewRequestServer(client *Client, serverid int32, seqid int32) RequestServer
type Server ¶
type ServerMsgHandler ¶
type ServerMsgInfo ¶
type ServerMsgInfo struct {
// contains filtered or unexported fields
}
type Session ¶
type Session interface { SendMsg(msg proto.Message) SendRawMsg(msgID uint16, data []byte) GateSessionID() GateSessionID }
type SessionMsgHandler ¶
type SessionMsgInfo ¶
type SessionMsgInfo struct {
// contains filtered or unexported fields
}
Click to show internal directories.
Click to hide internal directories.