engine

package
v0.6.5 Latest Latest
Warning

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

Go to latest
Published: Dec 30, 2023 License: AGPL-3.0 Imports: 44 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func InitRuleEngine added in v0.6.3

func InitRuleEngine(config typex.RulexConfig) typex.RuleX

func LoadBuildInLuaLib

func LoadBuildInLuaLib(e typex.RuleX, r *typex.Rule)

* * 加载标准库, 为什么是每个LUA脚本都加载一次?主要是为了隔离,互不影响 *

func LoadExtLuaLib

func LoadExtLuaLib(e typex.RuleX, r *typex.Rule) error

* * 加载外部扩展库 *

func RunRulex

func RunRulex(iniPath string)

启动 Rulex

Types

type RuleEngine

type RuleEngine struct {
	Hooks             *sync.Map            `json:"hooks"`
	Rules             *sync.Map            `json:"rules"`
	Plugins           *sync.Map            `json:"plugins"`
	InEnds            *sync.Map            `json:"inends"`
	OutEnds           *sync.Map            `json:"outends"`
	Drivers           *sync.Map            `json:"drivers"`
	Devices           *sync.Map            `json:"devices"`
	Config            *typex.RulexConfig   `json:"config"`
	DeviceTypeManager typex.DeviceRegistry `json:"-"` // 待迁移组件
	SourceTypeManager typex.SourceRegistry `json:"-"` // 待迁移组件
	TargetTypeManager typex.TargetRegistry `json:"-"` // 待迁移组件
}

规则引擎

func (*RuleEngine) AllDevices

func (e *RuleEngine) AllDevices() *sync.Map

获取所有外挂设备

func (*RuleEngine) AllInEnd

func (e *RuleEngine) AllInEnd() *sync.Map

func (*RuleEngine) AllOutEnd

func (e *RuleEngine) AllOutEnd() *sync.Map

func (*RuleEngine) AllPlugins

func (e *RuleEngine) AllPlugins() *sync.Map

func (*RuleEngine) AllRule

func (e *RuleEngine) AllRule() *sync.Map

func (*RuleEngine) GetConfig

func (e *RuleEngine) GetConfig() *typex.RulexConfig

func (*RuleEngine) GetDevice

func (e *RuleEngine) GetDevice(id string) *typex.Device

获取设备

func (*RuleEngine) GetInEnd

func (e *RuleEngine) GetInEnd(uuid string) *typex.InEnd

func (*RuleEngine) GetOutEnd

func (e *RuleEngine) GetOutEnd(id string) *typex.OutEnd

func (*RuleEngine) GetPlugins

func (e *RuleEngine) GetPlugins() *sync.Map

func (*RuleEngine) GetRule

func (e *RuleEngine) GetRule(id string) *typex.Rule

GetRule a rule

func (*RuleEngine) InitDeviceTypeManager

func (e *RuleEngine) InitDeviceTypeManager() error

* * 初始化设备管理器 *

func (*RuleEngine) InitSourceTypeManager

func (e *RuleEngine) InitSourceTypeManager() error

* * 初始化输入资源管理器 *

func (*RuleEngine) InitTargetTypeManager

func (e *RuleEngine) InitTargetTypeManager() error

* * 初始化输出资源管理器 *

func (*RuleEngine) LoadBuiltInEnd

func (e *RuleEngine) LoadBuiltInEnd(in *typex.InEnd) error

* * 内建资源 *

func (*RuleEngine) LoadDeviceWithCtx added in v0.5.2

func (e *RuleEngine) LoadDeviceWithCtx(deviceInfo *typex.Device,
	ctx context.Context, cancelCTX context.CancelFunc) error

* * 加载设备 *

func (*RuleEngine) LoadHook

func (e *RuleEngine) LoadHook(h typex.XHook) error

LoadHook

func (*RuleEngine) LoadInEndWithCtx added in v0.5.2

