core

package
v0.0.7 Latest Latest
Warning

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

Go to latest
Published: Apr 3, 2024 License: GPL-3.0 Imports: 16 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewSessionInfo added in v0.0.4

func NewSessionInfo(timeout time.Duration, session *data.Session, mapRule map[string]Rule) *data.Info

Types

type ConfigEngine

type ConfigEngine struct {
	BusMap         map[string]string      `json:"bus_map"`
	Rules          map[string]*RuleOption `json:"rules"`
	TimeoutSession int                    `json:"timeout_session"`
	Log            ConfigLog              `json:"log"`
	Plugins        []string               `json:"plugins"`
}

type ConfigLog

type ConfigLog struct {
	Level         string `json:"level"`
	Output        string `json:"output"`
	FileName      string `json:"file_name"`
	LogMethodName bool   `json:"log_method_name"`
}

type DipperEngine

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

func NewDipperEngine

func NewDipperEngine(
	config *ConfigEngine,
	factoryQueue FactoryQueue[*data.InputEngine],
	factoryQueueOutput FactoryQueueName[*data.OutputEngine],
	store store.Store,
	bus bus2.Bus,
) *DipperEngine

func (*DipperEngine) Add

func (d *DipperEngine) Add(ctx context.Context, sessionData *data.Session) error

func (*DipperEngine) AddRule

func (d *DipperEngine) AddRule(rules ...Rule)

func (*DipperEngine) ControlGetRule added in v0.0.4

func (d *DipperEngine) ControlGetRule(session uint64) []string

func (*DipperEngine) ControlSession added in v0.0.4

func (d *DipperEngine) ControlSession(ruleName string) []uint64

func (*DipperEngine) ControlStopSession added in v0.0.4

func (d *DipperEngine) ControlStopSession(ruleName string, session uint64)

func (*DipperEngine) ListControl added in v0.0.4

func (d *DipperEngine) ListControl() []string

func (*DipperEngine) LoadPlugin

func (d *DipperEngine) LoadPlugin()

func (*DipperEngine) OutputSubscribe added in v0.0.6

func (d *DipperEngine) OutputSubscribe(ctx context.Context, callback queue.SubscribeFunction[*data.ResultSession])

func (*DipperEngine) RuleEnable

func (d *DipperEngine) RuleEnable() []string

func (*DipperEngine) SessionInputQueue

func (d *DipperEngine) SessionInputQueue(factoryQueueName FactoryQueueName[*data.Session])

func (*DipperEngine) SessionOutputQueue

func (d *DipperEngine) SessionOutputQueue(factoryQueueOutputName FactoryQueueName[*data.ResultSession])

func (*DipperEngine) SetConfig

func (d *DipperEngine) SetConfig(conf *ConfigEngine)

func (*DipperEngine) SetContext

func (d *DipperEngine) SetContext(ctx context.Context)

func (*DipperEngine) Start

func (d *DipperEngine) Start() error

func (*DipperEngine) StartSession added in v0.0.4

func (d *DipperEngine) StartSession(ctx context.Context, sessionId uint64) error

func (*DipperEngine) Stop

func (d *DipperEngine) Stop() error

type FactoryQueue

type FactoryQueue[T any] func(engine Rule) queue.QueueEngine[T]

func FactoryQueueDefault

func FactoryQueueDefault[T any]() FactoryQueue[T]

type FactoryQueueName

type FactoryQueueName[T any] func(name string) queue.QueueEngine[T]

func FactoryQueueNameDefault

func FactoryQueueNameDefault[T any]() FactoryQueueName[T]

type PluginDipper

type PluginDipper interface {
	Rules() []Rule
}

type Rule

type Rule interface {
	Id() string
	Infinity() bool
	Initialize(ctx context.Context, option map[string]interface{}) error
	Run(ctx context.Context,
		subscribeQueueInput func(ctx context.Context, callback queue.SubscribeFunction[*data.InputEngine]) error,
		pushQueueOutput func(ctx context.Context, input *data.OutputEngine) error)
	Stop(ctx context.Context) error
}

type RuleOption

type RuleOption struct {
	Enable  bool                   `json:"enable"`
	Worker  int                    `json:"worker"`
	Options map[string]interface{} `json:"options"`
}

type SessionControl added in v0.0.4

type SessionControl interface {
	ListSession() []uint64
	StopSession(id uint64)
	InfoSession(id uint64) map[string]interface{}
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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