Documentation
¶
Overview ¶
Package process 是一个 micserver 中的单例,用于获取该进程中存在的所有 App 以及 Module, 以便实现例如 roc catch 的优化,有一些数据不必每个 Module 都持有一份。
Package process 处于同一个进程中的 module ,可以使用 chan 进行通信,不必利用 TCP 中转, 通过 process , Module 可以知道自己的连接目标是否是本进程的,如果是本进程的即可 使用 process 包获取到对方的消息通信 chan ,通过 chan 连接对端。
Package process 所有注册于本进程的 Module 都会维护在本单例中。
Index ¶
- func AddApp(app base.IApp)
- func AddModule(module base.IModule)
- func AddServerChan(id string, serverChan chan *ChanServerHandshake)
- func DeleteServerChan(id string)
- func GetApps() []base.IApp
- func GetServerChan(id string) chan *ChanServerHandshake
- func HasModule(moduleID string) bool
- type ChanServerHandshake
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AddServerChan ¶
func AddServerChan(id string, serverChan chan *ChanServerHandshake)
AddServerChan 增加一个模块的握手 chan
func GetServerChan ¶
func GetServerChan(id string) chan *ChanServerHandshake
GetServerChan 获取一个模块的握手 chan
Types ¶
type ChanServerHandshake ¶
type ChanServerHandshake struct { ModuleInfo *servercomm.ModuleInfo ClientMsgChan chan *msg.MessageBinary ServerMsgChan chan *msg.MessageBinary Seq int }
ChanServerHandshake chan 连接握手协议, Module 之间如果想要使用 chan 通信,则先需要通过一个握手 chan 进行握手,交换双方的消息接收发送 chan 。
Click to show internal directories.
Click to hide internal directories.