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

Issue 12461043: apiserver/common: DeadEnsurer + Machiner use it (Closed)

Can't Edit
Can't Publish+Mail
Start Review
Created:
10 years, 9 months ago by dimitern
Modified:
10 years, 9 months ago
Reviewers:
gz, mp+178545, rog
Visibility:
Public.

Description

apiserver/common: DeadEnsurer + Machiner use it Next step of extracing common API code, used by the machiner and will be used by the uniter. This introduces DeadEnsurer for entities with EnsureDead method. https://code.launchpad.net/~dimitern/juju-core/089-api-ensuredeader/+merge/178545 Requires: https://code.launchpad.net/~dimitern/juju-core/088-api-statussetter/+merge/178529 (do not edit description out of merge proposal)

Patch Set 1 #

Patch Set 2 : apiserver/common: DeadEnsurer + Machiner use it #

Total comments: 6

Patch Set 3 : apiserver/common: DeadEnsurer + Machiner use it #

Unified diffs Side-by-side diffs Delta from patch set Stats (+206 lines, -37 lines) Patch
A [revision details] View 1 2 1 chunk +2 lines, -0 lines 0 comments Download
A state/apiserver/common/ensuredead.go View 1 2 1 chunk +66 lines, -0 lines 0 comments Download
A state/apiserver/common/ensuredead_test.go View 1 2 1 chunk +107 lines, -0 lines 0 comments Download
M state/apiserver/common/remove.go View 2 chunks +4 lines, -4 lines 0 comments Download
M state/apiserver/common/setstatus_test.go View 1 1 chunk +4 lines, -4 lines 0 comments Download
M state/apiserver/machine/machiner.go View 3 chunks +2 lines, -27 lines 0 comments Download
M state/state.go View 2 chunks +21 lines, -2 lines 0 comments Download

Messages

Total messages: 5
dimitern
Please take a look.
10 years, 9 months ago (2013-08-05 12:37:14 UTC) #1
rog
On 2013/08/05 12:37:14, dimitern wrote: > Please take a look. LGTM
10 years, 9 months ago (2013-08-05 14:52:04 UTC) #2
dimitern
Please take a look.
10 years, 9 months ago (2013-08-05 14:56:44 UTC) #3
gz
LGTM. https://codereview.appspot.com/12461043/diff/5001/state/apiserver/common/ensuredead.go File state/apiserver/common/ensuredead.go (right): https://codereview.appspot.com/12461043/diff/5001/state/apiserver/common/ensuredead.go#newcode18 state/apiserver/common/ensuredead.go:18: type DeadEnsurerer interface { This is absurd. :) ...
10 years, 9 months ago (2013-08-05 15:57:44 UTC) #4
dimitern
10 years, 9 months ago (2013-08-05 16:20:27 UTC) #5
Please take a look.

https://codereview.appspot.com/12461043/diff/5001/state/apiserver/common/ensu...
File state/apiserver/common/ensuredead.go (right):

https://codereview.appspot.com/12461043/diff/5001/state/apiserver/common/ensu...
state/apiserver/common/ensuredead.go:18: type DeadEnsurerer interface {
On 2013/08/05 15:57:44, gz wrote:
> This is absurd. :)

It is! We can change it later, if suggestions for better names arise.

https://codereview.appspot.com/12461043/diff/5001/state/apiserver/common/ensu...
state/apiserver/common/ensuredead.go:45: // will fail if the entity is not
present, of if it's not Alive or
On 2013/08/05 15:57:44, gz wrote:
> *or if it's not Dead?
> 
> I also find the circular nature of all of this confusing...
> DeadEnsurer.EnsureDead() calls DeadEnsurer.ensureEntityDead() with each
entity's
> tag, which calls DeadEnsurer.EnsureDead() with no arguments on a different
> deadEnsurer constructed with that tag...

I'll fix the comment. It actually won't fail if the entity is alive, it just
won't do anything - that's how EnsureDead works.

It is confusing, but it's also not easy to have mockable generic types, like an
"entity" which has EnsureDead and not bringing up the entire state package just
for that.

https://codereview.appspot.com/12461043/diff/5001/state/apiserver/common/ensu...
File state/apiserver/common/ensuredead_test.go (right):

https://codereview.appspot.com/12461043/diff/5001/state/apiserver/common/ensu...
state/apiserver/common/ensuredead_test.go:42: panic("not needed")
On 2013/08/05 15:57:44, gz wrote:
> I prefer errors that will make sense if the test code ever incorrectly reaches
> them (though panics are somewhat painful regardless), eg "fakeDeadEnsurer.Tag
> should not be called" or similar.

I'll change the message.
Sign in to reply to this message.

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