service relation lifecycle api

Bug #1032539 reported by William Reade on 2012-08-03
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Frank Mueller

Bug Description

The first client that desperately needs lifecycles to work is the unit agent, which needs to track relation lifecycle. I hope I'm not going to regret this, but I *think* that all I need is a ServiceRelationsWatcher that watches a specific service's relations throughout their lifecycle and produces these:

type RelationsChange struct {
    Changed []*Relation

The initial event should contain every relation, whatever its state; subsequent ones should contain only the relations whose state has changed since the last event. I have come to the conclusion that I actually don't need separate Alive/Dying/Dead fields in the event.

AIUI, it will need to:

* watch the topology for changes to the service's relations as it currently does
* on relevant topology change:
  * for each added relation:
    * store its life status, and start a life watch *unless* it is already dead
  * report all added relations in a single event
* on life change (that was started on new topology relation)
  * if life status is Dead, stop the relation's life watch
  * report the single changed relation in a single event

In my mind, this kinda assumes a LifeWatcher type that guarantees it won't send the same status more than once, but guarantees it *will* send a Dead event if the node is deleted before it notices a change to Dead.

(Relation needs Life and SetLife, or whatever it was we agreed on.)

Related branches

William Reade (fwereade) on 2012-08-03
Changed in juju-core:
assignee: nobody → Frank Mueller (themue)
milestone: none → 1.2
importance: Undecided → Critical
William Reade (fwereade) on 2012-08-03
description: updated
Frank Mueller (themue) on 2012-08-09
Changed in juju-core:
status: New → In Progress
Frank Mueller (themue) on 2012-08-20
Changed in juju-core:
milestone: 1.2 → 2.0
milestone: 2.0 → 1.3
Mark Ramm (mark-ramm) on 2012-08-31
Changed in juju-core:
milestone: 1.3 → 1.4
Frank Mueller (themue) wrote :

ServiceRelationsWatcher exists but is not yet used.

Changed in juju-core:
importance: Critical → High
William Reade (fwereade) on 2012-10-19
Changed in juju-core:
status: In Progress → Fix Released
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers