Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrForwardChanClosed = errors.New(
"embedded: forward channel was closed by Stop, so this plugin cannot " +
"be restarted; construct a new one with a new channel",
)
ErrForwardChanClosed is returned by Start when the plugin was given a channel with WithOutputChan and has already been stopped. Stop closes that channel, so the forwarding path cannot come back up. Build a new plugin around a new channel instead.
Functions ¶
This section is empty.
Types ¶
type CallbackFunc ¶
CallbackFunc receives immutable events. It must return for Stop to complete. Prefer ContextCallbackFunc for operations that can block.
type ContextCallbackFunc ¶ added in v0.46.0
ContextCallbackFunc receives the run context and an immutable event. It must return when the context is canceled. Returning an error fails the plugin.
type EmbeddedOptionFunc ¶
type EmbeddedOptionFunc func(*EmbeddedOutput)
func WithCallbackFunc ¶
func WithCallbackFunc(callbackFunc CallbackFunc) EmbeddedOptionFunc
WithCallbackFunc specifies a callback function for events
func WithContextCallbackFunc ¶ added in v0.46.0
func WithContextCallbackFunc(callback ContextCallbackFunc) EmbeddedOptionFunc
WithContextCallbackFunc specifies a callback that cooperates with run cancellation. It takes precedence over WithCallbackFunc when both are set.
func WithOutputChan ¶
func WithOutputChan(outputChan chan event.Event) EmbeddedOptionFunc
WithOutputChan specifies an event.Event channel to use for events.
The plugin is the only sender on it and closes it in Stop, so a caller may range over the channel. The channel cannot be reused afterwards: see EmbeddedOutput.Stop.
type EmbeddedOutput ¶
func New ¶
func New(options ...EmbeddedOptionFunc) *EmbeddedOutput
func (*EmbeddedOutput) Role ¶ added in v0.46.0
func (e *EmbeddedOutput) Role() plugin.PluginType
Role identifies this plugin as a pipeline output.
func (*EmbeddedOutput) StartContext ¶ added in v0.46.0
func (e *EmbeddedOutput) StartContext(ctx context.Context) error
StartContext starts the plugin with ctx governing setup and run operations. Call Stop to wait for workers and release resources, including after cancellation.
func (*EmbeddedOutput) Stop ¶
func (e *EmbeddedOutput) Stop() error
Stop the embedded output.
It closes the channel supplied with WithOutputChan, because this plugin is the only sender on it and a caller ranging over it has nothing else to end the range. That makes the forwarding path single-use: a later Start returns ErrForwardChanClosed rather than running on with nowhere to forward to.