events

package
v0.0.0-...-e28080d Latest Latest
Warning

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

Go to latest
Published: May 22, 2017 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	InternalNamespace = "keds"
	PluginNamespace   = "plugin"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Event

type Event struct {
	*pb.PluginEvent
	SourcePlugin *plugin.Plugin
}

func CreateEventCommandInvoked

func CreateEventCommandInvoked(target *plugin.Plugin, args []string) (event *Event)

func CreateEventServerQuit

func CreateEventServerQuit(src *plugin.Plugin, exitCode int) (event *Event)

func NewEvent

func NewEvent(event *pb.PluginEvent, src *plugin.Plugin) *Event

func NewEventWithOptions

func NewEventWithOptions(opts ...EventOption) *Event

func (*Event) ApplyOptions

func (e *Event) ApplyOptions(opts ...EventOption)

func (*Event) Proto

func (e *Event) Proto() *pb.PluginEvent

type EventBus

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

func NewEventBus

func NewEventBus() *EventBus

func (*EventBus) AddListener

func (b *EventBus) AddListener(ctx context.Context, listener IListener) (quitc chan struct{}, err error)

func (*EventBus) Publish

func (b *EventBus) Publish(ctx context.Context, event *pb.PluginEvent) (err error)

type EventOption

type EventOption func(e *Event)

func WithArg

func WithArg(val string) EventOption

func WithArgs

func WithArgs(args []string) EventOption

func WithData

func WithData(data map[string]string) EventOption

func WithExitCode

func WithExitCode(code int) EventOption

func WithKeyPair

func WithKeyPair(key string, val string) EventOption

func WithName

func WithName(name string) EventOption

func WithSource

func WithSource(source string) EventOption

func WithSourcePlugin

func WithSourcePlugin(plug *plugin.Plugin) EventOption

func WithTarget

func WithTarget(target string) EventOption

type IEventBus

type IEventBus interface {
	AddListener(ctx context.Context, listener IListener) (chan struct{}, error)
	Publish(ctx context.Context, event *pb.PluginEvent) error
}

type IListener

type IListener interface {
	Receive(ctx context.Context, event *pb.PluginEvent) error
	Listen(ctx context.Context) (chan struct{}, error)
}

Jump to

Keyboard shortcuts

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