migrationmaster

package
v0.0.0-...-2608902 Latest Latest
Warning

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

Go to latest
Published: Apr 25, 2016 License: AGPL-3.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (

	// ErrDoneForNow indicates a temporary issue was encountered and
	// that the worker should restart and retry.
	ErrDoneForNow = errors.New("done for now")
)

Functions

func Manifold

func Manifold(config ManifoldConfig) dependency.Manifold

Manifold packages a Worker for use in a dependency.Engine.

func NewWorker

func NewWorker(config Config) (worker.Worker, error)

Types

type Config

type Config struct {
	Facade Facade
	Guard  fortress.Guard
}

Config defines the operation of a Worker.

func (Config) Validate

func (config Config) Validate() error

Validate returns an error if config cannot drive a Worker.

type Facade

type Facade interface {

	// Watch returns a watcher which reports when a migration is
	// active for the model associated with the API connection.
	Watch() (watcher.NotifyWatcher, error)

	// GetMigrationStatus returns the details and progress of the
	// latest model migration.
	GetMigrationStatus() (migrationmaster.MigrationStatus, error)

	// SetPhase updates the phase of the currently active model
	// migration.
	SetPhase(migration.Phase) error

	// Export returns a serialized representation of the model
	// associated with the API connection.
	Export() ([]byte, error)
}

Facade exposes controller functionality to a Worker.

func NewFacade

func NewFacade(apiCaller base.APICaller) (Facade, error)

type ManifoldConfig

type ManifoldConfig struct {
	APICallerName string
	FortressName  string

	NewFacade func(base.APICaller) (Facade, error)
	NewWorker func(Config) (worker.Worker, error)
}

ManifoldConfig defines the names of the manifolds on which a Worker manifold will depend.

type Worker

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

Worker waits until a migration is active and its configured Fortress is locked down, and then orchestrates a model migration.

func New

func New(config Config) (*Worker, error)

New returns a Worker backed by config, or an error.

func (*Worker) Kill

func (w *Worker) Kill()

Kill implements worker.Worker.

func (*Worker) Wait

func (w *Worker) Wait() error

Wait implements worker.Worker.

Jump to

Keyboard shortcuts

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