Documentation ¶
Index ¶
- func InitRuleEngine(config typex.RulexConfig) typex.RuleX
- func LoadBuildInLuaLib(e typex.RuleX, r *typex.Rule)
- func LoadExtLuaLib(e typex.RuleX, r *typex.Rule) error
- func RunRulex(iniPath string)
- type RuleEngine
- func (e *RuleEngine) AllDevices() *sync.Map
- func (e *RuleEngine) AllInEnd() *sync.Map
- func (e *RuleEngine) AllOutEnd() *sync.Map
- func (e *RuleEngine) AllPlugins() *sync.Map
- func (e *RuleEngine) AllRule() *sync.Map
- func (e *RuleEngine) GetConfig() *typex.RulexConfig
- func (e *RuleEngine) GetDevice(id string) *typex.Device
- func (e *RuleEngine) GetInEnd(uuid string) *typex.InEnd
- func (e *RuleEngine) GetOutEnd(id string) *typex.OutEnd
- func (e *RuleEngine) GetPlugins() *sync.Map
- func (e *RuleEngine) GetRule(id string) *typex.Rule
- func (e *RuleEngine) InitDeviceTypeManager() error
- func (e *RuleEngine) InitSourceTypeManager() error
- func (e *RuleEngine) InitTargetTypeManager() error
- func (e *RuleEngine) LoadBuiltInEnd(in *typex.InEnd) error
- func (e *RuleEngine) LoadDeviceWithCtx(deviceInfo *typex.Device, ctx context.Context, cancelCTX context.CancelFunc) error
- func (e *RuleEngine) LoadHook(h typex.XHook) error
- func (e *RuleEngine) LoadInEndWithCtx(in *typex.InEnd, ctx context.Context, cancelCTX context.CancelFunc) error
- func (e *RuleEngine) LoadOutEndWithCtx(in *typex.OutEnd, ctx context.Context, cancelCTX context.CancelFunc) error
- func (e *RuleEngine) LoadPlugin(sectionK string, p typex.XPlugin) error
- func (e *RuleEngine) LoadRule(r *typex.Rule) error
- func (e *RuleEngine) LoadUserInEnd(source typex.XSource, in *typex.InEnd) error
- func (e *RuleEngine) RemoveDevice(uuid string)
- func (e *RuleEngine) RemoveInEnd(id string)
- func (e *RuleEngine) RemoveOutEnd(uuid string)
- func (e *RuleEngine) RemoveRule(ruleId string)
- func (e *RuleEngine) RestartDevice(uuid string) error
- func (e *RuleEngine) RestartInEnd(uuid string) error
- func (e *RuleEngine) RestartOutEnd(uuid string) error
- func (e *RuleEngine) RunDeviceCallbacks(Device *typex.Device, callbackArgs string)
- func (e *RuleEngine) RunHooks(data string)
- func (e *RuleEngine) RunSourceCallbacks(in *typex.InEnd, callbackArgs string)
- func (e *RuleEngine) SaveDevice(dev *typex.Device)
- func (e *RuleEngine) SaveInEnd(in *typex.InEnd)
- func (e *RuleEngine) SaveOutEnd(out *typex.OutEnd)
- func (e *RuleEngine) SaveRule(r *typex.Rule)
- func (e *RuleEngine) SnapshotDump() string
- func (e *RuleEngine) Start() *typex.RulexConfig
- func (e *RuleEngine) Stop()
- func (e *RuleEngine) Version() typex.VersionInfo
- func (e *RuleEngine) WorkDevice(Device *typex.Device, data string) (bool, error)
- func (e *RuleEngine) WorkInEnd(in *typex.InEnd, data string) (bool, error)
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 ¶
* * 加载标准库, 为什么是每个LUA脚本都加载一次?主要是为了隔离,互不影响 *
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) 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) GetPlugins ¶
func (e *RuleEngine) GetPlugins() *sync.Map
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) 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 (*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) RunDeviceCallbacks ¶
func (e *RuleEngine) RunDeviceCallbacks(Device *typex.Device, callbackArgs string)
* * 执行针对设备端的规则脚本 *
func (*RuleEngine) RunSourceCallbacks ¶
func (e *RuleEngine) RunSourceCallbacks(in *typex.InEnd, callbackArgs string)
* * 执行针对资源端的规则脚本 *
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) Version ¶
func (e *RuleEngine) Version() typex.VersionInfo
func (*RuleEngine) WorkDevice ¶
核心功能: Work, 主要就是推流进队列
Click to show internal directories.
Click to hide internal directories.