Skip to content

Commit

Permalink
client: add interface for ClientConn to be accepted by generated code (
Browse files Browse the repository at this point in the history
  • Loading branch information
dfawley authored Jan 24, 2020
1 parent 1f66bc9 commit 7afcfdd
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
14 changes: 14 additions & 0 deletions clientconn.go
Original file line number Diff line number Diff line change
Expand Up @@ -444,6 +444,20 @@ func (csm *connectivityStateManager) getNotifyChan() <-chan struct{} {
return csm.notifyChan
}

// ClientConnInterface defines the functions clients need to perform unary and
// streaming RPCs. It is implemented by *ClientConn, and is only intended to
// be referenced by generated code.
type ClientConnInterface interface {
// Invoke performs a unary RPC and returns after the response is received
// into reply.
Invoke(ctx context.Context, method string, args interface{}, reply interface{}, opts ...CallOption) error
// NewStream begins a streaming RPC.
NewStream(ctx context.Context, desc *StreamDesc, method string, opts ...CallOption) (ClientStream, error)
}

// Assert *ClientConn implements ClientConnInterface.
var _ ClientConnInterface = (*ClientConn)(nil)

// ClientConn represents a virtual connection to a conceptual endpoint, to
// perform RPCs.
//
Expand Down
3 changes: 2 additions & 1 deletion rpc_util.go
Original file line number Diff line number Diff line change
Expand Up @@ -871,7 +871,7 @@ type channelzData struct {

// The SupportPackageIsVersion variables are referenced from generated protocol
// buffer files to ensure compatibility with the gRPC version used. The latest
// support package version is 5.
// support package version is 6.
//
// Older versions are kept for compatibility. They may be removed if
// compatibility cannot be maintained.
Expand All @@ -881,6 +881,7 @@ const (
SupportPackageIsVersion3 = true
SupportPackageIsVersion4 = true
SupportPackageIsVersion5 = true
SupportPackageIsVersion6 = true
)

const grpcUA = "grpc-go/" + Version

0 comments on commit 7afcfdd

Please sign in to comment.