Browse Source

rpc: collapse Caller and HTTPClient interfaces. (#7548)

These two interfaces are identical, and besides HTTPClient being confusingly
named, all but one location uses Caller. Update that one location, and drop the
redundant interface.
pull/7549/head
M. J. Fromberger 3 years ago
committed by GitHub
parent
commit
8e58c564c0
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 1 additions and 9 deletions
  1. +0
    -8
      rpc/jsonrpc/client/http_json_client.go
  2. +1
    -1
      rpc/jsonrpc/jsonrpc_test.go

+ 0
- 8
rpc/jsonrpc/client/http_json_client.go View File

@ -106,12 +106,6 @@ func (u parsedURL) GetTrimmedURL() string {
//-------------------------------------------------------------
// HTTPClient is a common interface for JSON-RPC HTTP clients.
type HTTPClient interface {
// Call calls the given method with the params and returns a result.
Call(ctx context.Context, method string, params map[string]interface{}, result interface{}) (interface{}, error)
}
// Caller implementers can facilitate calling the JSON-RPC endpoint.
type Caller interface {
Call(ctx context.Context, method string, params map[string]interface{}, result interface{}) (interface{}, error)
@ -134,8 +128,6 @@ type Client struct {
nextReqID int
}
var _ HTTPClient = (*Client)(nil)
// Both Client and RequestBatch can facilitate calls to the JSON
// RPC endpoint.
var _ Caller = (*Client)(nil)


+ 1
- 1
rpc/jsonrpc/jsonrpc_test.go View File

@ -187,7 +187,7 @@ func echoDataBytesViaHTTP(ctx context.Context, cl client.Caller, bytes tmbytes.H
return result.Value, nil
}
func testWithHTTPClient(ctx context.Context, t *testing.T, cl client.HTTPClient) {
func testWithHTTPClient(ctx context.Context, t *testing.T, cl client.Caller) {
val := testVal
got, err := echoViaHTTP(ctx, cl, val)
require.NoError(t, err)


Loading…
Cancel
Save