Descriptionadd relationUnitsWatcher
...which expresses changes to a relation from a given unit's perspective, in
terms that I believe will be helpful for the unit agent.
In particular, the main event type produced has Changed and Departed fields,
under the rationale that the UA will itself be keeping track of membership
as it does in the python version; and that therefore it is actually more
helpful to expect it to pay attention only to -changed and -departed events,
and to automatically run -joined hooks *before* running -changed hooks in
response to unrecognised units (rather than spearately tracking all 3 kinds
of event, and *also* inserting -changed events immediately after -joineds,
as is currently done in the python).
The intent is to keep this type internal, and use it only within a
(tentatively-named) RelationUnit type, which (1) exposes the
relationUnitsWatcher's Changes channel and (2) maintains a Pinger
signalling its own presence in the relation; I'm expecting it to
look something like:
func (*Unit) Join(*Relation) (*RelationUnit, error)
func (*RelationUnit) Changes() <-chan RelationUnitsChange
func (*RelationUnit) Depart() error
func (*RelationUnit) Abscond() error
...in which Abscond seems to me to be the best available term for "depart
quietly, abandoning rather than deleting the presence node, in the hope that
departure will not be noticed by the other participants and the UA process
will have time to restart and reoccupy the node without any other UA
noticing".
This will broadly mirror the behaviour of the UnitRelationState in python,
but is IMO somewhat clearer (apart from anything else, departure is now
explicit, rather than happening magically at process exit). YMMV; please
let me know if it does, and how I could do it better :-).
https://code.launchpad.net/~fwereade/juju-core/relation-units-watcher/+merge/115001
Requires: https://code.launchpad.net/~fwereade/juju-core/watch-presence-children/+merge/112375
(do not edit description out of merge proposal)
Patch Set 1 #
Total comments: 17
Patch Set 2 : add relationUnitsWatcher #Patch Set 3 : add relationUnitsWatcher #
MessagesTotal messages: 5
|