github.com/cloud-green/juju@v0.0.0-20151002100041-a00291338d3d/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  	"github.com/juju/names"
     8  	"gopkg.in/juju/charm.v6-unstable"
     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  	// CharmURL is the charm URL that the unit is
    28  	// expected to run.
    29  	CharmURL *charm.URL
    30  
    31  	// ForceCharmUpgrade reports whether the unit
    32  	// should upgrade even in an error state.
    33  	ForceCharmUpgrade bool
    34  
    35  	// ResolvedMode reports the method of resolving
    36  	// hook execution errors.
    37  	ResolvedMode params.ResolvedMode
    38  
    39  	// ConfigVersion is the last published version of
    40  	// the unit's config settings.
    41  	ConfigVersion int
    42  
    43  	// Leader indicates whether or not the unit is the
    44  	// elected leader.
    45  	Leader bool
    46  
    47  	// LeaderSettingsVersion is the last published
    48  	// version of the leader settings for the service.
    49  	LeaderSettingsVersion int
    50  
    51  	// UpdateStatusVersion increments each time an
    52  	// update-status hook is supposed to run.
    53  	UpdateStatusVersion int
    54  
    55  	// Actions is the list of pending actions to
    56  	// be peformed by this unit.
    57  	Actions []string
    58  }
    59  
    60  type RelationSnapshot struct {
    61  	Life    params.Life
    62  	Members map[string]int64
    63  }
    64  
    65  // StorageSnapshot has information relating to a storage
    66  // instance belonging to a unit.
    67  type StorageSnapshot struct {
    68  	Kind     params.StorageKind
    69  	Life     params.Life
    70  	Attached bool
    71  	Location string
    72  }