ctrl

package
v0.0.0-...-98ba599 Latest Latest
Warning

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

Go to latest
Published: Jul 2, 2020 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Controller

type Controller interface {
	Eval(ctx context.Context, processValue *Event) Result
}

type ControllerFactory

type ControllerFactory func(event *Event) (ctrl Controller, err error)

type ControllerStats

type ControllerStats struct {
	LastEvaluatedAt time.Time
	EvalCount       int64
}

func (ControllerStats) RecordEval

func (c ControllerStats) RecordEval() ControllerStats

type Done

type Done struct {
	Msg string
}

Done removes the controller for this evaluation, which prevents any further evaluations

func (Done) Apply

func (r Done) Apply(s *System, event *Event)

type Err

type Err struct {
	Err error
}

Err logs the controller error.

func (Err) Apply

func (r Err) Apply(s *System, event *Event)

func (Err) Error

func (r Err) Error() string

type EvalQueue

type EvalQueue interface {
	Submit(event *Event) bool
}

type Event

type Event = fes.Notification

Future: decouple from fes.

type Identifier

type Identifier interface {
	ID() string
}

type PollSensor

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

func NewPollSensor

func NewPollSensor(interval time.Duration, pollFn func(queue EvalQueue)) *PollSensor

func (*PollSensor) Close

func (s *PollSensor) Close() error

func (*PollSensor) Run

func (s *PollSensor) Run(evalQueue EvalQueue)

func (*PollSensor) Start

func (s *PollSensor) Start(evalQueue EvalQueue) error

type Result

type Result interface {
	Apply(s *System, event *Event)
}

type Sensor

type Sensor interface {
	io.Closer
	Start(evalQueue EvalQueue) error
}

type Success

type Success struct {
	Msg string
}

Success is default evaluation result.

func (Success) Apply

func (r Success) Apply(s *System, event *Event)

type System

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

Future: support parallel executions in evaluator

func NewSystem

func NewSystem(factory ControllerFactory) *System

func (*System) AddController

func (s *System) AddController(key string, ctrl Controller)

func (*System) Close

func (s *System) Close() error

func (*System) DeleteController

func (s *System) DeleteController(key string)

func (*System) GetController

func (s *System) GetController(key string) (ctrl Controller, ok bool)

func (*System) Logger

func (s *System) Logger() *log.Logger

func (*System) LoggerFor

func (s *System) LoggerFor(entityID string) *log.Entry

func (*System) RangeControllerStats

func (s *System) RangeControllerStats(consumer func(k string, v ControllerStats) bool)

func (*System) Run

func (s *System) Run()

func (*System) Submit

func (s *System) Submit(event *Event) bool

Jump to

Keyboard shortcuts

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