plugin

package
v0.0.0-...-e6cdf45 Latest Latest
Warning

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

Go to latest
Published: Jan 22, 2022 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	Global               = New()
	ErrExists            = errors.New("already exists")
	ErrNotFound          = errors.New("not found")
	ErrCorruptedRegistry = errors.New("registry seems to be corrupted")
)
View Source
var ErrNOP = errors.New("No op")

Functions

func MarshalOptions

func MarshalOptions(opts interface{}) map[string]interface{}

func WithBlocking

func WithBlocking(blocking bool) options.Option

/ Sets whether output should be blocking. / Non blocking will skip data.

func WithBufferSize

func WithBufferSize(size int) options.Option

/ Set buffer size for sync/join

func WithClose

func WithClose(close bool) options.Option

/ Close keys where supported(display/sink/bridge)

func WithEOSExit

func WithEOSExit(exit bool) options.Option

/ Stop the step if End Of Stream is detected

func WithEnable

func WithEnable(b bool) options.Option

/ Skip processing

func WithIgnoreErrors

func WithIgnoreErrors(ignore bool) options.Option

/ Ignore errors

func WithMapping

func WithMapping(opt map[string]interface{}) options.Option

/ Update Options struct with values inside the map. / Usecase: write/read options to JSON.

func WithName

func WithName(name string) options.Option

/ Set plugin Name

Types

type Builder

type Builder func(...options.Option) (Plugin, error)

type Options

type Options struct {
	Name         string `opts:"name"`
	Blocking     bool   `opts:"block"`
	Enabled      bool   `opts:"enable"`
	BufferSize   int    `opts:"buf_size"`
	NoEOS        bool   `opts:"no_eos"`
	IgnoreErrors bool   `opts:"ignore_err"`
	Close        bool   `opts:"close"`
}

func DefaultOptions

func DefaultOptions() Options

/ Create options struct with default values

type Plugin

type Plugin interface{}

type Registry

type Registry struct {
	// contains filtered or unexported fields
}

func New

func New() *Registry

func (*Registry) ForEach

func (p *Registry) ForEach(pattern string, f func(string, Builder))

func (*Registry) New

func (p *Registry) New(name string, opts ...options.Option) (Plugin, error)

func (*Registry) Register

func (p *Registry) Register(name string, builder Builder) error

func (*Registry) Unregister

func (p *Registry) Unregister(name string) error

Jump to

Keyboard shortcuts

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