embedded

package
v0.46.0 Latest Latest
Warning

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

Go to latest
Published: Oct 22, 2026 License: Apache-2.0 Imports: 5 Imported by: 7 modules, 4 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

View Source
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

type CallbackFunc func(event.Event) error

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

type ContextCallbackFunc func(context.Context, event.Event) error

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

type EmbeddedOutput struct {
	plugin.Base
	// contains filtered or unexported fields
}

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) Start

func (e *EmbeddedOutput) Start() error

Start the embedded 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.

Jump to

Keyboard shortcuts

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