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

Issue 13523043: state;api: Implement RelationUnitsWatcher in API (Closed)

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

Description

state;api: Implement RelationUnitsWatcher in API This implements the last needed bit in the server-side uniter API: RelationUnitsWatcher. There are a few steps needed before the actual implementation: 1. Move RelationUnitsChange and UnitSettings from state to params. 2. Unexport the concrete state.RelationUnitsWatcher and define a RelationUnitsWatcher as interface, as with the other watchers. 3. Implement state/testing/RelationUnitsWatcherC. Finally, UniterAPI.WatchRelationUnits() as implemented. A few drive-by fixes were done as well: 1. Changed state/testing/watcher.go's gocheck import and imports order to match the other files. 2. Replaced state/relationunit_test.go's local asserts with the statetesting's RelationUnitsWatcherC's ones. 3. Added a test in RelationUnitsWatcherC.AssertChange a check to ensure unit settings versions always increase on a change (we're not checking their exact values in other tests becasue they're volatile; we just check the Changed field of the RelationUnitsChange contains what we expected). In a follow-up, the client-side API RelationUnitsWatcher will be implemented. https://code.launchpad.net/~dimitern/juju-core/119-apiserver-relationunitswatcher/+merge/183856 (do not edit description out of merge proposal)

Patch Set 1 #

Total comments: 4

Patch Set 2 : state;api: Implement RelationUnitsWatcher in API #

Total comments: 4

Patch Set 3 : state;api: Implement RelationUnitsWatcher in API #

Unified diffs Side-by-side diffs Delta from patch set Stats (+420 lines, -262 lines) Patch
A [revision details] View 1 2 1 chunk +2 lines, -0 lines 0 comments Download
M state/api/params/internal.go View 1 chunk +35 lines, -0 lines 0 comments Download
M state/apiserver/uniter/uniter.go View 1 1 chunk +32 lines, -2 lines 0 comments Download
M state/apiserver/uniter/uniter_test.go View 1 1 chunk +74 lines, -0 lines 0 comments Download
M state/relationunit_test.go View 1 2 8 chunks +128 lines, -187 lines 0 comments Download
M state/testing/watcher.go View 1 2 8 chunks +105 lines, -17 lines 0 comments Download
M state/unit.go View 1 chunk +0 lines, -6 lines 0 comments Download
M state/watcher.go View 9 chunks +30 lines, -36 lines 0 comments Download
M worker/uniter/relation/hookqueue.go View 4 chunks +4 lines, -4 lines 0 comments Download
M worker/uniter/relation/hookqueue_test.go View 7 chunks +10 lines, -10 lines 0 comments Download

Messages

Total messages: 5
dimitern
Please take a look.
10 years, 8 months ago (2013-09-04 11:40:48 UTC) #1
fwereade
Missing a test, but LGTM otherwise. TYVM. https://codereview.appspot.com/13523043/diff/1/state/apiserver/uniter/uniter.go File state/apiserver/uniter/uniter.go (right): https://codereview.appspot.com/13523043/diff/1/state/apiserver/uniter/uniter.go#newcode881 state/apiserver/uniter/uniter.go:881: // changes ...
10 years, 8 months ago (2013-09-04 13:30:24 UTC) #2
dimitern
Please take a look. https://codereview.appspot.com/13523043/diff/1/state/apiserver/uniter/uniter.go File state/apiserver/uniter/uniter.go (right): https://codereview.appspot.com/13523043/diff/1/state/apiserver/uniter/uniter.go#newcode881 state/apiserver/uniter/uniter.go:881: // changes to each given ...
10 years, 8 months ago (2013-09-04 15:49:43 UTC) #3
fwereade
I think we can manage a couple of little simplifications -- if they make sense ...
10 years, 8 months ago (2013-09-04 16:12:53 UTC) #4
dimitern
10 years, 8 months ago (2013-09-04 16:46:57 UTC) #5
Please take a look.

https://codereview.appspot.com/13523043/diff/7001/state/settings.go
File state/settings.go (right):

https://codereview.appspot.com/13523043/diff/7001/state/settings.go#newcode108
state/settings.go:108: return params.UnitSettings{c.txnRevno}
On 2013/09/04 16:12:53, fwereade wrote:
> This seems a bit weird to me.

Yeah, it is - I tried to do a bit of transition from using s.Map() in tests to
this, but as you suggested we can just have (changed []string, departed
[]string) and don't care about the settings version.

https://codereview.appspot.com/13523043/diff/7001/state/testing/watcher.go
File state/testing/watcher.go (right):

https://codereview.appspot.com/13523043/diff/7001/state/testing/watcher.go#ne...
state/testing/watcher.go:218: func (c RelationUnitsWatcherC)
AssertChange(changed map[string]params.UnitSettings, departed []string) {
On 2013/09/04 16:12:53, fwereade wrote:
> Shouldn't changed just be an []string now?

Done.
Sign in to reply to this message.

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