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

Issue 6494073: mstate: added unit status (Closed)

Can't Edit
Can't Publish+Mail
Start Review
Created:
11 years, 8 months ago by TheMue
Modified:
11 years, 8 months ago
Reviewers:
mp+122500
Visibility:
Public.

Description

mstate: added unit status Added the status methods for Unit in mstate. It relies on AgentAlive() which itself relies on the presence. So currently the alive regarding methods are mocked, the according part in the test for unit state is commented. Both has to be changed with the availability of presence. https://code.launchpad.net/~themue/juju-core/go-mstate-unit-status/+merge/122500 (do not edit description out of merge proposal)

Patch Set 1 #

Patch Set 2 : mstate: added unit status #

Total comments: 10

Patch Set 3 : mstate: added unit status #

Total comments: 14

Patch Set 4 : mstate: added unit status #

Total comments: 4

Patch Set 5 : mstate: added unit status #

Unified diffs Side-by-side diffs Delta from patch set Stats (+230 lines, -17 lines) Patch
A [revision details] View 1 2 3 4 1 chunk +2 lines, -0 lines 0 comments Download
M mstate/open.go View 1 2 3 2 chunks +13 lines, -8 lines 0 comments Download
M mstate/state.go View 1 2 3 4 3 chunks +18 lines, -8 lines 0 comments Download
M mstate/state_test.go View 1 2 3 4 1 chunk +1 line, -1 line 0 comments Download
M mstate/unit.go View 1 2 3 4 5 chunks +118 lines, -0 lines 0 comments Download
M mstate/unit_test.go View 1 2 3 2 chunks +78 lines, -0 lines 0 comments Download

Messages

Total messages: 14
TheMue
Please take a look.
11 years, 8 months ago (2012-09-03 11:58:37 UTC) #1
TheMue
Please take a look.
11 years, 8 months ago (2012-09-03 12:01:56 UTC) #2
aram
https://codereview.appspot.com/6494073/diff/3001/mstate/unit.go File mstate/unit.go (right): https://codereview.appspot.com/6494073/diff/3001/mstate/unit.go#newcode225 mstate/unit.go:225: return true, nil panic("unimplemented") https://codereview.appspot.com/6494073/diff/3001/mstate/unit.go#newcode231 mstate/unit.go:231: return nil panic("unimplemented") ...
11 years, 8 months ago (2012-09-04 12:36:31 UTC) #3
TheMue
Some notes, change to new mstate presence is in progress. https://codereview.appspot.com/6494073/diff/3001/mstate/unit.go File mstate/unit.go (right): https://codereview.appspot.com/6494073/diff/3001/mstate/unit.go#newcode225 ...
11 years, 8 months ago (2012-09-04 13:05:39 UTC) #4
aram
https://codereview.appspot.com/6494073/diff/3001/mstate/unit.go File mstate/unit.go (right): https://codereview.appspot.com/6494073/diff/3001/mstate/unit.go#newcode225 mstate/unit.go:225: return true, nil But the tests have this commented ...
11 years, 8 months ago (2012-09-04 13:10:25 UTC) #5
TheMue
Please take a look.
11 years, 8 months ago (2012-09-04 16:21:19 UTC) #6
niemeyer
Nice to see how well this things are fitting in as we progress. A few ...
11 years, 8 months ago (2012-09-04 19:32:28 UTC) #7
TheMue
Most comments make sense and I will change it tomorrow morning. Only two remarks: 1. ...
11 years, 8 months ago (2012-09-04 19:47:44 UTC) #8
niemeyer
On 2012/09/04 19:47:44, TheMue wrote: > Most comments make sense and I will change it ...
11 years, 8 months ago (2012-09-04 20:13:44 UTC) #9
TheMue
> Isn't that exactly what globalKey gives us? It's up to use to preserve > ...
11 years, 8 months ago (2012-09-04 20:20:57 UTC) #10
niemeyer
On 2012/09/04 20:20:57, TheMue wrote: > > Isn't that exactly what globalKey gives us? It's ...
11 years, 8 months ago (2012-09-04 20:26:56 UTC) #11
TheMue
Please take a look. https://codereview.appspot.com/6494073/diff/6001/mstate/open.go File mstate/open.go (right): https://codereview.appspot.com/6494073/diff/6001/mstate/open.go#newcode33 mstate/open.go:33: agents: presencedb.C("agents"), On 2012/09/04 19:32:29, ...
11 years, 8 months ago (2012-09-05 08:26:19 UTC) #12
niemeyer
LGTM https://codereview.appspot.com/6494073/diff/6001/mstate/unit.go File mstate/unit.go (right): https://codereview.appspot.com/6494073/diff/6001/mstate/unit.go#newcode237 mstate/unit.go:237: for { On 2012/09/05 08:26:20, TheMue wrote: > ...
11 years, 8 months ago (2012-09-05 21:47:05 UTC) #13
TheMue
11 years, 8 months ago (2012-09-06 16:57:01 UTC) #14
*** Submitted:

