core

package
v0.6.7 Latest Latest
Warning

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

Go to latest
Published: Mar 15, 2024 License: AGPL-3.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

View Source
const (
	SUCCESS_KEY string = "Success"
	FAILED_KEY  string = "Failed"
	ACTIONS_KEY string = "Actions"
)

Variables

View Source
var GlobalConfig typex.RulexConfig
View Source
var GlobalStore typex.XStore
View Source
var INIPath string

Functions

func ExecuteActions

func ExecuteActions(rule *typex.Rule, arg lua.LValue) (lua.LValue, error)

* * Execute Lua Callback *

func ExecuteFailed

func ExecuteFailed(vm *lua.LState, arg lua.LValue) (interface{}, error)

func ExecuteSuccess

func ExecuteSuccess(vm *lua.LState) (interface{}, error)

LUA Callback : Success

func InitGlobalConfig

func InitGlobalConfig(path string) typex.RulexConfig

Init config

func NewDeviceTypeManager

func NewDeviceTypeManager() typex.DeviceRegistry

func NewRulexStore

func NewRulexStore(maxSize int) typex.XStore

func NewSourceTypeManager

func NewSourceTypeManager() typex.SourceRegistry

func NewTargetTypeManager

func NewTargetTypeManager() typex.TargetRegistry

func SetDebugMode

func SetDebugMode(EnablePProf bool)

* * 设置性能,通常用来Debug用,生产环境建议关闭 *

func SetGomaxProcs

func SetGomaxProcs(GomaxProcs int)

* * 设置go的线程,通常=0 不需要配置 *

func StartStore

func StartStore(maxSize int)

func StartWebDataPipe added in v0.6.3

func StartWebDataPipe() error

* * 启动, 默认在3580端口 *

func VerifyLuaSyntax

func VerifyLuaSyntax(r *typex.Rule) error

VerifyLuaSyntax Verify Lua Syntax

Types

type DeviceTypeManager

type DeviceTypeManager struct {
	// contains filtered or unexported fields
}

func (*DeviceTypeManager) All

func (rm *DeviceTypeManager) All() []*typex.XConfig

func (*DeviceTypeManager) Find

func (*DeviceTypeManager) Register

func (rm *DeviceTypeManager) Register(name typex.DeviceType, f *typex.XConfig)

type RulexStore

type RulexStore struct {
	// contains filtered or unexported fields
}

func (*RulexStore) Count

func (rs *RulexStore) Count() int

统计数量

func (*RulexStore) Delete

func (rs *RulexStore) Delete(k string) error

func (*RulexStore) FuzzyGet

func (rs *RulexStore) FuzzyGet(Key string) any

模糊查询匹配 支持: *AAA AAA* A*B

func (*RulexStore) Get

func (rs *RulexStore) Get(k string) string

获取值

func (*RulexStore) Set

func (rs *RulexStore) Set(k string, v string)

设置值

func (*RulexStore) SetWithDuration added in v0.6.7

func (rs *RulexStore) SetWithDuration(k string, v string, d time.Duration)

* * 设置过期时间 *

type SourceTypeManager

type SourceTypeManager struct {
	// contains filtered or unexported fields
}

func (*SourceTypeManager) All

func (rm *SourceTypeManager) All() []*typex.XConfig

func (*SourceTypeManager) Find

func (rm *SourceTypeManager) Find(name typex.InEndType) *typex.XConfig

func (*SourceTypeManager) Register

func (rm *SourceTypeManager) Register(name typex.InEndType, f *typex.XConfig)

type TargetTypeManager

type TargetTypeManager struct {
	// contains filtered or unexported fields
}

func (*TargetTypeManager) All

func (rm *TargetTypeManager) All() []*typex.XConfig

func (*TargetTypeManager) Find

func (*TargetTypeManager) Register

func (rm *TargetTypeManager) Register(name typex.TargetType, f *typex.XConfig)

type WebsocketDataPipe added in v0.6.3

type WebsocketDataPipe struct {
	WsServer websocket.Upgrader
	Clients  map[string]*websocket.Conn
	// contains filtered or unexported fields
}

* * Websocket 管道 *

func InitWebDataPipe added in v0.6.3

func InitWebDataPipe(rulex typex.RuleX) *WebsocketDataPipe

* * 初始化缓冲器 *

Jump to

Keyboard shortcuts

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