Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(541)

Issue 7095059: state: service API changes

Can't Edit
Can't Publish+Mail
Start Review
Created:
11 years, 3 months ago by fwereade
Modified:
11 years, 3 months ago
Reviewers:
mp+143394, niemeyer, rog
Visibility:
Public.

Description

state: service API changes Removed: * Service.EnsureDying * Service.EnsureDead * State.RemoveService Added: * Service.Destroy Service.Destroy will remove the service and all its relations, if possible; any that cannot be will be set to Dying. Service removal is now handled via Service.RemoveUnit (which should become Unit.Remove, but this CL is big enough already) and RelationUnit.LeaveScope, each of which will remove any Dying service to which they hold the last reference. In addition to the motivating lp:1089285 (service API), this inevitably addresses lp:1089284 (service removal on LeaveScope) and lp:1100070 (unit removal failure). Reviewers unfamiliar with the details of the existing operations are likely to be best served by reading doc/draft/death-and-destruction.txt, and to compare the implementation against the model described therein, rather than to worry *too* much about the previous implementation. https://code.launchpad.net/~fwereade/juju-core/state-service-api/+merge/143394 (do not edit description out of merge proposal)

Patch Set 1 #

Patch Set 2 : state: service API changes #

Patch Set 3 : state: service API changes #

Patch Set 4 : state: service API changes #

Total comments: 28

Patch Set 5 : state: service API changes #

Total comments: 39

Patch Set 6 : state: service API changes #

Total comments: 12

Patch Set 7 : state: service API changes #

Total comments: 2

Patch Set 8 : state: service API changes #

Patch Set 9 : state: service API changes #

Patch Set 10 : state: service API changes #

Unified diffs Side-by-side diffs Delta from patch set Stats (+474 lines, -388 lines) Patch
A [revision details] View 1 2 3 4 5 6 7 8 9 1 chunk +2 lines, -0 lines 0 comments Download
M doc/draft/death-and-destruction.txt View 1 2 3 4 5 5 chunks +40 lines, -46 lines 0 comments Download
M doc/draft/lifecycles.txt View 1 5 chunks +22 lines, -17 lines 0 comments Download
M state/assign_test.go View 1 2 3 4 5 6 3 chunks +4 lines, -11 lines 0 comments Download
M state/life_test.go View 2 chunks +1 line, -17 lines 0 comments Download
M state/relation.go View 1 2 3 4 5 6 7 8 9 2 chunks +119 lines, -57 lines 0 comments Download
M state/service.go View 1 2 3 4 5 6 7 8 9 6 chunks +166 lines, -92 lines 0 comments Download
M state/service_test.go View 1 2 3 4 5 6 7 10 chunks +93 lines, -74 lines 0 comments Download
M state/state.go View 1 2 3 4 5 6 2 chunks +1 line, -25 lines 0 comments Download
M state/state_test.go View 4 chunks +19 lines, -33 lines 0 comments Download
M worker/firewaller/firewaller_test.go View 3 chunks +5 lines, -14 lines 0 comments Download
M worker/uniter/filter_test.go View 1 chunk +1 line, -1 line 0 comments Download
M worker/uniter/uniter_test.go View 1 chunk +1 line, -1 line 0 comments Download

Messages

