internal

package
v0.0.0-...-a355528 Latest Latest
Warning

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

Go to latest
Published: Oct 27, 2017 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ControlLoop

type ControlLoop interface {
	Start()
	Running() bool
	Stop() error
}

ControlLoop gives status and means to stop the object

type Controller

type Controller struct {
	// contains filtered or unexported fields
}

Controller implements the pkg/controller/Controller interface and manages a collection of controls

func NewController

func NewController(l manager.Leadership,
	alloc func(types.Spec) (Managed, error),
	keyfunc func(types.Metadata) string) *Controller

NewController creates a controller injecting dependencies

func (*Controller) Commit

func (c *Controller) Commit(operation controller.Operation, spec types.Spec) (object types.Object, err error)

Commit commits the spec to the controller for management or destruction. The controller's job is to ensure reality matches the operation and the specification. The spec can be composed and references other controllers or plugins. When a spec is committed to a controller, the controller returns the object state corresponding to the spec. When operation is Destroy, only Metadata portion of the spec is needed to identify the object to be destroyed.

func (*Controller) Describe

func (c *Controller) Describe(search *types.Metadata) (objects []types.Object, err error)

Describe returns a list of objects matching the metadata provided. A list of objects are possible because metadata can be a tags search. An object has state, and its original spec can be accessed as well. A nil Metadata will instruct the controller to return all objects under management.

func (*Controller) Free

func (c *Controller) Free(search *types.Metadata) (objects []types.Object, err error)

Free tells the controller to pause management of objects matching. To resume, commit again.

func (*Controller) ManagedObjects

func (c *Controller) ManagedObjects() (map[string]controller.Controller, error)

ManagedObjects returns a map of managed objects

func (*Controller) Plan

func (c *Controller) Plan(operation controller.Operation,
	spec types.Spec) (object types.Object, plan controller.Plan, err error)

Plan is a commit without actually making the changes. The controller returns a proposed object state after commit, with a Plan, or error.

type Managed

type Managed interface {
	ControlLoop

	Plan(controller.Operation, types.Spec) (*types.Object, *controller.Plan, error)
	Enforce(types.Spec) (*types.Object, error)
	Inspect() (*types.Object, error)
	Free() (*types.Object, error)
	Terminate() (*types.Object, error)
}

Managed is the interface implemented by managed objects within a controller

Jump to

Keyboard shortcuts

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