~juju-qa/ubuntu/xenial/juju/xenial-2.0-beta3

« back to all changes in this revision

Viewing changes to src/github.com/juju/juju/worker/migrationmaster/manifold.go

  • Committer: Martin Packman
  • Date: 2016-03-30 19:31:08 UTC
  • mfrom: (1.1.41)
  • Revision ID: martin.packman@canonical.com-20160330193108-h9iz3ak334uk0z5r
Merge new upstream source 2.0~beta3

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
// Copyright 2016 Canonical Ltd.
 
2
// Licensed under the AGPLv3, see LICENCE file for details.
 
3
 
 
4
package migrationmaster
 
5
 
 
6
import (
 
7
        "github.com/juju/juju/agent"
 
8
        "github.com/juju/juju/api/base"
 
9
        masterapi "github.com/juju/juju/api/migrationmaster"
 
10
        "github.com/juju/juju/worker"
 
11
        "github.com/juju/juju/worker/dependency"
 
12
        "github.com/juju/juju/worker/util"
 
13
)
 
14
 
 
15
// ManifoldConfig defines the names of the manifolds on which a
 
16
// Manifold will depend.
 
17
type ManifoldConfig util.PostUpgradeManifoldConfig
 
18
 
 
19
// Manifold returns a dependency manifold that runs the migration
 
20
// worker.
 
21
func Manifold(config ManifoldConfig) dependency.Manifold {
 
22
        return util.PostUpgradeManifold(util.PostUpgradeManifoldConfig(config), newWorker)
 
23
}
 
24
 
 
25
// newWorker is a shim to allow New to work with PostUpgradeManifold.
 
26
func newWorker(_ agent.Agent, apiCaller base.APICaller) (worker.Worker, error) {
 
27
        client := masterapi.NewClient(apiCaller)
 
28
        return New(client), nil
 
29
}