Documentation ¶
Index ¶
- Variables
- func Lookup(configType string) (func() Builder, bool)
- func Register(operatorType string, newBuilder func() Builder)
- func RegisterPlugin(pluginName string, newBuilder func() Builder)
- type BuildContext
- func (bc BuildContext) Copy() BuildContext
- func (bc BuildContext) PrependNamespace(id string) string
- func (bc BuildContext) WithDefaultOutputIDs(ids []string) BuildContext
- func (bc BuildContext) WithIncrementedDepth() BuildContext
- func (bc BuildContext) WithSubNamespace(namespace string) BuildContext
- type Builder
- type Config
- type Operator
- type Registry
Constants ¶
This section is empty.
Variables ¶
var DefaultRegistry = NewRegistry()
DefaultRegistry is a global registry of operator types to operator builders.
Functions ¶
func Lookup ¶
Lookup looks up a given config type, prioritizing builtin operators before looking in registered plugins. Its second return value will be false if no builder is registered for that type
func RegisterPlugin ¶
RegisterPlugin will register a plugin in the default registry
Types ¶
type BuildContext ¶
type BuildContext struct { Database database.Database Parameters map[string]interface{} Logger *logger.Logger Namespace string DefaultOutputIDs []string PluginDepth int }
BuildContext supplies contextual resources when building an operator.
func NewBuildContext ¶
func NewBuildContext(db database.Database, lg *zap.SugaredLogger) BuildContext
NewBuildContext creates a new build context with the given database, logger, and the default namespace
func (BuildContext) Copy ¶
func (bc BuildContext) Copy() BuildContext
Copy creates a copy of the build context
func (BuildContext) PrependNamespace ¶
func (bc BuildContext) PrependNamespace(id string) string
PrependNamespace adds the current namespace of the build context to the front of the given ID if that ID is not already namespaced up to the root level
func (BuildContext) WithDefaultOutputIDs ¶
func (bc BuildContext) WithDefaultOutputIDs(ids []string) BuildContext
WithDefaultOutputIDs sets the default output IDs for the current context or the current operator build
func (BuildContext) WithIncrementedDepth ¶
func (bc BuildContext) WithIncrementedDepth() BuildContext
WithIncrementedDepth returns a new build context with an incremented plugin depth
func (BuildContext) WithSubNamespace ¶
func (bc BuildContext) WithSubNamespace(namespace string) BuildContext
WithSubNamespace creates a new build context with a more specific namespace
type Builder ¶
type Builder interface { ID() string Type() string Build(BuildContext) ([]Operator, error) }
Builder is an entity that can build a single operator
type Config ¶
type Config struct {
Builder
}
Config is the configuration of an operator
func (Config) MarshalJSON ¶
MarshalJSON will marshal a config to JSON.
func (Config) MarshalYAML ¶
MarshalYAML will marshal a config to YAML.
func (*Config) UnmarshalJSON ¶
UnmarshalJSON will unmarshal a config from JSON.
func (*Config) UnmarshalYAML ¶
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.
type Registry ¶
type Registry struct {
// contains filtered or unexported fields
}
Registry is a registry for operators and plugins that is used for building types from IDs
func (*Registry) Lookup ¶
Lookup looks up a given config type, prioritizing builtin operators before looking in registered plugins. Its second return value will be false if no builder is registered for that type
func (*Registry) Register ¶
Register will register a function to an operator type. This function will return a builder for the supplied type.
func (*Registry) RegisterPlugin ¶
RegisterPlugin will register a function to an plugin type. This function will return a builder for the supplied type.