func (e *RuleEngine) LoadInEndWithCtx(in *typex.InEnd,
	ctx context.Context, cancelCTX context.CancelFunc) error

* * 加载输入资源 *

func (*RuleEngine) LoadOutEndWithCtx added in v0.5.2

func (e *RuleEngine) LoadOutEndWithCtx(in *typex.OutEnd, ctx context.Context,
	cancelCTX context.CancelFunc) error

func (*RuleEngine) LoadPlugin

func (e *RuleEngine) LoadPlugin(sectionK string, p typex.XPlugin) error

┌──────┐ ┌──────┐ ┌──────┐ │ Init ├───►│ Load ├───►│ Stop │ └──────┘ └──────┘ └──────┘

func (*RuleEngine) LoadRule

func (e *RuleEngine) LoadRule(r *typex.Rule) error

LoadRule: 每个规则都绑定了资源(FromSource)或者设备(FromDevice) 使用MAP来记录RULE的绑定关系, KEY是UUID, Value是规则

func (*RuleEngine) LoadUserInEnd

func (e *RuleEngine) LoadUserInEnd(source typex.XSource, in *typex.InEnd) error

* * 加载用户资源 *

func (*RuleEngine) RemoveDevice

func (e *RuleEngine) RemoveDevice(uuid string)

删除设备

func (*RuleEngine) RemoveInEnd

func (e *RuleEngine) RemoveInEnd(id string)

func (*RuleEngine) RemoveOutEnd

func (e *RuleEngine) RemoveOutEnd(uuid string)

func (*RuleEngine) RemoveRule

func (e *RuleEngine) RemoveRule(ruleId string)

RemoveRule and inend--rule bindings

func (*RuleEngine) RestartDevice

func (e *RuleEngine) RestartDevice(uuid string) error

重启设备

func (*RuleEngine) RestartInEnd

func (e *RuleEngine) RestartInEnd(uuid string) error

重启源

func (*RuleEngine) RestartOutEnd

func (e *RuleEngine) RestartOutEnd(uuid string) error

重启目标

func (*RuleEngine) RunDeviceCallbacks

func (e *RuleEngine) RunDeviceCallbacks(Device *typex.Device, callbackArgs string)

* * 执行针对设备端的规则脚本 *

func (*RuleEngine) RunHooks

func (e *RuleEngine) RunHooks(data string)

RunHooks

func (*RuleEngine) RunSourceCallbacks

func (e *RuleEngine) RunSourceCallbacks(in *typex.InEnd, callbackArgs string)

* * 执行针对资源端的规则脚本 *

func (*RuleEngine) SaveDevice

func (e *RuleEngine) SaveDevice(dev *typex.Device)

保存设备

func (*RuleEngine) SaveInEnd

func (e *RuleEngine) SaveInEnd(in *typex.InEnd)

func (*RuleEngine) SaveOutEnd

func (e *RuleEngine) SaveOutEnd(out *typex.OutEnd)

func (*RuleEngine) SaveRule

func (e *RuleEngine) SaveRule(r *typex.Rule)

func (*RuleEngine) SnapshotDump

func (e *RuleEngine) SnapshotDump() string

----------------------------------------------------------------- 获取运行时快照 -----------------------------------------------------------------

func (*RuleEngine) Start

func (e *RuleEngine) Start() *typex.RulexConfig

* * Engine Start *

func (*RuleEngine) Stop

func (e *RuleEngine) Stop()

Stop

func (*RuleEngine) Version

func (e *RuleEngine) Version() typex.VersionInfo

func (*RuleEngine) WorkDevice

func (e *RuleEngine) WorkDevice(Device *typex.Device, data string) (bool, error)

核心功能: Work, 主要就是推流进队列

func (*RuleEngine) WorkInEnd

func (e *RuleEngine) WorkInEnd(in *typex.InEnd, data string) (bool, error)

核心功能: Work, 主要就是推流进队列

Jump to

Keyboard shortcuts

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