hook

package
v0.11.24 Latest Latest
Warning

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

Go to latest
Published: Oct 31, 2018 License: Apache-2.0 Imports: 3 Imported by: 4

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Env added in v0.9.1

type Env []string

Env is a container for os.Environ style list of combined environment variable strings.

type Event

type Event struct {
	Type     EventType
	TaskInfo mesosutils.TaskInfo
}

Event is a container type for various event specific data.

type EventType

type EventType int

EventType represents task lifecycle event type.

const (
	// BeforeTaskStartEvent is an event type that occurs right before task is
	// started. It is not guaranteed to occur in task lifecycle.
	BeforeTaskStartEvent EventType = iota
	// AfterTaskHealthyEvent is an event type that occurs right after first successful
	// task health check pass.
	AfterTaskHealthyEvent
	// BeforeTerminateEvent is an event type that occurs right before task is terminated.
	// It is guaranteed to occur in task lifecycle and to be last event received.
	BeforeTerminateEvent
)

func (EventType) String

func (i EventType) String() string

type Hook

type Hook interface {
	// HandleEvent is called when any of defined executor task events occurs.
	// Received events may be handled in any way, but hook should ignore unknown or
	// unsupported ones. Call to this function will block executor process until
	// it returns. Order of received event types is undefined.
	HandleEvent(Event) (Env, error)
}

Hook is an interface for various executor extensions, that can add some actions during task lifecycle events.

type Manager

type Manager struct {
	Hooks []Hook
}

Manager is a helper type that simplifies calling group of hooks and handling returned errors.

func (*Manager) HandleEvent

func (m *Manager) HandleEvent(event Event, ignoreErrors bool) (Env, error)

HandleEvent calls group of hooks sequentially. It returns error on first hook call error when ignoreErrors argument is false. When ignoreErrors is set to true it will only log errors returned from each hook and will never return an error itself.

type NoopHook added in v0.11.10

type NoopHook struct {
}

NoopHook is a hook that ignores all events

func (NoopHook) HandleEvent added in v0.11.10

func (noop NoopHook) HandleEvent(event Event) (Env, error)

HandleEvent ignores all events

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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