hook

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: May 8, 2018 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Overview

package hook is used to ensure execution of a set of pre-start, post-start, pre-stop and post-stop hooks. The transitioning between states is gated by the consumer of the package, through use of the Hooks.Transition function.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Hooks

type Hooks struct {
	// PreStart are hooks to be run before the application starts
	PreStart []Interface

	// PostStart are hooks to be run after the application starts
	PostStart []Interface

	// PreStop are hooks to be run before the application stops
	PreStop []Interface

	// PostStop are hooks to be run after the application stops
	PostStop []Interface
	// contains filtered or unexported fields
}

func (*Hooks) Transition

func (h *Hooks) Transition(p Phase, pilot *v1alpha1.Pilot) error

type Interface

type Interface interface {
	// The name of the Hook
	Name() string
	// Execute the action with the given Pilot resource
	Execute(pilot *v1alpha1.Pilot) error
}

func New

func New(name string, fn func(*v1alpha1.Pilot) error) Interface

type Phase

type Phase string
const (
	PreStart  Phase = "PreStart"
	PostStart Phase = "PostStart"
	PreStop   Phase = "PreStop"
	PostStop  Phase = "PostStop"
)

Jump to

Keyboard shortcuts

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