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

Issue 6347045: Watcher consistency improvements

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

Description

Watcher consistency improvements * watcher fields that have no business being fields have been removed * watcher stoppage has been consolidated * handling of inappropriately closed watcher channels has been consolidated * garbage watchers in cmd/jujud are now stopped explicitly * significant code duplication removed from state/watcher.go As a result of the final point, it has become apparent that most of the watchers in the state package are at risk of emitting inappropriate events that don't correspond to real changes. The fact that this is now apparent, when it had previously been missed by every previous reviewer, is IMO a strong indication that this change is a good move. I haven't started to address that issue, however, because the CL is already big enough. https://code.launchpad.net/~fwereade/juju-core/consolidate-content-watchers/+merge/112350 (do not edit description out of merge proposal)

Patch Set 1 #

Patch Set 2 : Watcher consistency improvements #

Patch Set 3 : Watcher consistency improvements #

Patch Set 4 : Watcher consistency improvements #

Total comments: 8

Patch Set 5 : Watcher consistency improvements #

Unified diffs Side-by-side diffs Delta from patch set Stats (+321 lines, -416 lines) Patch
A [revision details] View 1 2 3 4 1 chunk +2 lines, -0 lines 0 comments Download
M cmd/jujud/machine.go View 1 2 3 chunks +5 lines, -9 lines 0 comments Download
M cmd/jujud/provisioning.go View 1 2 3 6 chunks +24 lines, -32 lines 0 comments Download
M state/watcher.go View 1 2 3 4 13 chunks +231 lines, -375 lines 0 comments Download
M state/watcher/watcher.go View 1 2 3 4 1 chunk +26 lines, -0 lines 0 comments Download
M state/watcher/watcher_test.go View 1 2 3 4 2 chunks +33 lines, -0 lines 0 comments Download

Messages

Total messages: 4
fwereade
Please take a look.
11 years, 10 months ago (2012-06-27 13:59:06 UTC) #1
fwereade
Please take a look.
11 years, 10 months ago (2012-06-27 14:45:39 UTC) #2
niemeyer
That's a great refactoring. LGTM with the following covered: https://codereview.appspot.com/6347045/diff/7007/state/watcher.go File state/watcher.go (right): https://codereview.appspot.com/6347045/diff/7007/state/watcher.go#newcode12 state/watcher.go:12: ...
11 years, 10 months ago (2012-06-28 06:11:53 UTC) #3
fwereade
11 years, 10 months ago (2012-06-28 08:29:21 UTC) #4
*** Submitted:

Watcher consistency improvements

* watcher fields that have no business being fields have been removed
* watcher stoppage has been consolidated
* handling of inappropriately closed watcher channels has been consolidated
* garbage watchers in cmd/jujud are now stopped explicitly
* significant code duplication removed from state/watcher.go

As a result of the final point, it has become apparent that most of the
watchers in the state package are at risk of emitting inappropriate events
that don't correspond to real changes. The fact that this is now apparent,
when it had previously been missed by every previous reviewer, is IMO a
strong indication that this change is a good move.

I haven't started to address that issue, however, because the CL is already
big enough.

R=niemeyer
CC=
https://codereview.appspot.com/6347045

https://codereview.appspot.com/6347045/diff/7007/state/watcher.go
File state/watcher.go (right):

https://codereview.appspot.com/6347045/diff/7007/state/watcher.go#newcode12
state/watcher.go:12: type contentWatcher struct {
On 2012/06/28 06:11:53, niemeyer wrote:
> All of the use cases below create this the same way. It's worth defining a
> function IMO:
> 
> func newContentWatcher(st *State, path string) contentWatcher

Done.

https://codereview.appspot.com/6347045/diff/7007/state/watcher/watcher.go
File state/watcher/watcher.go (right):

https://codereview.appspot.com/6347045/diff/7007/state/watcher/watcher.go#new...
state/watcher/watcher.go:11: type Watcher interface {
On 2012/06/28 06:11:53, niemeyer wrote:
> // ErrStopper is implemented by all watchers.
> type ErrStopper interface {

Done.

https://codereview.appspot.com/6347045/diff/7007/state/watcher/watcher.go#new...
state/watcher/watcher.go:16: // Stop is used to terminate a watcher and
propagate errors to the supplied
On 2012/06/28 06:11:53, niemeyer wrote:
> // Stop stops the watcher. If an error is returned by the
> // watcher, t is killed with the error.

Done.

https://codereview.appspot.com/6347045/diff/7007/state/watcher/watcher.go#new...
state/watcher/watcher.go:28: // error and will therefore panic.
On 2012/06/28 06:11:53, niemeyer wrote:
> // MustErr returns the error with which w died.
> // Calling it will panic if w is still running or was stopped cleanly.

Done.
Sign in to reply to this message.

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