module

package
v0.0.0-...-37d5b15 Latest Latest
Warning

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

Go to latest
Published: Mar 22, 2023 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MOUDLE_ID_NULL = iota
	MOUDLE_ID_GAME
	MOUDLE_ID_USER
	MODULE_ID_DISPATCH
	MODULE_ID_AGENT
	MODULE_ID_MQTT
)
View Source
const (
	MODULE_STATE_INIT = iota
	MODULE_STATE_INIT_ERR
	MODULE_STATE_RUNNING
	MODULE_STATE_CRASH
	MODULE_STATE_CLOSE

	MODULE_STATE_END
)
View Source
const (
	MSG_TYPE_PING = iota
)

Variables

View Source
var ModStateMap = []string{
	"init",
	"init_error",
	"running",
	"crash",
	"closed",
	"end",
}

module 状态映射值,只读不写

View Source
var Modules sync.Map

Functions

func MsgSend

func MsgSend(dest uint32, msg interface{}) bool

func Register

func Register(name string, mid uint32, mi Module, buflen uint32) bool

func Startup

func Startup()

Types

type GameMsg

type GameMsg struct {
	Id  uint32
	Tid uint32
}

type Mbody

type Mbody struct {
	Id  uint32 `json:"id"`
	Tid uint32 `json:"tid"`
	Bd  string `json:"body"`
}

type Mhead

type Mhead struct {
	Op  uint16 `json:"operator"`
	Len int    `json:"len"`
}

type Mod

type Mod struct {

	/*消息队列*/
	BufLen uint32
	Que    chan interface{}

	Id   uint32
	Name string
	Stat int
	// contains filtered or unexported fields
}

func QueryMbyID

func QueryMbyID(mid uint32) (*Mod, bool)

type Module

type Module interface {
	OnInit()
	OnDestroy()
	MsgProc(closeSig chan bool, message interface{})
}

type Msg

type Msg struct {
	// T string `json:"proto"`
	H Mhead
	B Mbody
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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