types

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Feb 13, 2023 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Source

type Source interface {
	// New returns a new uninitialized instance.
	New() Source

	// Init initializes this instance using user-provided properties.
	// Call the EventHandler when an event happened.
	Init(properties *runtime.RawExtension, eh eventhandler.EventHandler) error

	// Run starts this Source. You should handle the context so that you can
	// know when to exit.
	Run(ctx context.Context) error

	// Type returns the type of this Source. Name your source as something-doer,
	// instead of do-something.
	Type() string
}

Source is an interface for sources. Anything that implements this interface can be registered as Sources, and will be executed automatically.

type SourceMeta

type SourceMeta struct {
	// Type is the name (identifier) of this Source.
	Type string `json:"type"`

	// Properties are user-provided parameters. You should parse it yourself.
	Properties map[string]interface{} `json:"properties"`
}

SourceMeta is what users type in their configurations, specifying what source they want to use and what properties they provided.

Jump to

Keyboard shortcuts

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