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

Issue 12990043: state/apiserver: Relation ops for Uniter 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+180321, fwereade, rog
Visibility:
Public.

Description

state/apiserver: Relation ops for Uniter API This adds the Relation() method on the server-side uniter API facade, which returns the id, key and all endpoints of a relation, identified by its tag. Life() also handles relation tags now. One misc call was added - EnvironUUID(). Needed to add state.Relation.Endpoints() call to return all endpoints of a relation, and since they don't change after the relation is created, we can cache them at the API client-side, hence the Relation() method that returns all endpoints. Once we have change the relation tags format from using the numeric IDs to (properly escaped and validated) relation keys, there'll be a follow-up to fix the methods above to use the new format. https://code.launchpad.net/~dimitern/juju-core/105-apiserver-uniter-relation-ops/+merge/180321 (do not edit description out of merge proposal)

Patch Set 1 #

Total comments: 25

Patch Set 2 : state/apiserver: Relation ops for Uniter API #

Total comments: 6

Patch Set 3 : state/apiserver: Relation ops for Uniter API #

Total comments: 6

Patch Set 4 : state/apiserver: Relation ops for Uniter API #

Total comments: 3

Patch Set 5 : state/apiserver: Relation ops for Uniter API #

Total comments: 10
Unified diffs Side-by-side diffs Delta from patch set Stats (+375 lines, -85 lines) Patch
A [revision details] View 1 2 3 4 1 chunk +2 lines, -0 lines 0 comments Download
M state/api/params/internal.go View 1 2 3 4 1 chunk +27 lines, -0 lines 2 comments Download
A state/apiserver/common/common_test.go View 1 2 3 4 1 chunk +115 lines, -0 lines 2 comments Download
M state/apiserver/common/interfaces.go View 1 2 3 1 chunk +18 lines, -0 lines 2 comments Download
M state/apiserver/common/password_test.go View 1 2 3 2 chunks +0 lines, -5 lines 2 comments Download
M state/apiserver/uniter/uniter.go View 1 2 3 4 20 chunks +116 lines, -49 lines 2 comments Download
M state/apiserver/uniter/uniter_test.go View 1 2 3 4 7 chunks +97 lines, -31 lines 0 comments Download

Messages

Total messages: 13
dimitern
Please take a look.
10 years, 8 months ago (2013-08-15 11:43:46 UTC) #1
rog
LGTM modulo some thoughts below. https://codereview.appspot.com/12990043/diff/1/state/api/params/internal.go File state/api/params/internal.go (right): https://codereview.appspot.com/12990043/diff/1/state/api/params/internal.go#newcode88 state/api/params/internal.go:88: Id string Shouldn't this ...
10 years, 8 months ago (2013-08-15 12:28:58 UTC) #2
fwereade
I'm pretty much 100% in agreement with rog, with a few embellishments. https://codereview.appspot.com/12990043/diff/1/state/api/params/internal.go File state/api/params/internal.go ...
10 years, 8 months ago (2013-08-15 15:57:29 UTC) #3
dimitern
Please take a look. https://codereview.appspot.com/12990043/diff/1/state/api/params/internal.go File state/api/params/internal.go (right): https://codereview.appspot.com/12990043/diff/1/state/api/params/internal.go#newcode88 state/api/params/internal.go:88: Id string On 2013/08/15 15:57:29, ...
10 years, 8 months ago (2013-08-15 16:56:56 UTC) #4
rog
A few more possible simplifications below. LGTM with those done. https://codereview.appspot.com/12990043/diff/1/state/apiserver/uniter/uniter.go File state/apiserver/uniter/uniter.go (right): https://codereview.appspot.com/12990043/diff/1/state/apiserver/uniter/uniter.go#newcode60 ...
10 years, 8 months ago (2013-08-15 17:19:09 UTC) #5
dimitern
Please take a look. https://codereview.appspot.com/12990043/diff/10001/state/apiserver/uniter/uniter.go File state/apiserver/uniter/uniter.go (right): https://codereview.appspot.com/12990043/diff/10001/state/apiserver/uniter/uniter.go#newcode601 state/apiserver/uniter/uniter.go:601: r.Endpoints[j] = stateEndpointToParams(relEp) On 2013/08/15 ...
10 years, 8 months ago (2013-08-15 18:06:37 UTC) #6
rog
LGTM with some considerations below, thanks! https://codereview.appspot.com/12990043/diff/20001/state/apiserver/common/interfaces.go File state/apiserver/common/interfaces.go (right): https://codereview.appspot.com/12990043/diff/20001/state/apiserver/common/interfaces.go#newcode50 state/apiserver/common/interfaces.go:50: func Either(a, b ...
10 years, 8 months ago (2013-08-15 19:00:37 UTC) #7
dimitern
Please take a look. https://codereview.appspot.com/12990043/diff/20001/state/apiserver/common/interfaces.go File state/apiserver/common/interfaces.go (right): https://codereview.appspot.com/12990043/diff/20001/state/apiserver/common/interfaces.go#newcode50 state/apiserver/common/interfaces.go:50: func Either(a, b func() (AuthFunc, ...
10 years, 8 months ago (2013-08-16 07:59:42 UTC) #8
rog
LGTM with one trivial below. Thanks very much! https://codereview.appspot.com/12990043/diff/26001/state/apiserver/common/common_test.go File state/apiserver/common/common_test.go (right): https://codereview.appspot.com/12990043/diff/26001/state/apiserver/common/common_test.go#newcode23 state/apiserver/common/common_test.go:23: var ...
10 years, 8 months ago (2013-08-16 08:13:30 UTC) #9
rog
https://codereview.appspot.com/12990043/diff/26001/state/apiserver/uniter/uniter.go File state/apiserver/uniter/uniter.go (right): https://codereview.appspot.com/12990043/diff/26001/state/apiserver/uniter/uniter.go#newcode579 state/apiserver/uniter/uniter.go:579: params.Endpoint{ You don't need to specify the type name ...
10 years, 8 months ago (2013-08-16 08:23:22 UTC) #10
dimitern
Please take a look. https://codereview.appspot.com/12990043/diff/26001/state/apiserver/uniter/uniter.go File state/apiserver/uniter/uniter.go (right): https://codereview.appspot.com/12990043/diff/26001/state/apiserver/uniter/uniter.go#newcode579 state/apiserver/uniter/uniter.go:579: params.Endpoint{ On 2013/08/16 08:23:23, rog ...
10 years, 8 months ago (2013-08-16 08:51:33 UTC) #11
fwereade
LGTM, just a couple of things to ponder. Nothing critical for this CL, I expect ...
10 years, 8 months ago (2013-08-16 09:38:07 UTC) #12
dimitern
10 years, 8 months ago (2013-08-16 10:32:14 UTC) #13
Message was sent while issue was closed.
Thanks for the review! Here are my answers - some of the suggestions will be
implemented in the follow-up branch.