mstate: added unit status

Added the status methods for Unit in mstate. It relies
on AgentAlive() which itself relies on the presence. So
currently the alive regarding methods are mocked, the
according part in the test for unit state is commented.
Both has to be changed with the availability of
presence.

R=aram, niemeyer
CC=
https://codereview.appspot.com/6494073

https://codereview.appspot.com/6494073/diff/6001/mstate/unit.go
File mstate/unit.go (right):

https://codereview.appspot.com/6494073/diff/6001/mstate/unit.go#newcode237
mstate/unit.go:237: for {
On 2012/09/05 21:47:05, niemeyer wrote:
> On 2012/09/05 08:26:20, TheMue wrote:
> > On 2012/09/04 19:32:29, niemeyer wrote:
> > > There are a few comments here:
> > > 
> > > - We need to observe the Dying of the presence watcher, which
unfortunately
> > > doesn't exist yet.
> > > 
> > > - I don't think we need to loop. If the agent is currently alive, we can
> > return
> > > immediately. If it is not, we can return on the next event.
> > > 
> > > - The above statement is false, and that's a bug in the presence Watcher
> API.
> > > presence.Alive needs to return an error result, which is only set in case
it
> > > needs to unblock due to the fact the watcher is dying. That's the only
> > > circumstance in which it can return a false after a false.
> > > 
> > > Would you mind to fix the first and the third points in a separate CL?
> > 
> > Done. There may be an issue with the timeout as both selects may need e.g.
> > timeout -1ms, so the wait in total would last almost 2 x timeout. But that's
> > only theoretical as I expect the initial change to answer almost
immediately.
> 
> Indeed. You just haven't actually Done neither of the two changes suggested in
> the comment I've made above, but that's fine. This is a fantastic start, and
we
> can sort those out when you return.

Eh, I hope you mean the CL with the watcher dying and the agent error? The break
of the loop into two selects had been done in the following proposal, you've
seen it there.

https://codereview.appspot.com/6494073/diff/3003/mstate/unit.go
File mstate/unit.go (right):

https://codereview.appspot.com/6494073/diff/3003/mstate/unit.go#newcode234
mstate/unit.go:234: // Initial check.
On 2012/09/05 21:47:05, niemeyer wrote:
> There are two tabs at the end of this line which should be trimmed before
> merging.

Done. Interesting, how did you find them? Thought they would be removed with go
fmt. So will take more care in future.

https://codereview.appspot.com/6494073/diff/3003/mstate/unit.go#newcode249
mstate/unit.go:249: panic(fmt.Sprintf("unexpected alive status of unit %q", u))
Also applied your remark of the machine CL here.

https://codereview.appspot.com/6494073/diff/3003/mstate/unit.go#newcode258
mstate/unit.go:258: // started pinger.
Ditto.
Sign in to reply to this message.

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