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

Issue 9937045: state/apiserver: Implement Machiner.Watch (Closed)

Can't Edit
Can't Publish+Mail
Start Review
Created:
10 years, 10 months ago by dimitern
Modified:
10 years, 10 months ago
Reviewers:
mp+167573, jameinel, thumper, fwereade, Danilo, rog
Visibility:
Public.

Description

state/apiserver: Implement Machiner.Watch This implements the last API call needed by the machiner worker - Machiner.Watch, at server-side. Client-side implementation will follow up. https://code.launchpad.net/~dimitern/juju-core/057-api-machiner-watch/+merge/167573 Requires: https://code.launchpad.net/~dimitern/juju-core/056-api-machiner-client-subpackage/+merge/167489 (do not edit description out of merge proposal)

Patch Set 1 #

Total comments: 11

Patch Set 2 : state/apiserver: Implement Machiner.Watch #

Total comments: 12

Patch Set 3 : state/apiserver: Implement Machiner.Watch #

Total comments: 12

Patch Set 4 : state/apiserver: Implement Machiner.Watch #

Total comments: 1
Unified diffs Side-by-side diffs Delta from patch set Stats (+111 lines, -29 lines) Patch
A [revision details] View 1 2 3 1 chunk +2 lines, -0 lines 0 comments Download
M state/api/params/params.go View 1 chunk +11 lines, -0 lines 0 comments Download
M state/apiserver/client.go View 1 chunk +1 line, -1 line 0 comments Download
M state/apiserver/common/interfaces.go View 1 2 3 1 chunk +17 lines, -0 lines 0 comments Download
M state/apiserver/machiner/machiner.go View 1 2 2 chunks +27 lines, -7 lines 0 comments Download
M state/apiserver/machiner/machiner_test.go View 1 2 8 chunks +46 lines, -10 lines 1 comment Download
M state/apiserver/resource.go View 4 chunks +6 lines, -10 lines 0 comments Download
M state/apiserver/root.go View 1 2 1 chunk +1 line, -1 line 0 comments Download

Messages

Total messages: 11
dimitern
Please take a look.
10 years, 10 months ago (2013-06-05 15:43:57 UTC) #1
thumper
https://codereview.appspot.com/9937045/diff/1/state/apiserver/machiner/machiner.go File state/apiserver/machiner/machiner.go (right): https://codereview.appspot.com/9937045/diff/1/state/apiserver/machiner/machiner.go#newcode54 state/apiserver/machiner/machiner.go:54: return result, nil While I don't have a problem ...
10 years, 10 months ago (2013-06-06 04:32:43 UTC) #2
dimitern
Please take a look. https://codereview.appspot.com/9937045/diff/1/state/apiserver/machiner/machiner.go File state/apiserver/machiner/machiner.go (right): https://codereview.appspot.com/9937045/diff/1/state/apiserver/machiner/machiner.go#newcode54 state/apiserver/machiner/machiner.go:54: return result, nil On 2013/06/06 ...
10 years, 10 months ago (2013-06-06 10:01:26 UTC) #3
jameinel
https://codereview.appspot.com/9937045/diff/1/state/apiserver/machiner/machiner_test.go File state/apiserver/machiner/machiner_test.go (right): https://codereview.appspot.com/9937045/diff/1/state/apiserver/machiner/machiner_test.go#newcode52 state/apiserver/machiner/machiner_test.go:52: func (frr fakeResourceRegistry) Register(resource common.Resource) string { On 2013/06/06 ...
10 years, 10 months ago (2013-06-06 11:13:59 UTC) #4
fwereade
Looks sane, just one quibble. https://codereview.appspot.com/9937045/diff/6001/state/apiserver/machiner/machiner.go File state/apiserver/machiner/machiner.go (right): https://codereview.appspot.com/9937045/diff/6001/state/apiserver/machiner/machiner.go#newcode65 state/apiserver/machiner/machiner.go:65: // for initial changes. ...
10 years, 10 months ago (2013-06-06 17:04:38 UTC) #5
dimitern
Please take a look. https://codereview.appspot.com/9937045/diff/6001/state/apiserver/machiner/machiner.go File state/apiserver/machiner/machiner.go (right): https://codereview.appspot.com/9937045/diff/6001/state/apiserver/machiner/machiner.go#newcode65 state/apiserver/machiner/machiner.go:65: // for initial changes. On ...
10 years, 10 months ago (2013-06-07 11:47:54 UTC) #6
Danilo
Hey Dimiter: this generally LGTM. I have a bunch of stylistic comments, but nothing that ...
10 years, 10 months ago (2013-06-07 12:37:37 UTC) #7
dimitern
I'm sorry that's a case of a merge gone wrong! I'll strip the bits that ...
10 years, 10 months ago (2013-06-07 12:42:58 UTC) #8
rog
oops some comments i hadn't got around to publishing, sorry (plus one more recent one) ...
10 years, 10 months ago (2013-06-07 13:04:36 UTC) #9
dimitern
Please take a look. https://codereview.appspot.com/9937045/diff/6001/state/apiserver/common/interfaces.go File state/apiserver/common/interfaces.go (right): https://codereview.appspot.com/9937045/diff/6001/state/apiserver/common/interfaces.go#newcode19 state/apiserver/common/interfaces.go:19: // Resource represents the interface ...
10 years, 10 months ago (2013-06-07 13:56:37 UTC) #10
fwereade
10 years, 10 months ago (2013-06-07 14:07:03 UTC) #11
Coming along very nicely, code looks solid, but I'd like to see direct tests
that the returned watcher id is valid and works properly in Next calls.

https://codereview.appspot.com/9937045/diff/1/state/apiserver/machiner/machin...
File state/apiserver/machiner/machiner.go (right):

https://codereview.appspot.com/9937045/diff/1/state/apiserver/machiner/machin...
state/apiserver/machiner/machiner.go:66: if _, ok := <-watcher.Changes(); !ok {
On 2013/06/07 13:04:37, rog wrote:
> On 2013/06/06 10:01:26, dimitern wrote:
> > On 2013/06/06 04:32:43, thumper wrote:
> > > Do we really want to discard the initial changes?
> > 
> > This is more to check if the channel is sending changes, and since the
> > EntityWatcher returns empty structs we don't lose any information I think.
> > Anyway, this is how Roger originally implemented it, maybe he can answer
> better.
> 
> as dimiter says, there is no information in the initial change to lose.
> if there was some information, we'd return it with the initial Watch request.

OK, so all client watchers can be expected to send an event on in response to
the first Watch call, which will hold any data (like initial-members lists) from
the underlying watcher's initial event? As long as we follow some clear
convention, I'm happy; that one SGTM. Sorry i hadn't picked up on it.

https://codereview.appspot.com/9937045/diff/21001/state/apiserver/machiner/ma...
File state/apiserver/machiner/machiner_test.go (right):

https://codereview.appspot.com/9937045/diff/21001/state/apiserver/machiner/ma...
state/apiserver/machiner/machiner_test.go:224: // Just verify the resource was
registered and stop it.
Do we have direct tests for the results of Next() calls passing in the returned
watcher id? Feels like pretty important behaviour to unit test...
Sign in to reply to this message.

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