Total messages: 20
fwereade
Please take a look.
11 years, 3 months ago (2013-01-15 23:32:38 UTC) #1
dave_cheney.net
Some initial comments, mainly about scoping issues with the err value. https://codereview.appspot.com/7095059/diff/6001/state/relation.go File state/relation.go (right): ...
11 years, 3 months ago (2013-01-16 03:20:25 UTC) #2
fwereade
I'm worried there's something I just Do Not Get about the error scoping complaints... https://codereview.appspot.com/7095059/diff/6001/state/relation.go ...
11 years, 3 months ago (2013-01-16 08:02:05 UTC) #3
fwereade
Please take a look.
11 years, 3 months ago (2013-01-16 09:03:14 UTC) #4
rog
LGTM, although i'm not sure i've grasped the full details of some of the changes. ...
11 years, 3 months ago (2013-01-16 16:17:58 UTC) #5
niemeyer
This is solely reviewing the death-and-destruction doc. Quite amazing coverage, really. Thanks! https://codereview.appspot.com/7095059/diff/12001/doc/draft/death-and-destruction.txt File doc/draft/death-and-destruction.txt ...
11 years, 3 months ago (2013-01-16 23:15:47 UTC) #6
dave_cheney.net
https://codereview.appspot.com/7095059/diff/6001/state/relation.go File state/relation.go (right): https://codereview.appspot.com/7095059/diff/6001/state/relation.go#newcode112 state/relation.go:112: ops, _, err := rel.destroyOps("") Wow. My god that ...
11 years, 3 months ago (2013-01-16 23:30:00 UTC) #7
rog
On 16 January 2013 23:30, <dave@cheney.net> wrote: > > https://codereview.appspot.com/7095059/diff/6001/state/relation.go > File state/relation.go (right): > ...
11 years, 3 months ago (2013-01-17 07:56:06 UTC) #8
dave_cheney.net
That both blew and imploded my brain at the same time. But now I understand ...
11 years, 3 months ago (2013-01-17 08:03:48 UTC) #9
fwereade
Please take a look. https://codereview.appspot.com/7095059/diff/6001/state/relation.go File state/relation.go (right): https://codereview.appspot.com/7095059/diff/6001/state/relation.go#newcode112 state/relation.go:112: ops, _, err := rel.destroyOps("") ...
11 years, 3 months ago (2013-01-17 09:12:20 UTC) #10
rog
LGTM assuming the endpointRemoveOps comment is fixed. https://codereview.appspot.com/7095059/diff/12001/state/relation.go File state/relation.go (right): https://codereview.appspot.com/7095059/diff/12001/state/relation.go#newcode160 state/relation.go:160: type removeMode ...
11 years, 3 months ago (2013-01-17 10:28:07 UTC) #11
niemeyer
Finding the interaction on these op-returning functions a bit tricky to follow. Some suggestions: https://codereview.appspot.com/7095059/diff/6001/state/relation.go ...
11 years, 3 months ago (2013-01-17 13:06:05 UTC) #12
fwereade
removeMode and endpointRemoveOps are clearly the contentious part. I think the code became clearer in ...
11 years, 3 months ago (2013-01-17 14:18:20 UTC) #13
fwereade
Please take a look.
11 years, 3 months ago (2013-01-17 17:16:03 UTC) #14
niemeyer
On service.go: https://codereview.appspot.com/7095059/diff/8002/state/service.go File state/service.go (right): https://codereview.appspot.com/7095059/diff/8002/state/service.go#newcode56 state/service.go:56: // service has any units in scope, ...
11 years, 3 months ago (2013-01-17 17:29:05 UTC) #15
niemeyer
And everything else has been reviewed. Just one minor on tests. I'll just wait for ...
11 years, 3 months ago (2013-01-17 18:14:42 UTC) #16
fwereade
Please take a look. https://codereview.appspot.com/7095059/diff/8002/state/service.go File state/service.go (right): https://codereview.appspot.com/7095059/diff/8002/state/service.go#newcode56 state/service.go:56: // service has any units ...
11 years, 3 months ago (2013-01-17 18:47:16 UTC) #17
fwereade
Please take a look.
11 years, 3 months ago (2013-01-17 19:42:14 UTC) #18
niemeyer
LGTM, thanks for the great work.
11 years, 3 months ago (2013-01-17 19:46:21 UTC) #19
fwereade
11 years, 3 months ago (2013-01-17 19:57:59 UTC) #20
*** Submitted:

state: service API changes

Removed:

  * Service.EnsureDying
  * Service.EnsureDead
  * State.RemoveService

Added:

  * Service.Destroy

Service.Destroy will remove the service and all its relations, if possible;
any that cannot be will be set to Dying. Service removal is now handled via
Service.RemoveUnit (which should become Unit.Remove, but this CL is big
enough already) and RelationUnit.LeaveScope, each of which will remove any
Dying service to which they hold the last reference.

In addition to the motivating lp:1089285 (service API), this inevitably
addresses lp:1089284 (service removal on LeaveScope) and lp:1100070 (unit
removal failure).

Reviewers unfamiliar with the details of the existing operations are likely
to be best served by reading doc/draft/death-and-destruction.txt, and to
compare the implementation against the model described therein, rather than
to worry *too* much about the previous implementation.

R=dfc, rog, niemeyer
CC=
https://codereview.appspot.com/7095059
Sign in to reply to this message.

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b