Documentation
¶
Index ¶
- Constants
- func AddDynamicModules(mods ...IModule) error
- func DynamicModules() []string
- func GetChanRPC(name string) *chanrpc.Server
- func GetState() int32
- func Register(mods ...IModule) error
- func RemoveDynamicModule(name string) bool
- func Run(mods ...IModule)
- func Stats() string
- type IModule
- type IRPC
- type ITimer
- type Skeleton
- func (s *Skeleton) AccTimer(id int64, kind timermgr.AccKind, value int64) error
- func (s *Skeleton) AsyncCall(mod string, req any, cb chanrpc.Callback) error
- func (s *Skeleton) Call(mod string, req any) *chanrpc.RetInfo
- func (s *Skeleton) CancelTimer(id int64)
- func (s *Skeleton) Cast(mod string, req any)
- func (s *Skeleton) ChanRPC() *chanrpc.Server
- func (s *Skeleton) DelayTimer(id int64, kind timermgr.AccKind, value int64) (err error)
- func (s *Skeleton) Name() string
- func (s *Skeleton) NewTicker(id int64, duraMs int64, kind string, metadata map[string]string) int64
- func (s *Skeleton) NewTimer(duraMs int64, kind string, metadata map[string]string) int64
- func (s *Skeleton) OnStart(ctx context.Context)
- func (s *Skeleton) RegisterChanRPC(msg any, f chanrpc.Handler) error
- func (s *Skeleton) RegisterTimer(kind string, handler timermgr.TimerHandler)
Constants ¶
View Source
const ( AppStateNone = iota // 未开始或已停止 AppStateInit // 正在初始化中 AppStateRun // 正在运行中 AppStateStop // 正在停止中 )
节点全局状态
Variables ¶
This section is empty.
Functions ¶
func AddDynamicModules ¶
AddDynamicModules 默认单实例, 添加动态模块
func RemoveDynamicModule ¶
RemoveDynamicModule 默认单实例, 删除动一个动态模块
Types ¶
type IModule ¶
type IModule interface {
Name() string // 名称
Priority() uint // 模块优先级, 值越小优先级越高
OnInit() error // 初始化
OnStart(ctx context.Context) // 启动, 阻塞
OnDestroy() // 销毁
ChanRPC() *chanrpc.Server // 消息通道
}
IModule 模块接口
type ITimer ¶
type ITimer interface {
RegisterTimer(kind string, handler timermgr.TimerHandler)
NewTimer(duraMs int64, kind string, metadata map[string]string) int64
NewTicker(duraMs int64, kind string, metadata map[string]string) int64
AccTimer(id int64, kind timermgr.AccKind, value int64) error
DelayTimer(id int64, kind timermgr.AccKind, value int64) (err error)
CancelTimer(id int64)
}
type Skeleton ¶
type Skeleton struct {
// contains filtered or unexported fields
}
Skeleton 基础框架
func (*Skeleton) CancelTimer ¶
func (*Skeleton) DelayTimer ¶
func (*Skeleton) RegisterChanRPC ¶
func (*Skeleton) RegisterTimer ¶
func (s *Skeleton) RegisterTimer(kind string, handler timermgr.TimerHandler)
Click to show internal directories.
Click to hide internal directories.