github.com/niedbalski/juju@v0.0.0-20190215020005-8ff100488e47/core/watcher/relationunits.go (about) 1 // Copyright 2015 Canonical Ltd. 2 // Licensed under the AGPLv3, see LICENCE file for details. 3 4 package watcher 5 6 // UnitSettings specifies the version of some unit's settings in some relation. 7 type UnitSettings struct { 8 Version int64 9 } 10 11 // RelationUnitsChange describes the membership and settings of; or changes to; 12 // some relation scope. 13 type RelationUnitsChange struct { 14 15 // Changed holds a set of units that are known to be in scope, and the 16 // latest known settings version for each. 17 Changed map[string]UnitSettings 18 19 // Departed holds a set of units that have previously been reported to 20 // be in scope, but which no longer are. 21 Departed []string 22 } 23 24 // RelationUnitsChannel is a change channel as described in the CoreWatcher docs. 25 // 26 // It sends a single value representing the current membership of a relation 27 // scope; and the versions of the settings documents for each; and subsequent 28 // values representing entry, settings-change, and departure for units in that 29 // scope. 30 // 31 // It feeds the joined-changed-departed logic in worker/uniter, but these events 32 // do not map 1:1 with hooks. 33 type RelationUnitsChannel <-chan RelationUnitsChange 34 35 // RelationUnitsWatcher conveniently ties a RelationUnitsChannel to the 36 // worker.Worker that represents its validity. 37 type RelationUnitsWatcher interface { 38 CoreWatcher 39 Changes() RelationUnitsChannel 40 }