triggers

package
v0.11.3 Latest Latest
Warning

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

Go to latest
Published: Jun 25, 2023 License: GPL-3.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// StateChangeName ...
	StateChangeName = "state_change"
	// StateChangeFunctionName ...
	StateChangeFunctionName = "automationTriggerStateChanged"
	// StateChangeQueueSize ...
	StateChangeQueueSize = 10
)
View Source
const (
	// TopicSystem ...
	TopicSystem = "system"
	// EventStart ...
	EventStart = "START"
	// EventStop ...
	EventStop = "STOP"
	// SystemName ...
	SystemName = "system"
	// SystemFunctionName ...
	SystemFunctionName = "automationTriggerSystem"
	// SystemQueueSize ...
	SystemQueueSize = 10
)
View Source
const (
	// TimeName ...
	TimeName = "time"
	// TimeFunctionName ...
	TimeFunctionName = "automationTriggerTime"
	// TimeQueueSize ...
	TimeQueueSize = 10
)
View Source
const (
	// Name ...
	Name = "triggers"
	// TopicSystemStart ...
	TopicSystemStart = "system_start"
	// TopicSystemStop ...
	TopicSystemStop = "system_stop"

	Version = "0.0.1"
)
View Source
const (
	// CronOptionTrigger ...
	CronOptionTrigger = "cron"
)

Variables

This section is empty.

Functions

func New

func New() plugins.Plugable

New ...

Types

type IGetTrigger

type IGetTrigger interface {
	GetTrigger(string) (ITrigger, error)
}

IGetTrigger ...

type IRegistrar

type IRegistrar interface {
	RegisterTrigger(ITrigger) error
	UnregisterTrigger(string) error
	TriggerList() []string
}

IRegistrar ...

type ITrigger

type ITrigger interface {
	Name() string
	AsyncAttach(wg *sync.WaitGroup)
	Subscribe(Subscriber) error
	Unsubscribe(Subscriber) error
	FunctionName() string
	CallManual()
}

todo deAttach

func NewStateChangedTrigger

func NewStateChangedTrigger(eventBus bus.Bus) ITrigger

NewStateChangedTrigger ...

func NewSystemTrigger

func NewSystemTrigger(eventBus bus.Bus) ITrigger

NewSystemTrigger ...

func NewTimeTrigger

func NewTimeTrigger(eventBus bus.Bus,
	scheduler *scheduler.Scheduler) ITrigger

NewTimeTrigger ...

type StateChangeTrigger

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

StateChangeTrigger ...

func (*StateChangeTrigger) AsyncAttach

func (t *StateChangeTrigger) AsyncAttach(wg *sync.WaitGroup)

AsyncAttach ...

func (*StateChangeTrigger) CallManual added in v0.5.3

func (t *StateChangeTrigger) CallManual()

CallManual ...

func (*StateChangeTrigger) FunctionName

func (b *StateChangeTrigger) FunctionName() string

FunctionName ...

func (*StateChangeTrigger) Name

func (b *StateChangeTrigger) Name() string

Name ...

func (*StateChangeTrigger) Subscribe

func (t *StateChangeTrigger) Subscribe(options Subscriber) error

Subscribe ...

func (*StateChangeTrigger) Unsubscribe

func (t *StateChangeTrigger) Unsubscribe(options Subscriber) error

Unsubscribe ...

type Subscriber

type Subscriber struct {
	EntityId *common.EntityId
	Handler  interface{}
	Payload  m.Attributes
}

Subscriber ...

type SystemTrigger

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

SystemTrigger ...

func (*SystemTrigger) AsyncAttach

func (t *SystemTrigger) AsyncAttach(wg *sync.WaitGroup)

AsyncAttach ...

func (*SystemTrigger) CallManual added in v0.5.3

func (t *SystemTrigger) CallManual()

CallManual ...

func (*SystemTrigger) FunctionName

func (b *SystemTrigger) FunctionName() string

FunctionName ...

func (*SystemTrigger) Name

func (b *SystemTrigger) Name() string

Name ...

func (*SystemTrigger) Subscribe

func (t *SystemTrigger) Subscribe(options Subscriber) error

Subscribe ...

func (*SystemTrigger) Unsubscribe

func (t *SystemTrigger) Unsubscribe(options Subscriber) error

Unsubscribe ...

type TimeTrigger

type TimeTrigger struct {
	sync.Mutex
	// contains filtered or unexported fields
}

TimeTrigger ...

func (*TimeTrigger) AsyncAttach

func (t *TimeTrigger) AsyncAttach(wg *sync.WaitGroup)

AsyncAttach ...

func (*TimeTrigger) CallManual added in v0.5.3

func (t *TimeTrigger) CallManual()

CallManual ...

func (*TimeTrigger) FunctionName

func (b *TimeTrigger) FunctionName() string

FunctionName ...

func (*TimeTrigger) Name

func (b *TimeTrigger) Name() string

Name ...

func (*TimeTrigger) Subscribe

func (t *TimeTrigger) Subscribe(options Subscriber) error

Subscribe ...

func (*TimeTrigger) Unsubscribe

func (t *TimeTrigger) Unsubscribe(options Subscriber) error

Unsubscribe ...

Jump to

Keyboard shortcuts

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