~rogpeppe/juju-core/323-machineagent-api-client

« back to all changes in this revision

Viewing changes to state/machine.go

  • Committer: Tarmac
  • Author(s): Tim Penhey
  • Date: 2013-06-17 22:06:54 UTC
  • mfrom: (1274.3.10 instance-id)
  • Revision ID: tarmac-20130617220654-1d7y34f00629h8cv
[r=thumper] Move state.InstanceId to instance.Id

Very mechanical change, just imports, and occasional variable renames.

https://codereview.appspot.com/10325043/

Show diffs side-by-side

added added

removed removed

Lines of Context:
9
9
        "labix.org/v2/mgo/txn"
10
10
        "launchpad.net/juju-core/constraints"
11
11
        "launchpad.net/juju-core/errors"
 
12
        "launchpad.net/juju-core/instance"
12
13
        "launchpad.net/juju-core/state/api/params"
13
14
        "launchpad.net/juju-core/state/presence"
14
15
        "launchpad.net/juju-core/utils"
16
17
        "time"
17
18
)
18
19
 
19
 
// An InstanceId is a provider-specific identifier associated with an
20
 
// instance (physical or virtual machine allocated in the provider).
21
 
type InstanceId string
22
 
 
23
20
// Machine represents the state of a machine.
24
21
type Machine struct {
25
22
        st  *State
59
56
        Nonce         string
60
57
        Series        string
61
58
        ContainerType string
62
 
        InstanceId    InstanceId
 
59
        InstanceId    instance.Id
63
60
        Principals    []string
64
61
        Life          Life
65
62
        Tools         *Tools `bson:",omitempty"`
452
449
 
453
450
// InstanceId returns the provider specific instance id for this machine
454
451
// and whether it has been set.
455
 
func (m *Machine) InstanceId() (InstanceId, bool) {
 
452
func (m *Machine) InstanceId() (instance.Id, bool) {
456
453
        return m.doc.InstanceId, m.doc.InstanceId != ""
457
454
}
458
455
 
480
477
 
481
478
// SetProvisioned sets the provider specific machine id and nonce for
482
479
// this machine. Once set, the instance id cannot be changed.
483
 
func (m *Machine) SetProvisioned(id InstanceId, nonce string) (err error) {
 
480
func (m *Machine) SetProvisioned(id instance.Id, nonce string) (err error) {
484
481
        defer utils.ErrorContextf(&err, "cannot set instance id of machine %q", m)
485
482
 
486
483
        if id == "" || nonce == "" {