module

package
Version: v0.0.0-...-f89c2ae Latest Latest
Warning

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

Go to latest
Published: Apr 26, 2021 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Destroy

func Destroy()

func Reload

func Reload(actionMds map[Action][]Module)

func StaticLoad

func StaticLoad(mis []Module)

静态加载,按严格的顺序加载模块

Types

type Action

type Action int

当程序调用Reload时,leaf重新获取当前需要激活的mod,根据Action执行对应的操作

const (
	Nothing Action = iota
	New
	Update
	Delete
)

type Module

type Module interface {
	Name() string
	Version() string //用于热加载,标示module配置是否修改,可以用一些关键的配置hash
	OnInit()
	OnDestroy()
	Run(closeSig chan struct{})
	RPCServer() *chanrpc.Server //如果module可以接受外来的指令,则必须有一个chanrpc server,否则返回nil即可
}

type Skeleton

type Skeleton struct {
	GoLen              int //回调缓冲区长度限制
	TimerDispatcherLen int //定时器缓冲区长度限制
	AsyncCallLen       int //异步调用结果缓冲区长度限制
	ChanRPCServer      *chanrpc.Server
	// contains filtered or unexported fields
}

func (*Skeleton) AfterFunc

func (s *Skeleton) AfterFunc(d time.Duration, cb func()) *timer.Timer

func (*Skeleton) AsyncCall

func (s *Skeleton) AsyncCall(server *chanrpc.Server, id interface{}, args ...interface{})

func (*Skeleton) CronFunc

func (s *Skeleton) CronFunc(cronExpr *timer.CronExpr, cb func()) *timer.Cron

func (*Skeleton) Go

func (s *Skeleton) Go(f func(), cb func())

func (*Skeleton) Init

func (s *Skeleton) Init()

func (*Skeleton) NewLinearContext

func (s *Skeleton) NewLinearContext() *g.LinearContext

func (*Skeleton) RegisterChanRPC

func (s *Skeleton) RegisterChanRPC(id interface{}, f interface{})

func (*Skeleton) RegisterCommand

func (s *Skeleton) RegisterCommand(name string, help string, f interface{})

func (*Skeleton) Run

func (s *Skeleton) Run(closeSig chan struct{})

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto
y or Y : Canonical URL