Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Manifold

func Manifold(config ManifoldConfig) dependency.Manifold

    Manifold returns a dependency manifold that runs the migration worker.

    func New

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

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

      func NewWorker

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

      Types

      type Config

      type Config struct {
      	Agent             agent.Agent
      	Facade            Facade
      	Guard             fortress.Guard
      	Clock             clock.Clock
      	APIOpen           func(*api.Info, api.DialOpts) (api.Connection, error)
      	ValidateMigration func(base.APICaller) error
      	Logger            Logger
      }

        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() (watcher.MigrationStatusWatcher, error)
          	Report(migrationId string, phase migration.Phase, success bool) error
          }

            Facade exposes controller functionality to a Worker.

            func NewFacade

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

            type Logger

            type Logger interface {
            	Errorf(string, ...interface{})
            	Infof(string, ...interface{})
            	Debugf(string, ...interface{})
            }

              Logger represents the methods used for logging messages.

              type ManifoldConfig

              type ManifoldConfig struct {
              	AgentName         string
              	APICallerName     string
              	FortressName      string
              	Clock             clock.Clock
              	APIOpen           func(*api.Info, api.DialOpts) (api.Connection, error)
              	ValidateMigration func(base.APICaller) error
              
              	NewFacade func(base.APICaller) (Facade, error)
              	NewWorker func(Config) (worker.Worker, error)
              	Logger    Logger
              }

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

                func (ManifoldConfig) Validate

                func (config ManifoldConfig) Validate() error

                  Validate is called by start to check for bad configuration.

                  type Worker

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

                    Worker waits for a model migration to be active, then locks down the configured fortress and implements the migration.

                    func (*Worker) Kill

                    func (w *Worker) Kill()

                      Kill implements worker.Worker.

                      func (*Worker) Wait

                      func (w *Worker) Wait() error

                        Wait implements worker.Worker.