core

package
v0.6.3 Latest Latest
Warning

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

Go to latest
Published: Sep 15, 2023 License: AGPL-3.0 Imports: 19 Imported by: 0

Documentation

Overview

Copyright (C) 2023 wwhai

This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details.

You should have received a copy of the GNU Affero General Public License along with this program. If not, see <http://www.gnu.org/licenses/>.

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 AllSchema added in v0.6.3

func AllSchema() map[string]typex.DataSchema

* * 所有 *

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 FilterSingleDataWithSchema added in v0.6.3

func FilterSingleDataWithSchema(data map[string]interface{},
	dataDefine []typex.DataDefine) map[string]interface{}

* * 单线条, data长度为1,其中有一个轴固定为‘date’ ^ | ***** | ** ** | ** ** ** * | ** ** ** ** | ** ** ** ** | ** ** ** ** | ** ** ** ** | ****** ** ** | ******** +------------------------------------------------------------->

func FirstCache added in v0.6.3

func FirstCache(id string, schema typex.DataSchema) typex.DataSchema

* * 第一次缓冲 *

func InitGlobalConfig

func InitGlobalConfig(path string) typex.RulexConfig

Init config

func InitInternalSchemaCache added in v0.6.3

func InitInternalSchemaCache()

* * 初始化缓冲器 *

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 SchemaCount added in v0.6.3

func SchemaCount() int

* * 数目 *

func SchemaDelete added in v0.6.3

func SchemaDelete(id string)

* * 删除 *

func SchemaFlush added in v0.6.3

func SchemaFlush()

* * 清空数据 *

func SchemaGet added in v0.6.3

func SchemaGet(id string) (typex.DataSchema, bool)

* * 获取某个模型 *

func SchemaSet added in v0.6.3

func SchemaSet(id string, schema typex.DataSchema)

* * 增加一条缓存数据 *

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(k string) string

模糊查询匹配 支持: *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) SetDuration

func (rs *RulexStore) SetDuration(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