operator

package
v0.12.0 Latest Latest
Warning

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

Go to latest
Published: Sep 21, 2020 License: Apache-2.0 Imports: 6 Imported by: 24

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsDefined

func IsDefined(operatorType string) bool

IsDefined will return a boolean indicating if an operator type is registered and defined.

func Register

func Register(operatorType string, newBuilder func() Builder)

Register will register a function to an operator type. This function will return a builder for the supplied type.

Types

type BuildContext

type BuildContext struct {
	Database   database.Database
	Parameters map[string]interface{}
	Logger     *zap.SugaredLogger
}

BuildContext supplies contextual resources when building an operator.

type Builder

type Builder interface {
	ID() string
	Type() string
	Build(BuildContext) (Operator, error)
	SetNamespace(namespace string, exclude ...string)
}

Builder is an entity that can build operators

type Config

type Config struct {
	Builder
}

Config is the configuration of an operator

func (Config) MarshalJSON

func (c Config) MarshalJSON() ([]byte, error)

MarshalJSON will marshal a config to JSON.

func (Config) MarshalYAML

func (c Config) MarshalYAML() (interface{}, error)

MarshalYAML will marshal a config to YAML.

func (*Config) UnmarshalJSON

func (c *Config) UnmarshalJSON(bytes []byte) error

UnmarshalJSON will unmarshal a config from JSON.

func (*Config) UnmarshalYAML

func (c *Config) UnmarshalYAML(unmarshal func(interface{}) error) error

UnmarshalYAML will unmarshal a config from YAML.

type Operator

type Operator interface {
	// ID returns the id of the operator.
	ID() string
	// Type returns the type of the operator.
	Type() string

	// Start will start the operator.
	Start() error
	// Stop will stop the operator.
	Stop() error

	// CanOutput indicates if the operator will output entries to other operators.
	CanOutput() bool
	// Outputs returns the list of connected outputs.
	Outputs() []Operator
	// SetOutputs will set the connected outputs.
	SetOutputs([]Operator) error

	// CanProcess indicates if the operator will process entries from other operators.
	CanProcess() bool
	// Process will process an entry from an operator.
	Process(context.Context, *entry.Entry) error
	// Logger returns the operator's logger
	Logger() *zap.SugaredLogger
}

Operator is a log monitoring component.

Jump to

Keyboard shortcuts

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