github.com/niedbalski/juju@v0.0.0-20190215020005-8ff100488e47/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"
     8  	"gopkg.in/juju/names.v2"
     9  
    10  	"github.com/juju/juju/apiserver/params"
    11  	"github.com/juju/juju/core/model"
    12  )
    13  
    14  // Snapshot is a snapshot of the remote state of the unit.
    15  type Snapshot struct {
    16  	// Life is the lifecycle state of the unit.
    17  	Life params.Life
    18  
    19  	// Relations contains the lifecycle states of
    20  	// each of the application's relations, keyed by
    21  	// relation IDs.
    22  	Relations map[int]RelationSnapshot
    23  
    24  	// Storage contains the lifecycle and attached
    25  	// states of each of the unit's storage attachments.
    26  	Storage map[names.StorageTag]StorageSnapshot
    27  
    28  	// CharmModifiedVersion is increased whenever the application's charm was
    29  	// changed in some way.
    30  	CharmModifiedVersion int
    31  
    32  	// CharmURL is the charm URL that the unit is
    33  	// expected to run.
    34  	CharmURL *charm.URL
    35  
    36  	// ForceCharmUpgrade reports whether the unit
    37  	// should upgrade even in an error state.
    38  	ForceCharmUpgrade bool
    39  
    40  	// ResolvedMode reports the method of resolving
    41  	// hook execution errors.
    42  	ResolvedMode params.ResolvedMode
    43  
    44  	// RetryHookVersion increments each time a failed
    45  	// hook is meant to be retried if ResolvedMode is
    46  	// set to ResolvedNone.
    47  	RetryHookVersion int
    48  
    49  	// ConfigHash is a hash of the last published version of the
    50  	// unit's config settings.
    51  	ConfigHash string
    52  
    53  	// TrustHash is a hash of the last published version of the unit's
    54  	// trust settings.
    55  	TrustHash string
    56  
    57  	// AddressesHash is a hash of the last published addresses for the
    58  	// unit's machine/container.
    59  	AddressesHash string
    60  
    61  	// Leader indicates whether or not the unit is the
    62  	// elected leader.
    63  	Leader bool
    64  
    65  	// LeaderSettingsVersion is the last published
    66  	// version of the leader settings for the application.
    67  	LeaderSettingsVersion int
    68  
    69  	// UpdateStatusVersion increments each time an
    70  	// update-status hook is supposed to run.
    71  	UpdateStatusVersion int
    72  
    73  	// Actions is the list of pending actions to
    74  	// be performed by this unit.
    75  	Actions []string
    76  
    77  	// Commands is the list of IDs of commands to be
    78  	// executed by this unit.
    79  	Commands []string
    80  
    81  	// UpgradeSeriesStatus is the preparation status of any currently running
    82  	// series upgrade
    83  	UpgradeSeriesStatus model.UpgradeSeriesStatus
    84  
    85  	// UpgradeCharmProfileStatus represents the current upgrade charm profile
    86  	// status for the currently running unit
    87  	UpgradeCharmProfileStatus string
    88  }
    89  
    90  type RelationSnapshot struct {
    91  	Life      params.Life
    92  	Suspended bool
    93  	Members   map[string]int64
    94  }
    95  
    96  // StorageSnapshot has information relating to a storage
    97  // instance belonging to a unit.
    98  type StorageSnapshot struct {
    99  	Kind     params.StorageKind
   100  	Life     params.Life
   101  	Attached bool
   102  	Location string
   103  }