lifecycle

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Apr 26, 2017 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ActionDefaultRetries = 3
	ActionDefaultTimeout = 1 * time.Second
	ActionDefaultDelay   = 500 * time.Millisecond
)

Variables

View Source
var (
	ErrActionNotConfigured = fmt.Errorf("action not configured")
)
View Source
var (
	ErrRetryCountExceeded = fmt.Errorf("retry count exceeded")
)

Functions

func MakeActionPlugin

func MakeActionPlugin(name string, fn func(buf []byte) (Action, error))

func RegisterActionPlugin

func RegisterActionPlugin(ap ActionPlugin)

Types

type Action

type Action interface {
	Config() ActionConfig
	Do(Env, params.Params) error
}

func ParseAction

func ParseAction(buf []byte) (Action, error)

type ActionConfig

type ActionConfig struct {
	Type    string
	Retries int
	Timeout time.Duration
	Delay   time.Duration
}

func DefaultActionConfig

func DefaultActionConfig() ActionConfig

func (ActionConfig) Config

func (ac ActionConfig) Config() ActionConfig

func (*ActionConfig) UnmarshalJSON

func (ac *ActionConfig) UnmarshalJSON(buf []byte) error

type ActionPlugin

type ActionPlugin interface {
	Name() string
	ParseConfig([]byte) (Action, error)
}

type ContainerManager

type ContainerManager interface {
	HasInitialize() bool
	DoInitialize(context.Context, params.Params) error

	HasHealthcheck() bool
	DoHealthcheck(context.Context, params.Params) error

	HasReset() bool
	DoReset(context.Context, params.Params) error
}

type Env

type Env interface {
	Context() context.Context
	Log() logrus.FieldLogger
}

func NewEnv

func NewEnv(ctx context.Context, log logrus.FieldLogger) Env

type Manager

type Manager interface {
	ParseConfig([]byte) error
	MaxDelay() time.Duration
	ForContainer(ui.ContainerEmitter, string) ContainerManager
}

func NewManager

func NewManager(log logrus.FieldLogger) Manager

Jump to

Keyboard shortcuts

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