service relation lifecycle api
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
juju-core |
Fix Released
|
High
|
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 ServiceRelation
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
- The Go Language Gophers: Pending requested
-
Diff: 333 lines (+193/-59)2 files modifiedstate/service_test.go (+11/-9)
state/watcher.go (+182/-50)
Changed in juju-core: | |
assignee: | nobody → Frank Mueller (themue) |
milestone: | none → 1.2 |
importance: | Undecided → Critical |
description: | updated |
Changed in juju-core: | |
status: | New → In Progress |
Changed in juju-core: | |
milestone: | 1.2 → 2.0 |
milestone: | 2.0 → 1.3 |
Changed in juju-core: | |
milestone: | 1.3 → 1.4 |
Changed in juju-core: | |
status: | In Progress → Fix Released |
ServiceRelation sWatcher exists but is not yet used.