package events

import "github.com/mesos/mesos-go/api/v1/lib/scheduler/events"

Index

Constants

const NoopHandler = noopHandler(0)

NoopHandler is a Handler that does nothing and always returns nil

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

type HandlerFuncs map[scheduler.Event_Type]HandlerFunc

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

func (HandlerFuncs) HandleEvent

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

HandleEvent implements Handler for HandlerFuncs

func (HandlerFuncs) Otherwise

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

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.

Source Files

events_generated.go gen.go

Version
v0.0.11 (latest)
Published
May 15, 2020
Platform
linux/amd64
Imports
2 packages
Last checked
2 hours ago

Tools for package owners.