https://codereview.appspot.com/12990043/diff/37001/state/api/params/internal.go
File state/api/params/internal.go (right):

https://codereview.appspot.com/12990043/diff/37001/state/api/params/internal....
state/api/params/internal.go:85: type Relation struct {
On 2013/08/16 09:38:07, fwereade wrote:
> This name seems slightly odd; can we maybe think of something better?
> 
> Or, *possibly*, would it make sense to always infer the appropriate unit from
> the connected entity? It's probably a bad idea in some way, because I feel a
bit
> weird about it, but my brain keeps bringing it up.

I'd advise against this, because it's a precedent. Why should we do this here
and not in every other call? We always have a connected entity, so if we decide
we're going to assume we're only returning results for the authenticated entity
(unit, machine, etc.) then the whole idea of bulk operations is moot: we'll
always return results only for one entity, and most calls won't even need an
argument.

Otherwise, I'm open to suggestions for a better name.

https://codereview.appspot.com/12990043/diff/37001/state/apiserver/common/com...
File state/apiserver/common/common_test.go (right):

https://codereview.appspot.com/12990043/diff/37001/state/apiserver/common/com...
state/apiserver/common/common_test.go:46: {
On 2013/08/16 09:38:07, fwereade wrote:
> }{{
>     ...
> }, {
>     ...
> }}
> 
> saves both horizontal and vertical space and IMO doesn't lose readability...

Done in the follow-up.

https://codereview.appspot.com/12990043/diff/37001/state/apiserver/common/int...
File state/apiserver/common/interfaces.go (right):

https://codereview.appspot.com/12990043/diff/37001/state/apiserver/common/int...
state/apiserver/common/interfaces.go:50: func AuthEither(a, b func() (AuthFunc,
error)) func() (AuthFunc, error) {
On 2013/08/16 09:38:07, fwereade wrote:
> I think `func() (AuthFunc, error)` has a name already -- possibly a
GetAuthFunc?

Done in the follow-up branch.

https://codereview.appspot.com/12990043/diff/37001/state/apiserver/common/pas...
File state/apiserver/common/password_test.go (left):

https://codereview.appspot.com/12990043/diff/37001/state/apiserver/common/pas...
state/apiserver/common/password_test.go:23: }
On 2013/08/16 09:38:07, fwereade wrote:
> gaah, this stuff is crazy -- were we running all these tests twice? I'm
> pondering mandating a standard "package_test.go" file that just holds these
> bits...

Standardizing this across the code is a big +1.
And no, we weren't running the tests twice - this was just here, and now I moved
it to common_test.go.

https://codereview.appspot.com/12990043/diff/37001/state/apiserver/uniter/uni...
File state/apiserver/uniter/uniter.go (right):

https://codereview.appspot.com/12990043/diff/37001/state/apiserver/uniter/uni...
state/apiserver/uniter/uniter.go:604: // EnvironUUID returns the UUID for the
current juju environment.
On 2013/08/16 09:38:07, fwereade wrote:
> CurrentEnvironUUID

Done in the follow-up branch.
Sign in to reply to this message.

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