github.com/juju/juju@v0.0.0-20240430160146-1752b71fcf00/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 // AppChanged holds the latest known settings version for associated 20 // applications. 21 AppChanged map[string]int64 22 23 // Departed holds a set of units that have previously been reported to 24 // be in scope, but which no longer are. 25 Departed []string 26 } 27 28 // RelationUnitsChannel is a change channel as described in the CoreWatcher docs. 29 // 30 // It sends a single value representing the current membership of a relation 31 // scope; and the versions of the settings documents for each; and subsequent 32 // values representing entry, settings-change, and departure for units in that 33 // scope. 34 // 35 // It feeds the joined-changed-departed logic in worker/uniter, but these events 36 // do not map 1:1 with hooks. 37 type RelationUnitsChannel <-chan RelationUnitsChange 38 39 // RelationUnitsWatcher conveniently ties a RelationUnitsChannel to the 40 // worker.Worker that represents its validity. 41 type RelationUnitsWatcher interface { 42 CoreWatcher 43 Changes() RelationUnitsChannel 44 }