Documentation ¶
Index ¶
- func AppCount() int
- func GetRuleX() typex.RuleX
- func LoadApp(app *Application, luaSource string) error
- func LoadAppLib(app *Application, e typex.RuleX)
- func RemoveApp(uuid string) error
- func StartApp(uuid string) error
- func Stop()
- func StopApp(uuid string) error
- func UpdateApp(app Application) error
- func ValidateLuaSyntax(bytes []byte) error
- type AppStackRuntime
- type AppState
- type Application
- type XAppStack
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func LoadAppLib ¶
func LoadAppLib(app *Application, e typex.RuleX)
* * 加载app库函数, 注意这里的库函数和规则引擎的并不是完全一样的,有一些差别 *
Types ¶
type AppStackRuntime ¶
type AppStackRuntime struct { RuleEngine typex.RuleX Applications map[string]*Application }
* * 管理器 *
func AppRuntime ¶
func AppRuntime() *AppStackRuntime
func InitAppStack ¶
func InitAppStack(re typex.RuleX) *AppStackRuntime
type Application ¶
type Application struct { UUID string `json:"uuid"` // 名称 Name string `json:"name"` // 名称 Version string `json:"version"` // 版本号 Description string `json:"description"` // 版本号 AutoStart bool `json:"autoStart"` // 自动启动 AppState AppState `json:"appState"` // 状态: 1 运行中, 0 停止 KilledBy string `json:"-"` // 被谁杀死的: RULEX|EXCEPT|NORMAL|"" // contains filtered or unexported fields }
* * 轻量级应用 *
func AllApp ¶
func AllApp() []*Application
func GetApp ¶
func GetApp(uuid string) *Application
func ListApp ¶
func ListApp() []*Application
func NewApplication ¶
func NewApplication(uuid, Name, Version string) *Application
func (*Application) GetMainFunc ¶
func (app *Application) GetMainFunc() *lua.LFunction
func (*Application) SetCnC ¶
func (app *Application) SetCnC(ctx context.Context, cancel context.CancelFunc)
func (*Application) SetMainFunc ¶
func (app *Application) SetMainFunc(f *lua.LFunction)
func (*Application) Stop ¶
func (app *Application) Stop()
* * 源码bug,没有等字节码执行结束就直接给释放stack了,问题处在state.go:1391, 已经给作者提了issue, * 如果1个月内不解决,准备自己fork一个过来维护. * Issue: https://github.com/hootrhino/gopher-lua/discussions/430
func (*Application) VM ¶
func (app *Application) VM() *lua.LState
type XAppStack ¶
type XAppStack interface { GetRuleX() typex.RuleX ListApp() []*Application // 把配置里的应用信息加载到内存里 LoadApp(app *Application) error GetApp(uuid string) *Application RemoveApp(uuid string) error UpdateApp(app Application) error // 启动一个停止的进程 StartApp(uuid string) error StopApp(uuid string) error Stop() }
* * APP Stack 管理器 *
Click to show internal directories.
Click to hide internal directories.