You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@arrow.apache.org by ze...@apache.org on 2023/01/19 22:40:16 UTC
[arrow] branch master updated: GH-33734: [Go] make compatible with grpc < 1.45 (#33735)
This is an automated email from the ASF dual-hosted git repository.
zeroshade pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/arrow.git
The following commit(s) were added to refs/heads/master by this push:
new 7579dbdd25 GH-33734: [Go] make compatible with grpc < 1.45 (#33735)
7579dbdd25 is described below
commit 7579dbdd25ae44ce47a1402834b1d6c06564b0a0
Author: Chris Chua <ch...@gmail.com>
AuthorDate: Fri Jan 20 06:40:09 2023 +0800
GH-33734: [Go] make compatible with grpc < 1.45 (#33735)
### Rationale for this change
Define interface from grpc/reflection rather than importing. The interface is marked as experiment, so defining it here is also a step toward improving stability of the go arrow library.
### What changes are included in this PR?
* As above, inlining the interface
### Are these changes tested?
I believe the the change is already tested via:
https://github.com/apache/arrow/blob/c8d6110a26c41966e539e9fa2f5cb8c31dc2f0fe/go/arrow/flight/flight_test.go#L325-L326
And also via confirming via reading https://github.com/grpc/grpc-go/blob/4e4d8288ff4fb99150a526165c767e6fac3bd5ec/Documentation/server-reflection-tutorial.md . However, I have not done any manual testing beyond this.
### Are there any user-facing changes?
No.
### Feedback requested
I'd pasted the code verbatim from: https://github.com/grpc/grpc-go/blob/4c776ec01572d55249df309251900554b46adb41/reflection/serverreflection.go#L69-L83
Should I have pasted only what's necessary and link to that code block instead?
Authored-by: chua <ch...@uber.com>
Signed-off-by: Matt Topol <zo...@gmail.com>
---
go/arrow/flight/server.go | 25 ++++++++++++++++++++++---
1 file changed, 22 insertions(+), 3 deletions(-)
diff --git a/go/arrow/flight/server.go b/go/arrow/flight/server.go
index f8902c5b36..8b069f64cb 100644
--- a/go/arrow/flight/server.go
+++ b/go/arrow/flight/server.go
@@ -24,7 +24,6 @@ import (
"github.com/apache/arrow/go/v11/arrow/flight/internal/flight"
"google.golang.org/grpc"
- "google.golang.org/grpc/reflection"
)
type (
@@ -64,6 +63,26 @@ func RegisterFlightServiceServer(s grpc.ServiceRegistrar, srv FlightServer) {
flight.RegisterFlightServiceServer(s, srv)
}
+// From https://github.com/grpc/grpc-go/blob/4c776ec01572d55249df309251900554b46adb41/reflection/serverreflection.go#L69-L83
+// This interface is inlined to make this arrow library compatible with
+// grpc < 1.45 .
+// See "google.golang.org/grpc/reflection" 's reflection.ServiceInfoProvider .
+// serviceInfoProvider is an interface used to retrieve metadata about the
+// services to expose.
+//
+// The reflection service is only interested in the service names, but the
+// signature is this way so that *grpc.Server implements it. So it is okay
+// for a custom implementation to return zero values for the
+// grpc.ServiceInfo values in the map.
+//
+// Experimental
+//
+// Notice: This type is EXPERIMENTAL and may be changed or removed in a
+// later release.
+type serviceInfoProvider interface {
+ GetServiceInfo() map[string]grpc.ServiceInfo
+}
+
// Server is an interface for hiding some of the grpc specifics to make
// it slightly easier to manage a flight service, slightly modeled after
// the C++ implementation
@@ -94,9 +113,9 @@ type Server interface {
// ServiceRegistrar wraps a single method that supports service registration.
// For example, it may be used to register health check provided by grpc-go.
grpc.ServiceRegistrar
- // ServiceInfoProvider is an interface used to retrieve metadata about the services to expose.
+ // serviceInfoProvider is an interface used to retrieve metadata about the services to expose.
// If reflection is enabled on the server, all the endpoints can be invoked using grpcurl.
- reflection.ServiceInfoProvider
+ serviceInfoProvider
}
// BaseFlightServer is the base flight server implementation and must be