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

Issue 6811091: state: simplify entity watchers

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

Description

state: simplify entity watchers As long agreed but never implemented, service and unit watchers now just report the fact of a change but elide the details. Settings changes are not fixed in this fashion: that'll be a bit more complicated and there's no pressing need. https://code.launchpad.net/~fwereade/juju-core/drop-unwanted-watcher-entities/+merge/133280 (do not edit description out of merge proposal)

Patch Set 1 #

Total comments: 22

Patch Set 2 : state: simplify entity watchers #

Unified diffs Side-by-side diffs Delta from patch set Stats (+127 lines, -130 lines) Patch
A [revision details] View 1 1 chunk +2 lines, -0 lines 0 comments Download
M state/service_test.go View 1 2 chunks +12 lines, -8 lines 0 comments Download
M state/unit_test.go View 1 2 chunks +12 lines, -8 lines 0 comments Download
M state/watcher.go View 1 9 chunks +67 lines, -94 lines 0 comments Download
M worker/firewaller/firewaller.go View 1 6 chunks +20 lines, -18 lines 0 comments Download
M worker/uniter/filter.go View 4 chunks +14 lines, -2 lines 0 comments Download

Messages

Total messages: 5
fwereade
Please take a look.
11 years, 5 months ago (2012-11-07 15:36:51 UTC) #1
dave_cheney.net
https://codereview.appspot.com/6811091/diff/1/state/service_test.go File state/service_test.go (right): https://codereview.appspot.com/6811091/diff/1/state/service_test.go#newcode978 state/service_test.go:978: err = s.service.Refresh() err := this is a new ...
11 years, 5 months ago (2012-11-07 23:44:40 UTC) #2
rog
LGTM with minor remarks below https://codereview.appspot.com/6811091/diff/1/state/watcher.go File state/watcher.go (right): https://codereview.appspot.com/6811091/diff/1/state/watcher.go#newcode1070 state/watcher.go:1070: func (w *UnitWatcher) Changes() ...
11 years, 5 months ago (2012-11-09 10:48:58 UTC) #3
niemeyer
LGTM https://codereview.appspot.com/6811091/diff/1/state/service_test.go File state/service_test.go (right): https://codereview.appspot.com/6811091/diff/1/state/service_test.go#newcode978 state/service_test.go:978: err = s.service.Refresh() On 2012/11/07 23:44:41, dfc wrote: ...
11 years, 5 months ago (2012-11-14 16:56:14 UTC) #4
fwereade
11 years, 5 months ago (2012-11-19 09:07:20 UTC) #5
*** Submitted:

state: simplify entity watchers

As long agreed but never implemented, service and unit watchers now just
report the fact of a change but elide the details.

Settings changes are not fixed in this fashion: that'll be a bit more
complicated and there's no pressing need.

R=dfc, rog, niemeyer
CC=
https://codereview.appspot.com/6811091

https://codereview.appspot.com/6811091/diff/1/state/service_test.go
File state/service_test.go (right):

https://codereview.appspot.com/6811091/diff/1/state/service_test.go#newcode978
state/service_test.go:978: err = s.service.Refresh()
On 2012/11/14 16:56:15, niemeyer wrote:
> On 2012/11/07 23:44:41, dfc wrote:
> > err :=
> > 
> > this is a new block
> 
> FWIW, I don't think we've been strict about this elsewhere, and I'm not sure
if
> there's any benefit in being in this case.

I'm fine changing it if it improves the reading experience :).

https://codereview.appspot.com/6811091/diff/1/state/service_test.go#newcode996
state/service_test.go:996: err = s.service.Refresh()
On 2012/11/07 23:44:41, dfc wrote:
> ditto

Done.

https://codereview.appspot.com/6811091/diff/1/state/unit_test.go
File state/unit_test.go (right):

https://codereview.appspot.com/6811091/diff/1/state/unit_test.go#newcode481
state/unit_test.go:481: err = s.unit.Refresh()
On 2012/11/07 23:44:41, dfc wrote:
> err :=

Done.

https://codereview.appspot.com/6811091/diff/1/state/unit_test.go#newcode499
state/unit_test.go:499: err = s.unit.Refresh()
On 2012/11/07 23:44:41, dfc wrote:
> ditto

Done.

https://codereview.appspot.com/6811091/diff/1/state/watcher.go
File state/watcher.go (right):

https://codereview.appspot.com/6811091/diff/1/state/watcher.go#newcode1070
state/watcher.go:1070: func (w *UnitWatcher) Changes() <-chan string {
On 2012/11/14 16:56:15, niemeyer wrote:
> // Changes returns the event channel for the UnitWatcher.
> 
> That's equivalent to the other watchers. If we want to detail the behavior of
> the watcher, let's please do that in the type doc.

Done.

https://codereview.appspot.com/6811091/diff/1/state/watcher.go#newcode1151
state/watcher.go:1151: 
On 2012/11/14 16:56:15, niemeyer wrote:
> +1; ideally moves and changes happen in different CLs.
> 
> I'm assuming this has not changed.

Nothing changed; I'll try to be religious about the separation henceforth.

https://codereview.appspot.com/6811091/diff/1/worker/firewaller/firewaller.go
File worker/firewaller/firewaller.go (right):

https://codereview.appspot.com/6811091/diff/1/worker/firewaller/firewaller.go...
worker/firewaller/firewaller.go:546: ports = append([]state.Port(nil),
change...)
On 2012/11/09 10:48:58, rog wrote:
> s/[]state.Port(nil)/ports[:0]/
> 
> no need for unnecessary allocation AFAICS.

Done.

https://codereview.appspot.com/6811091/diff/1/worker/firewaller/firewaller.go...
worker/firewaller/firewaller.go:600: go sd.watchLoop(sd.exposed)
On 2012/11/09 10:48:58, rog wrote:
> perhaps we could consider using the pattern that's becoming prevalent
elsewhere
> - make watchLoop return an error, and kill the tomb with that error. this
means
> the tomb.Kill lines below can just return the error.

I'm not sure the pattern quite fits here -- we don't always kill on the way out
of that method.
Sign in to reply to this message.

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