Join GitHub today
GitHub is home to over 20 million developers working together to host and review code, manage projects, and build software together.
rpc: introduce ClientConn and ServerConn interfaces #4905
Conversation
davecheney
added some commits
Mar 24, 2016
howbazaar
reviewed
Apr 3, 2016
| @@ -234,7 +235,7 @@ func (a *CallbackMethods) Factorial(x int64val) (int64val, error) { | ||
| return int64val{1}, nil | ||
| } | ||
| var r int64val | ||
| - err := a.root.conn.Call(rpc.Request{"CallbackMethods", 0, "", "Factorial"}, int64val{x.I - 1}, &r) | ||
| + err := a.root.conn.(rpc.ClientConn).Call(rpc.Request{"CallbackMethods", 0, "", "Factorial"}, int64val{x.I - 1}, &r) |
howbazaar
Apr 3, 2016
Owner
Can we please make this two lines?
client := a.root.conn.(rpc.ClientConn)
err := client.Call(...)
|
The diff was much larger than necessary due to the renaming the receiver of 'conn' -> 'c'. However, LGTM with one suggestion. |
That's because |
|
$$merge$$ |
|
Status: merge request accepted. Url: http://juju-ci.vapour.ws:8080/job/github-merge-juju |
jujubot
merged commit da28cfa
into
juju:api-call-retry
Apr 4, 2016
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
davecheney commentedMar 29, 2016
This PR is in preparation for adding tests for retrying temporary RPC errors.
It introduces two new interface types,
rpc.ClientConnandrpc.ServerConnwhose purposes are self explanatory. Also provide constructor functions for these new interface types asNewConnhas been unexported.Remove the ability to provide a RequestNotifier when requesting a ClientConn, this was never used by any non test caller and is only part of the bidirectional code for the rpc package, which is also unused by juju.
Adjust the callers in the
apiandapiserverpackages to these new interfaces, very few changes were needed apart from adjusting the types in various wrapper types.The bidirection nature of the rpc package remains, but if needed the caller must assert their ServerConn value to a ClientConn, or vice versa. No code in Juju does this, but the rpc tests assert this behaviour
Finally, unexport
rpc.Conn.