github.com/wallyworld/juju@v0.0.0-20161013125918-6cf1bc9d917a/worker/uniter/remotestate/snapshot.go (about) 1 // Copyright 2015 Canonical Ltd. 2 // Licensed under the AGPLv3, see LICENCE file for details. 3 4 package remotestate 5 6 import ( 7 "gopkg.in/juju/charm.v6-unstable" 8 "gopkg.in/juju/names.v2" 9 10 "github.com/juju/juju/apiserver/params" 11 ) 12 13 // Snapshot is a snapshot of the remote state of the unit. 14 type Snapshot struct { 15 // Life is the lifecycle state of the unit. 16 Life params.Life 17 18 // Relations contains the lifecycle states of 19 // each of the service's relations, keyed by 20 // relation IDs. 21 Relations map[int]RelationSnapshot 22 23 // Storage contains the lifecycle and attached 24 // states of each of the unit's storage attachments. 25 Storage map[names.StorageTag]StorageSnapshot 26 27 // CharmModifiedVersion is increased whenever the service's charm was 28 // changed in some way. 29 CharmModifiedVersion int 30 31 // CharmURL is the charm URL that the unit is 32 // expected to run. 33 CharmURL *charm.URL 34 35 // ForceCharmUpgrade reports whether the unit 36 // should upgrade even in an error state. 37 ForceCharmUpgrade bool 38 39 // ResolvedMode reports the method of resolving 40 // hook execution errors. 41 ResolvedMode params.ResolvedMode 42 43 // RetryHookVersion increments each time a failed 44 // hook is meant to be retried if ResolvedMode is 45 // set to ResolvedNone. 46 RetryHookVersion int 47 48 // ConfigVersion is the last published version of 49 // the unit's config settings. 50 ConfigVersion int 51 52 // Leader indicates whether or not the unit is the 53 // elected leader. 54 Leader bool 55 56 // LeaderSettingsVersion is the last published 57 // version of the leader settings for the application. 58 LeaderSettingsVersion int 59 60 // UpdateStatusVersion increments each time an 61 // update-status hook is supposed to run. 62 UpdateStatusVersion int 63 64 // Actions is the list of pending actions to 65 // be peformed by this unit. 66 Actions []string 67 68 // Commands is the list of IDs of commands to be 69 // executed by this unit. 70 Commands []string 71 } 72 73 type RelationSnapshot struct { 74 Life params.Life 75 Members map[string]int64 76 } 77 78 // StorageSnapshot has information relating to a storage 79 // instance belonging to a unit. 80 type StorageSnapshot struct { 81 Kind params.StorageKind 82 Life params.Life 83 Attached bool 84 Location string 85 }