ymdQuickRestart

package
v0.0.0-...-44683c2 Latest Latest
Warning

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

Go to latest
Published: Aug 14, 2024 License: MIT Imports: 6 Imported by: 3

Documentation

Index

Constants

View Source
const (
	MTLogicKick    = `MTLogicKick`    // GatewayIn: logic踢session
	MTLogicWrite   = `MTLogicWrite`   // GatewayIn: logic向session写数据
	MTGatewayNew   = `MTGatewayNew`   // LogicIn:   gateway接收到了一条新链接
	MTGatewayRead  = `MTGatewayRead`  // LogicIn:   gateway从已有的链接上读取到了一条消息
	MTGatewayClose = `MTGatewayClose` // LogicIn:   gateway关闭了一套链接
	MTTimeout      = `MTTimeout`      // 无: 每秒钟LogicService.GetMessageChan会被自动放一条该消息, 方便处理逻辑
)

Variables

This section is empty.

Functions

This section is empty.

Types

type GatewayConnInfo

type GatewayConnInfo struct {
	SessionId   string `json:",omitempty"`
	ConnectTime string `json:",omitempty"`
	ClientIp    string `json:",omitempty"`
}

type GatewayService

type GatewayService struct {
	// contains filtered or unexported fields
}

func NewGatewayService

func NewGatewayService(req RedisInfo) *GatewayService

func (*GatewayService) KickSession

func (this *GatewayService) KickSession(sessionId string)

func (*GatewayService) NewSession

func (this *GatewayService) NewSession(runner GatewaySessionRunner)

func (*GatewayService) WriteSession

func (this *GatewayService) WriteSession(sessionId string, msg RedisExchange)

type GatewaySessionRunner

type GatewaySessionRunner interface {
	WriteToClient(msg []byte) (err error)    // 多次调用
	ReadFromClient() (msg []byte, err error) // 多次调用
	CloseClient() (err error)                // 单次调用
}

type LogicService

type LogicService struct {
	// contains filtered or unexported fields
}

func NewLogicService

func NewLogicService(req RedisInfo) *LogicService

func (*LogicService) Close

func (this *LogicService) Close()

func (*LogicService) GetMemoryState

func (this *LogicService) GetMemoryState() (value string)

func (*LogicService) GetMessageChan

func (this *LogicService) GetMessageChan() <-chan RedisExchange

func (*LogicService) KickSession

func (this *LogicService) KickSession(sessionId string)

func (*LogicService) SetMemoryState

func (this *LogicService) SetMemoryState(value string)

func (*LogicService) WriteSession

func (this *LogicService) WriteSession(sessionId string, msgData []byte)

type RedisExchange

type RedisExchange struct {
	SessionId string `json:",omitempty"`
	MsgType   string `json:",omitempty"`
	MsgData   []byte `json:",omitempty"`
}

type RedisInfo

type RedisInfo struct {
	RedisAddr string
	Prefix    string
}

func (*RedisInfo) GatewayIn

func (this *RedisInfo) GatewayIn() string

list, 发给gateway的消息列表

func (*RedisInfo) GatewaySession

func (this *RedisInfo) GatewaySession() string

hash, gateway上的所有链接的 [sessionId, 创建时间]

func (*RedisInfo) LogicIn

func (this *RedisInfo) LogicIn() string

list, 发给logic的消息列表

func (*RedisInfo) MemoryState

func (this *RedisInfo) MemoryState() string

kv, logic的内存状态,logic启动的时候加载, 退出的时候保存

Jump to

Keyboard shortcuts

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