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
// Singleton defines if this type of Source will only be initialized once.
// For example, if Singleton is true, all Source's in config with the same
// type will share the same instance (New will be called only once)
// and Init will be called multiple times for each Source of the same type.
// Otherwise, each Source will have its own instance, i.e., each New for each Init.
Singleton() bool
}
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.
Click to show internal directories.
Click to hide internal directories.