process

package
v0.1.3 Latest Latest
Warning

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

Go to latest
Published: Aug 5, 2020 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package process 是一个 micserver 中的单例,用于获取该进程中存在的所有 App 以及 Module, 以便实现例如 roc catch 的优化,有一些数据不必每个 Module 都持有一份。

Package process 处于同一个进程中的 module ,可以使用 chan 进行通信,不必利用 TCP 中转, 通过 process , Module 可以知道自己的连接目标是否是本进程的,如果是本进程的即可 使用 process 包获取到对方的消息通信 chan ,通过 chan 连接对端。

Package process 所有注册于本进程的 Module 都会维护在本单例中。

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddApp

func AddApp(app base.IApp)

AddApp 增加一个App

func AddModule

func AddModule(module base.IModule)

AddModule 增加一个本进程的 Module

func AddServerChan

func AddServerChan(id string, serverChan chan *ChanServerHandshake)

AddServerChan 增加一个模块的握手 chan

func DeleteServerChan

func DeleteServerChan(id string)

DeleteServerChan 删除一个模块的握手 chan

func GetApps

func GetApps() []base.IApp

GetApps 获取当前进程的 App 列表

func GetServerChan

func GetServerChan(id string) chan *ChanServerHandshake

GetServerChan 获取一个模块的握手 chan

func HasModule

func HasModule(moduleID string) bool

HasModule 判断目标 Module 是否在本进程中

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 。

Jump to

Keyboard shortcuts

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