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

Issue 92410043: rpc: support a Version field

Can't Edit
Can't Publish+Mail
Start Review
Created:
9 years, 12 months ago by jameinel
Modified:
9 years, 11 months ago
Reviewers:
dimitern, mp+219653, fwereade
Visibility:
Public.

Description

rpc: support a Version field This adds support for a Version field in RPC requests, and changes the MethodCaller interface for how and when it looks up objects. Most of the MethodCaller changes were already reviewed in: https://code.launchpad.net/~jameinel/juju-core/reflect-only-facades/+merge/218764 There are only a couple of tweaks because the lookup is now done with a real Version instead of overriding the "id" field. This also uses the registry.TypedNameVersion code in a sample registry that shows one possible way that we can do a Registry with versioned lookups. Note that the next steps don't actually make use of rpc/registry/* so I'm willing to pull it out, or put it in as a test-suite only thing. Alternatively it might be something tha could fit into documentation/example sort of code. This does disable one test that assumed you could statically iterate over all the types and exposed methods. I introduce a similar function later on once we have the factories registered. One thing that was brought up before about always unfolding Interface(), I didn't do that yet, but I still could if we feel it would be more straightforward. https://code.launchpad.net/~jameinel/juju-core/api-rpc-reflect-version/+merge/219653 Requires: https://code.launchpad.net/~jameinel/juju-core/typed-registry/+merge/219161 (do not edit description out of merge proposal)

Patch Set 1 #

Total comments: 11

Patch Set 2 : rpc: support a Version field #

Total comments: 6

Patch Set 3 : rpc: support a Version field #

Unified diffs Side-by-side diffs Delta from patch set Stats (+647 lines, -135 lines) Patch
A [revision details] View 1 2 1 chunk +2 lines, -0 lines 0 comments Download
M rpc/jsoncodec/codec.go View 4 chunks +7 lines, -3 lines 0 comments Download
M rpc/reflect_test.go View 1 2 4 chunks +47 lines, -19 lines 0 comments Download
A rpc/registry/package_test.go View 1 chunk +14 lines, -0 lines 0 comments Download
A rpc/registry/registry.go View 1 2 1 chunk +71 lines, -0 lines 0 comments Download
A rpc/registry/registry_test.go View 1 1 chunk +96 lines, -0 lines 0 comments Download
M rpc/rpc_test.go View 1 2 25 chunks +266 lines, -47 lines 0 comments Download
M rpc/rpcreflect/type.go View 2 chunks +13 lines, -6 lines 0 comments Download
M rpc/rpcreflect/value.go View 3 chunks +44 lines, -19 lines 0 comments Download
M rpc/server.go View 1 2 8 chunks +60 lines, -14 lines 0 comments Download
M state/apiserver/root_test.go View 1 2 2 chunks +20 lines, -18 lines 0 comments Download
M utils/registry/registry.go View 1 2 4 chunks +6 lines, -8 lines 0 comments Download
M utils/registry/registry_test.go View 1 2 1 chunk +1 line, -1 line 0 comments Download

Messages

Total messages: 5
jameinel
Please take a look.
9 years, 12 months ago (2014-05-15 08:18:54 UTC) #1
fwereade
LGTM https://codereview.appspot.com/92410043/diff/1/rpc/reflect_test.go File rpc/reflect_test.go (right): https://codereview.appspot.com/92410043/diff/1/rpc/reflect_test.go#newcode58 rpc/reflect_test.go:58: // Is this worth specifying? I still think ...
9 years, 12 months ago (2014-05-16 09:05:28 UTC) #2
jameinel
Please take a look. https://codereview.appspot.com/92410043/diff/1/rpc/reflect_test.go File rpc/reflect_test.go (right): https://codereview.appspot.com/92410043/diff/1/rpc/reflect_test.go#newcode58 rpc/reflect_test.go:58: // Is this worth specifying? ...
9 years, 12 months ago (2014-05-16 10:43:39 UTC) #3
dimitern
Few comments for clarification, otherwise looks great! https://codereview.appspot.com/92410043/diff/20001/rpc/registry/registry.go File rpc/registry/registry.go (right): https://codereview.appspot.com/92410043/diff/20001/rpc/registry/registry.go#newcode20 rpc/registry/registry.go:20: func (r ...
9 years, 11 months ago (2014-05-19 09:33:06 UTC) #4
jameinel
9 years, 11 months ago (2014-05-22 11:42:14 UTC) #5
Please take a look.

https://codereview.appspot.com/92410043/diff/20001/rpc/registry/registry.go
File rpc/registry/registry.go (right):

https://codereview.appspot.com/92410043/diff/20001/rpc/registry/registry.go#n...
rpc/registry/registry.go:20: func (r *RootFromRegistry) Register(name string,
version int, f Factory) {
On 2014/05/19 09:33:06, dimitern wrote:
> Doc comment? Also, is panicking here a good idea? 

So this is example code, but panic() in stuff that happens during init() is fine
with me. Because then it panics early and not just end up with things that
aren't actually registered.

https://codereview.appspot.com/92410043/diff/20001/rpc/registry/registry.go#n...
rpc/registry/registry.go:45: //	objId: facadeVersion (will be translated from a
string into an int)
On 2014/05/19 09:33:06, dimitern wrote:
> This comment is a bit confusing - we have version int and objId string - is
only
> the latter used for versioning?

Just out of date docstrings. It was added when we were using objId for
versioning, but now we have the actual Version field. I updated the comments.

https://codereview.appspot.com/92410043/diff/20001/rpc/server.go
File rpc/server.go (right):

https://codereview.appspot.com/92410043/diff/20001/rpc/server.go#newcode344
rpc/server.go:344: // version, id, methodName) triplet.
On 2014/05/19 09:33:06, dimitern wrote:
> It's a quadruplet now actually :)

Done.
Sign in to reply to this message.

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