Skip to content

Commit 7579dbd

Browse files
authored
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 <[email protected]> Signed-off-by: Matt Topol <[email protected]>
1 parent f744bab commit 7579dbd

1 file changed

Lines changed: 22 additions & 3 deletions

File tree

‎go/arrow/flight/server.go‎

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ import (
2424

2525
"github.com/apache/arrow/go/v11/arrow/flight/internal/flight"
2626
"google.golang.org/grpc"
27-
"google.golang.org/grpc/reflection"
2827
)
2928

3029
type (
@@ -64,6 +63,26 @@ func RegisterFlightServiceServer(s grpc.ServiceRegistrar, srv FlightServer) {
6463
flight.RegisterFlightServiceServer(s, srv)
6564
}
6665

66+
// From https://github.com/grpc/grpc-go/blob/4c776ec01572d55249df309251900554b46adb41/reflection/serverreflection.go#L69-L83
67+
// This interface is inlined to make this arrow library compatible with
68+
// grpc < 1.45 .
69+
// See "google.golang.org/grpc/reflection" 's reflection.ServiceInfoProvider .
70+
// serviceInfoProvider is an interface used to retrieve metadata about the
71+
// services to expose.
72+
//
73+
// The reflection service is only interested in the service names, but the
74+
// signature is this way so that *grpc.Server implements it. So it is okay
75+
// for a custom implementation to return zero values for the
76+
// grpc.ServiceInfo values in the map.
77+
//
78+
// Experimental
79+
//
80+
// Notice: This type is EXPERIMENTAL and may be changed or removed in a
81+
// later release.
82+
type serviceInfoProvider interface {
83+
GetServiceInfo() map[string]grpc.ServiceInfo
84+
}
85+
6786
// Server is an interface for hiding some of the grpc specifics to make
6887
// it slightly easier to manage a flight service, slightly modeled after
6988
// the C++ implementation
@@ -94,9 +113,9 @@ type Server interface {
94113
// ServiceRegistrar wraps a single method that supports service registration.
95114
// For example, it may be used to register health check provided by grpc-go.
96115
grpc.ServiceRegistrar
97-
// ServiceInfoProvider is an interface used to retrieve metadata about the services to expose.
116+
// serviceInfoProvider is an interface used to retrieve metadata about the services to expose.
98117
// If reflection is enabled on the server, all the endpoints can be invoked using grpcurl.
99-
reflection.ServiceInfoProvider
118+
serviceInfoProvider
100119
}
101120

102121
// BaseFlightServer is the base flight server implementation and must be

0 commit comments

Comments
 (0)