events

package
v0.0.7 Latest Latest
Warning

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

Go to latest
Published: Jul 24, 2018 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

View Source
const NoopHandler = noopHandler(0)

NoopHandler is a Handler that does nothing and always returns nil

Variables

This section is empty.

Functions

This section is empty.

Types

type Handler

type Handler interface {
	HandleEvent(context.Context, *scheduler.Event) error
}

Handler is invoked upon the occurrence of some scheduler event that is generated by some other component in the Mesos ecosystem (e.g. master, agent, executor, etc.)

type HandlerFunc

type HandlerFunc func(context.Context, *scheduler.Event) error

HandlerFunc is a functional adaptation of the Handler interface

func (HandlerFunc) HandleEvent

func (f HandlerFunc) HandleEvent(ctx context.Context, e *scheduler.Event) error

HandleEvent implements Handler for HandlerFunc

type HandlerFuncs added in v0.0.4

type HandlerFuncs map[scheduler.Event_Type]HandlerFunc

HandlerFuncs executes an event HandlerFunc according to the event's type

func (HandlerFuncs) HandleEvent added in v0.0.4

func (hs HandlerFuncs) HandleEvent(ctx context.Context, e *scheduler.Event) (err error)

HandleEvent implements Handler for HandlerFuncs

func (HandlerFuncs) Otherwise added in v0.0.4

func (hs HandlerFuncs) Otherwise(f HandlerFunc) HandlerFunc

Otherwise returns a HandlerFunc that attempts to process an event with the HandlerFuncs map; unmatched event types are processed by the given HandlerFunc. A nil HandlerFunc parameter is effecitvely a noop.

type Handlers

type Handlers map[scheduler.Event_Type]Handler

Handlers executes an event Handler according to the event's type

func (Handlers) HandleEvent

func (hs Handlers) HandleEvent(ctx context.Context, e *scheduler.Event) (err error)

HandleEvent implements Handler for Handlers

func (Handlers) Otherwise added in v0.0.4

func (hs Handlers) Otherwise(f HandlerFunc) HandlerFunc

Otherwise returns a HandlerFunc that attempts to process an event with the Handlers map; unmatched event types are processed by the given HandlerFunc. A nil HandlerFunc parameter is effecitvely a noop.

Jump to

Keyboard shortcuts

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