diff --git a/cmd/protoc-gen-go-grpc/testdata/golden_grpc.pb.go b/cmd/protoc-gen-go-grpc/testdata/golden_grpc.pb.go index cd023087a2c..f9beebacd04 100644 --- a/cmd/protoc-gen-go-grpc/testdata/golden_grpc.pb.go +++ b/cmd/protoc-gen-go-grpc/testdata/golden_grpc.pb.go @@ -29,8 +29,8 @@ import ( // This is a compile-time assertion to ensure that this generated file // is compatible with the grpc package it is being compiled against. -// Requires gRPC-Go v1.62.0 or later. -const _ = grpc.SupportPackageIsVersion8 +// Requires gRPC-Go v1.64.0 or later. +const _ = grpc.SupportPackageIsVersion9 const ( BidirectionalStreamingService_UnaryMethod_FullMethodName = "/main.BidirectionalStreamingService/unaryMethod" @@ -73,34 +73,11 @@ func (c *bidirectionalStreamingServiceClient) ClientMethod(ctx context.Context, if err != nil { return nil, err } - x := &bidirectionalStreamingServiceClientMethodClient{ClientStream: stream} + x := &grpc.StreamClientImpl[EventRequest, EventResponse]{ClientStream: stream} return x, nil } -type BidirectionalStreamingService_ClientMethodClient interface { - Send(*EventRequest) error - CloseAndRecv() (*EventResponse, error) - grpc.ClientStream -} - -type bidirectionalStreamingServiceClientMethodClient struct { - grpc.ClientStream -} - -func (x *bidirectionalStreamingServiceClientMethodClient) Send(m *EventRequest) error { - return x.ClientStream.SendMsg(m) -} - -func (x *bidirectionalStreamingServiceClientMethodClient) CloseAndRecv() (*EventResponse, error) { - if err := x.ClientStream.CloseSend(); err != nil { - return nil, err - } - m := new(EventResponse) - if err := x.ClientStream.RecvMsg(m); err != nil { - return nil, err - } - return m, nil -} +type BidirectionalStreamingService_ClientMethodClient = grpc.ClientStreamClient[EventRequest, EventResponse] func (c *bidirectionalStreamingServiceClient) ServerMethod(ctx context.Context, in *EventRequest, opts ...grpc.CallOption) (BidirectionalStreamingService_ServerMethodClient, error) { cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) @@ -108,7 +85,7 @@ func (c *bidirectionalStreamingServiceClient) ServerMethod(ctx context.Context, if err != nil { return nil, err } - x := &bidirectionalStreamingServiceServerMethodClient{ClientStream: stream} + x := &grpc.StreamClientImpl[EventRequest, EventResponse]{ClientStream: stream} if err := x.ClientStream.SendMsg(in); err != nil { return nil, err } @@ -118,22 +95,7 @@ func (c *bidirectionalStreamingServiceClient) ServerMethod(ctx context.Context, return x, nil } -type BidirectionalStreamingService_ServerMethodClient interface { - Recv() (*EventResponse, error) - grpc.ClientStream -} - -type bidirectionalStreamingServiceServerMethodClient struct { - grpc.ClientStream -} - -func (x *bidirectionalStreamingServiceServerMethodClient) Recv() (*EventResponse, error) { - m := new(EventResponse) - if err := x.ClientStream.RecvMsg(m); err != nil { - return nil, err - } - return m, nil -} +type BidirectionalStreamingService_ServerMethodClient = grpc.ServerStreamClient[EventResponse] func (c *bidirectionalStreamingServiceClient) BidirectionalMethod(ctx context.Context, opts ...grpc.CallOption) (BidirectionalStreamingService_BidirectionalMethodClient, error) { cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) @@ -141,31 +103,11 @@ func (c *bidirectionalStreamingServiceClient) BidirectionalMethod(ctx context.Co if err != nil { return nil, err } - x := &bidirectionalStreamingServiceBidirectionalMethodClient{ClientStream: stream} + x := &grpc.StreamClientImpl[EventRequest, EventResponse]{ClientStream: stream} return x, nil } -type BidirectionalStreamingService_BidirectionalMethodClient interface { - Send(*EventRequest) error - Recv() (*EventResponse, error) - grpc.ClientStream -} - -type bidirectionalStreamingServiceBidirectionalMethodClient struct { - grpc.ClientStream -} - -func (x *bidirectionalStreamingServiceBidirectionalMethodClient) Send(m *EventRequest) error { - return x.ClientStream.SendMsg(m) -} - -func (x *bidirectionalStreamingServiceBidirectionalMethodClient) Recv() (*EventResponse, error) { - m := new(EventResponse) - if err := x.ClientStream.RecvMsg(m); err != nil { - return nil, err - } - return m, nil -} +type BidirectionalStreamingService_BidirectionalMethodClient = grpc.BidiStreamClient[EventRequest, EventResponse] // BidirectionalStreamingServiceServer is the server API for BidirectionalStreamingService service. // All implementations must embed UnimplementedBidirectionalStreamingServiceServer @@ -227,77 +169,26 @@ func _BidirectionalStreamingService_UnaryMethod_Handler(srv interface{}, ctx con } func _BidirectionalStreamingService_ClientMethod_Handler(srv interface{}, stream grpc.ServerStream) error { - return srv.(BidirectionalStreamingServiceServer).ClientMethod(&bidirectionalStreamingServiceClientMethodServer{ServerStream: stream}) -} - -type BidirectionalStreamingService_ClientMethodServer interface { - SendAndClose(*EventResponse) error - Recv() (*EventRequest, error) - grpc.ServerStream + return srv.(BidirectionalStreamingServiceServer).ClientMethod(&grpc.StreamServerImpl[EventRequest, EventResponse]{ServerStream: stream}) } -type bidirectionalStreamingServiceClientMethodServer struct { - grpc.ServerStream -} - -func (x *bidirectionalStreamingServiceClientMethodServer) SendAndClose(m *EventResponse) error { - return x.ServerStream.SendMsg(m) -} - -func (x *bidirectionalStreamingServiceClientMethodServer) Recv() (*EventRequest, error) { - m := new(EventRequest) - if err := x.ServerStream.RecvMsg(m); err != nil { - return nil, err - } - return m, nil -} +type BidirectionalStreamingService_ClientMethodServer = grpc.ClientStreamServer[EventRequest, EventResponse] func _BidirectionalStreamingService_ServerMethod_Handler(srv interface{}, stream grpc.ServerStream) error { m := new(EventRequest) if err := stream.RecvMsg(m); err != nil { return err } - return srv.(BidirectionalStreamingServiceServer).ServerMethod(m, &bidirectionalStreamingServiceServerMethodServer{ServerStream: stream}) -} - -type BidirectionalStreamingService_ServerMethodServer interface { - Send(*EventResponse) error - grpc.ServerStream + return srv.(BidirectionalStreamingServiceServer).ServerMethod(m, &grpc.StreamServerImpl[EventRequest, EventResponse]{ServerStream: stream}) } -type bidirectionalStreamingServiceServerMethodServer struct { - grpc.ServerStream -} - -func (x *bidirectionalStreamingServiceServerMethodServer) Send(m *EventResponse) error { - return x.ServerStream.SendMsg(m) -} +type BidirectionalStreamingService_ServerMethodServer = grpc.ServerStreamServer[EventResponse] func _BidirectionalStreamingService_BidirectionalMethod_Handler(srv interface{}, stream grpc.ServerStream) error { - return srv.(BidirectionalStreamingServiceServer).BidirectionalMethod(&bidirectionalStreamingServiceBidirectionalMethodServer{ServerStream: stream}) -} - -type BidirectionalStreamingService_BidirectionalMethodServer interface { - Send(*EventResponse) error - Recv() (*EventRequest, error) - grpc.ServerStream -} - -type bidirectionalStreamingServiceBidirectionalMethodServer struct { - grpc.ServerStream + return srv.(BidirectionalStreamingServiceServer).BidirectionalMethod(&grpc.StreamServerImpl[EventRequest, EventResponse]{ServerStream: stream}) } -func (x *bidirectionalStreamingServiceBidirectionalMethodServer) Send(m *EventResponse) error { - return x.ServerStream.SendMsg(m) -} - -func (x *bidirectionalStreamingServiceBidirectionalMethodServer) Recv() (*EventRequest, error) { - m := new(EventRequest) - if err := x.ServerStream.RecvMsg(m); err != nil { - return nil, err - } - return m, nil -} +type BidirectionalStreamingService_BidirectionalMethodServer = grpc.BidiStreamServer[EventRequest, EventResponse] // BidirectionalStreamingService_ServiceDesc is the grpc.ServiceDesc for BidirectionalStreamingService service. // It's only intended for direct use with grpc.RegisterService, diff --git a/credentials/alts/internal/proto/grpc_gcp/handshaker_grpc.pb.go b/credentials/alts/internal/proto/grpc_gcp/handshaker_grpc.pb.go index c8e1e8f0396..0916052cb4f 100644 --- a/credentials/alts/internal/proto/grpc_gcp/handshaker_grpc.pb.go +++ b/credentials/alts/internal/proto/grpc_gcp/handshaker_grpc.pb.go @@ -32,8 +32,8 @@ import ( // This is a compile-time assertion to ensure that this generated file // is compatible with the grpc package it is being compiled against. -// Requires gRPC-Go v1.62.0 or later. -const _ = grpc.SupportPackageIsVersion8 +// Requires gRPC-Go v1.64.0 or later. +const _ = grpc.SupportPackageIsVersion9 const ( HandshakerService_DoHandshake_FullMethodName = "/grpc.gcp.HandshakerService/DoHandshake" @@ -66,31 +66,11 @@ func (c *handshakerServiceClient) DoHandshake(ctx context.Context, opts ...grpc. if err != nil { return nil, err } - x := &handshakerServiceDoHandshakeClient{ClientStream: stream} + x := &grpc.StreamClientImpl[HandshakerReq, HandshakerResp]{ClientStream: stream} return x, nil } -type HandshakerService_DoHandshakeClient interface { - Send(*HandshakerReq) error - Recv() (*HandshakerResp, error) - grpc.ClientStream -} - -type handshakerServiceDoHandshakeClient struct { - grpc.ClientStream -} - -func (x *handshakerServiceDoHandshakeClient) Send(m *HandshakerReq) error { - return x.ClientStream.SendMsg(m) -} - -func (x *handshakerServiceDoHandshakeClient) Recv() (*HandshakerResp, error) { - m := new(HandshakerResp) - if err := x.ClientStream.RecvMsg(m); err != nil { - return nil, err - } - return m, nil -} +type HandshakerService_DoHandshakeClient = grpc.BidiStreamClient[HandshakerReq, HandshakerResp] // HandshakerServiceServer is the server API for HandshakerService service. // All implementations must embed UnimplementedHandshakerServiceServer @@ -127,30 +107,10 @@ func RegisterHandshakerServiceServer(s grpc.ServiceRegistrar, srv HandshakerServ } func _HandshakerService_DoHandshake_Handler(srv interface{}, stream grpc.ServerStream) error { - return srv.(HandshakerServiceServer).DoHandshake(&handshakerServiceDoHandshakeServer{ServerStream: stream}) + return srv.(HandshakerServiceServer).DoHandshake(&grpc.StreamServerImpl[HandshakerReq, HandshakerResp]{ServerStream: stream}) } -type HandshakerService_DoHandshakeServer interface { - Send(*HandshakerResp) error - Recv() (*HandshakerReq, error) - grpc.ServerStream -} - -type handshakerServiceDoHandshakeServer struct { - grpc.ServerStream -} - -func (x *handshakerServiceDoHandshakeServer) Send(m *HandshakerResp) error { - return x.ServerStream.SendMsg(m) -} - -func (x *handshakerServiceDoHandshakeServer) Recv() (*HandshakerReq, error) { - m := new(HandshakerReq) - if err := x.ServerStream.RecvMsg(m); err != nil { - return nil, err - } - return m, nil -} +type HandshakerService_DoHandshakeServer = grpc.BidiStreamServer[HandshakerReq, HandshakerResp] // HandshakerService_ServiceDesc is the grpc.ServiceDesc for HandshakerService service. // It's only intended for direct use with grpc.RegisterService, diff --git a/examples/features/proto/echo/echo_grpc.pb.go b/examples/features/proto/echo/echo_grpc.pb.go index d7b56c72726..2cc4baf8ce9 100644 --- a/examples/features/proto/echo/echo_grpc.pb.go +++ b/examples/features/proto/echo/echo_grpc.pb.go @@ -32,8 +32,8 @@ import ( // This is a compile-time assertion to ensure that this generated file // is compatible with the grpc package it is being compiled against. -// Requires gRPC-Go v1.62.0 or later. -const _ = grpc.SupportPackageIsVersion8 +// Requires gRPC-Go v1.64.0 or later. +const _ = grpc.SupportPackageIsVersion9 const ( Echo_UnaryEcho_FullMethodName = "/grpc.examples.echo.Echo/UnaryEcho" @@ -80,7 +80,7 @@ func (c *echoClient) ServerStreamingEcho(ctx context.Context, in *EchoRequest, o if err != nil { return nil, err } - x := &echoServerStreamingEchoClient{ClientStream: stream} + x := &grpc.StreamClientImpl[EchoRequest, EchoResponse]{ClientStream: stream} if err := x.ClientStream.SendMsg(in); err != nil { return nil, err } @@ -90,22 +90,7 @@ func (c *echoClient) ServerStreamingEcho(ctx context.Context, in *EchoRequest, o return x, nil } -type Echo_ServerStreamingEchoClient interface { - Recv() (*EchoResponse, error) - grpc.ClientStream -} - -type echoServerStreamingEchoClient struct { - grpc.ClientStream -} - -func (x *echoServerStreamingEchoClient) Recv() (*EchoResponse, error) { - m := new(EchoResponse) - if err := x.ClientStream.RecvMsg(m); err != nil { - return nil, err - } - return m, nil -} +type Echo_ServerStreamingEchoClient = grpc.ServerStreamClient[EchoResponse] func (c *echoClient) ClientStreamingEcho(ctx context.Context, opts ...grpc.CallOption) (Echo_ClientStreamingEchoClient, error) { cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) @@ -113,34 +98,11 @@ func (c *echoClient) ClientStreamingEcho(ctx context.Context, opts ...grpc.CallO if err != nil { return nil, err } - x := &echoClientStreamingEchoClient{ClientStream: stream} + x := &grpc.StreamClientImpl[EchoRequest, EchoResponse]{ClientStream: stream} return x, nil } -type Echo_ClientStreamingEchoClient interface { - Send(*EchoRequest) error - CloseAndRecv() (*EchoResponse, error) - grpc.ClientStream -} - -type echoClientStreamingEchoClient struct { - grpc.ClientStream -} - -func (x *echoClientStreamingEchoClient) Send(m *EchoRequest) error { - return x.ClientStream.SendMsg(m) -} - -func (x *echoClientStreamingEchoClient) CloseAndRecv() (*EchoResponse, error) { - if err := x.ClientStream.CloseSend(); err != nil { - return nil, err - } - m := new(EchoResponse) - if err := x.ClientStream.RecvMsg(m); err != nil { - return nil, err - } - return m, nil -} +type Echo_ClientStreamingEchoClient = grpc.ClientStreamClient[EchoRequest, EchoResponse] func (c *echoClient) BidirectionalStreamingEcho(ctx context.Context, opts ...grpc.CallOption) (Echo_BidirectionalStreamingEchoClient, error) { cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) @@ -148,31 +110,11 @@ func (c *echoClient) BidirectionalStreamingEcho(ctx context.Context, opts ...grp if err != nil { return nil, err } - x := &echoBidirectionalStreamingEchoClient{ClientStream: stream} + x := &grpc.StreamClientImpl[EchoRequest, EchoResponse]{ClientStream: stream} return x, nil } -type Echo_BidirectionalStreamingEchoClient interface { - Send(*EchoRequest) error - Recv() (*EchoResponse, error) - grpc.ClientStream -} - -type echoBidirectionalStreamingEchoClient struct { - grpc.ClientStream -} - -func (x *echoBidirectionalStreamingEchoClient) Send(m *EchoRequest) error { - return x.ClientStream.SendMsg(m) -} - -func (x *echoBidirectionalStreamingEchoClient) Recv() (*EchoResponse, error) { - m := new(EchoResponse) - if err := x.ClientStream.RecvMsg(m); err != nil { - return nil, err - } - return m, nil -} +type Echo_BidirectionalStreamingEchoClient = grpc.BidiStreamClient[EchoRequest, EchoResponse] // EchoServer is the server API for Echo service. // All implementations must embed UnimplementedEchoServer @@ -241,73 +183,22 @@ func _Echo_ServerStreamingEcho_Handler(srv interface{}, stream grpc.ServerStream if err := stream.RecvMsg(m); err != nil { return err } - return srv.(EchoServer).ServerStreamingEcho(m, &echoServerStreamingEchoServer{ServerStream: stream}) -} - -type Echo_ServerStreamingEchoServer interface { - Send(*EchoResponse) error - grpc.ServerStream + return srv.(EchoServer).ServerStreamingEcho(m, &grpc.StreamServerImpl[EchoRequest, EchoResponse]{ServerStream: stream}) } -type echoServerStreamingEchoServer struct { - grpc.ServerStream -} - -func (x *echoServerStreamingEchoServer) Send(m *EchoResponse) error { - return x.ServerStream.SendMsg(m) -} +type Echo_ServerStreamingEchoServer = grpc.ServerStreamServer[EchoResponse] func _Echo_ClientStreamingEcho_Handler(srv interface{}, stream grpc.ServerStream) error { - return srv.(EchoServer).ClientStreamingEcho(&echoClientStreamingEchoServer{ServerStream: stream}) + return srv.(EchoServer).ClientStreamingEcho(&grpc.StreamServerImpl[EchoRequest, EchoResponse]{ServerStream: stream}) } -type Echo_ClientStreamingEchoServer interface { - SendAndClose(*EchoResponse) error - Recv() (*EchoRequest, error) - grpc.ServerStream -} - -type echoClientStreamingEchoServer struct { - grpc.ServerStream -} - -func (x *echoClientStreamingEchoServer) SendAndClose(m *EchoResponse) error { - return x.ServerStream.SendMsg(m) -} - -func (x *echoClientStreamingEchoServer) Recv() (*EchoRequest, error) { - m := new(EchoRequest) - if err := x.ServerStream.RecvMsg(m); err != nil { - return nil, err - } - return m, nil -} +type Echo_ClientStreamingEchoServer = grpc.ClientStreamServer[EchoRequest, EchoResponse] func _Echo_BidirectionalStreamingEcho_Handler(srv interface{}, stream grpc.ServerStream) error { - return srv.(EchoServer).BidirectionalStreamingEcho(&echoBidirectionalStreamingEchoServer{ServerStream: stream}) -} - -type Echo_BidirectionalStreamingEchoServer interface { - Send(*EchoResponse) error - Recv() (*EchoRequest, error) - grpc.ServerStream -} - -type echoBidirectionalStreamingEchoServer struct { - grpc.ServerStream + return srv.(EchoServer).BidirectionalStreamingEcho(&grpc.StreamServerImpl[EchoRequest, EchoResponse]{ServerStream: stream}) } -func (x *echoBidirectionalStreamingEchoServer) Send(m *EchoResponse) error { - return x.ServerStream.SendMsg(m) -} - -func (x *echoBidirectionalStreamingEchoServer) Recv() (*EchoRequest, error) { - m := new(EchoRequest) - if err := x.ServerStream.RecvMsg(m); err != nil { - return nil, err - } - return m, nil -} +type Echo_BidirectionalStreamingEchoServer = grpc.BidiStreamServer[EchoRequest, EchoResponse] // Echo_ServiceDesc is the grpc.ServiceDesc for Echo service. // It's only intended for direct use with grpc.RegisterService, diff --git a/examples/helloworld/helloworld/helloworld_grpc.pb.go b/examples/helloworld/helloworld/helloworld_grpc.pb.go index 092bf0eedec..2583cb42dab 100644 --- a/examples/helloworld/helloworld/helloworld_grpc.pb.go +++ b/examples/helloworld/helloworld/helloworld_grpc.pb.go @@ -29,8 +29,8 @@ import ( // This is a compile-time assertion to ensure that this generated file // is compatible with the grpc package it is being compiled against. -// Requires gRPC-Go v1.62.0 or later. -const _ = grpc.SupportPackageIsVersion8 +// Requires gRPC-Go v1.64.0 or later. +const _ = grpc.SupportPackageIsVersion9 const ( Greeter_SayHello_FullMethodName = "/helloworld.Greeter/SayHello" diff --git a/internal/proto/grpc_lookup_v1/rls_grpc.pb.go b/internal/proto/grpc_lookup_v1/rls_grpc.pb.go index b9823b35c95..3ce28f68e0e 100644 --- a/internal/proto/grpc_lookup_v1/rls_grpc.pb.go +++ b/internal/proto/grpc_lookup_v1/rls_grpc.pb.go @@ -29,8 +29,8 @@ import ( // This is a compile-time assertion to ensure that this generated file // is compatible with the grpc package it is being compiled against. -// Requires gRPC-Go v1.62.0 or later. -const _ = grpc.SupportPackageIsVersion8 +// Requires gRPC-Go v1.64.0 or later. +const _ = grpc.SupportPackageIsVersion9 const ( RouteLookupService_RouteLookup_FullMethodName = "/grpc.lookup.v1.RouteLookupService/RouteLookup" diff --git a/interop/grpc_testing/benchmark_service_grpc.pb.go b/interop/grpc_testing/benchmark_service_grpc.pb.go index e91fe4fdd77..1248e1735ae 100644 --- a/interop/grpc_testing/benchmark_service_grpc.pb.go +++ b/interop/grpc_testing/benchmark_service_grpc.pb.go @@ -32,8 +32,8 @@ import ( // This is a compile-time assertion to ensure that this generated file // is compatible with the grpc package it is being compiled against. -// Requires gRPC-Go v1.62.0 or later. -const _ = grpc.SupportPackageIsVersion8 +// Requires gRPC-Go v1.64.0 or later. +const _ = grpc.SupportPackageIsVersion9 const ( BenchmarkService_UnaryCall_FullMethodName = "/grpc.testing.BenchmarkService/UnaryCall" @@ -89,31 +89,11 @@ func (c *benchmarkServiceClient) StreamingCall(ctx context.Context, opts ...grpc if err != nil { return nil, err } - x := &benchmarkServiceStreamingCallClient{ClientStream: stream} + x := &grpc.StreamClientImpl[SimpleRequest, SimpleResponse]{ClientStream: stream} return x, nil } -type BenchmarkService_StreamingCallClient interface { - Send(*SimpleRequest) error - Recv() (*SimpleResponse, error) - grpc.ClientStream -} - -type benchmarkServiceStreamingCallClient struct { - grpc.ClientStream -} - -func (x *benchmarkServiceStreamingCallClient) Send(m *SimpleRequest) error { - return x.ClientStream.SendMsg(m) -} - -func (x *benchmarkServiceStreamingCallClient) Recv() (*SimpleResponse, error) { - m := new(SimpleResponse) - if err := x.ClientStream.RecvMsg(m); err != nil { - return nil, err - } - return m, nil -} +type BenchmarkService_StreamingCallClient = grpc.BidiStreamClient[SimpleRequest, SimpleResponse] func (c *benchmarkServiceClient) StreamingFromClient(ctx context.Context, opts ...grpc.CallOption) (BenchmarkService_StreamingFromClientClient, error) { cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) @@ -121,34 +101,11 @@ func (c *benchmarkServiceClient) StreamingFromClient(ctx context.Context, opts . if err != nil { return nil, err } - x := &benchmarkServiceStreamingFromClientClient{ClientStream: stream} + x := &grpc.StreamClientImpl[SimpleRequest, SimpleResponse]{ClientStream: stream} return x, nil } -type BenchmarkService_StreamingFromClientClient interface { - Send(*SimpleRequest) error - CloseAndRecv() (*SimpleResponse, error) - grpc.ClientStream -} - -type benchmarkServiceStreamingFromClientClient struct { - grpc.ClientStream -} - -func (x *benchmarkServiceStreamingFromClientClient) Send(m *SimpleRequest) error { - return x.ClientStream.SendMsg(m) -} - -func (x *benchmarkServiceStreamingFromClientClient) CloseAndRecv() (*SimpleResponse, error) { - if err := x.ClientStream.CloseSend(); err != nil { - return nil, err - } - m := new(SimpleResponse) - if err := x.ClientStream.RecvMsg(m); err != nil { - return nil, err - } - return m, nil -} +type BenchmarkService_StreamingFromClientClient = grpc.ClientStreamClient[SimpleRequest, SimpleResponse] func (c *benchmarkServiceClient) StreamingFromServer(ctx context.Context, in *SimpleRequest, opts ...grpc.CallOption) (BenchmarkService_StreamingFromServerClient, error) { cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) @@ -156,7 +113,7 @@ func (c *benchmarkServiceClient) StreamingFromServer(ctx context.Context, in *Si if err != nil { return nil, err } - x := &benchmarkServiceStreamingFromServerClient{ClientStream: stream} + x := &grpc.StreamClientImpl[SimpleRequest, SimpleResponse]{ClientStream: stream} if err := x.ClientStream.SendMsg(in); err != nil { return nil, err } @@ -166,22 +123,7 @@ func (c *benchmarkServiceClient) StreamingFromServer(ctx context.Context, in *Si return x, nil } -type BenchmarkService_StreamingFromServerClient interface { - Recv() (*SimpleResponse, error) - grpc.ClientStream -} - -type benchmarkServiceStreamingFromServerClient struct { - grpc.ClientStream -} - -func (x *benchmarkServiceStreamingFromServerClient) Recv() (*SimpleResponse, error) { - m := new(SimpleResponse) - if err := x.ClientStream.RecvMsg(m); err != nil { - return nil, err - } - return m, nil -} +type BenchmarkService_StreamingFromServerClient = grpc.ServerStreamClient[SimpleResponse] func (c *benchmarkServiceClient) StreamingBothWays(ctx context.Context, opts ...grpc.CallOption) (BenchmarkService_StreamingBothWaysClient, error) { cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) @@ -189,31 +131,11 @@ func (c *benchmarkServiceClient) StreamingBothWays(ctx context.Context, opts ... if err != nil { return nil, err } - x := &benchmarkServiceStreamingBothWaysClient{ClientStream: stream} + x := &grpc.StreamClientImpl[SimpleRequest, SimpleResponse]{ClientStream: stream} return x, nil } -type BenchmarkService_StreamingBothWaysClient interface { - Send(*SimpleRequest) error - Recv() (*SimpleResponse, error) - grpc.ClientStream -} - -type benchmarkServiceStreamingBothWaysClient struct { - grpc.ClientStream -} - -func (x *benchmarkServiceStreamingBothWaysClient) Send(m *SimpleRequest) error { - return x.ClientStream.SendMsg(m) -} - -func (x *benchmarkServiceStreamingBothWaysClient) Recv() (*SimpleResponse, error) { - m := new(SimpleResponse) - if err := x.ClientStream.RecvMsg(m); err != nil { - return nil, err - } - return m, nil -} +type BenchmarkService_StreamingBothWaysClient = grpc.BidiStreamClient[SimpleRequest, SimpleResponse] // BenchmarkServiceServer is the server API for BenchmarkService service. // All implementations must embed UnimplementedBenchmarkServiceServer @@ -289,103 +211,32 @@ func _BenchmarkService_UnaryCall_Handler(srv interface{}, ctx context.Context, d } func _BenchmarkService_StreamingCall_Handler(srv interface{}, stream grpc.ServerStream) error { - return srv.(BenchmarkServiceServer).StreamingCall(&benchmarkServiceStreamingCallServer{ServerStream: stream}) -} - -type BenchmarkService_StreamingCallServer interface { - Send(*SimpleResponse) error - Recv() (*SimpleRequest, error) - grpc.ServerStream -} - -type benchmarkServiceStreamingCallServer struct { - grpc.ServerStream + return srv.(BenchmarkServiceServer).StreamingCall(&grpc.StreamServerImpl[SimpleRequest, SimpleResponse]{ServerStream: stream}) } -func (x *benchmarkServiceStreamingCallServer) Send(m *SimpleResponse) error { - return x.ServerStream.SendMsg(m) -} - -func (x *benchmarkServiceStreamingCallServer) Recv() (*SimpleRequest, error) { - m := new(SimpleRequest) - if err := x.ServerStream.RecvMsg(m); err != nil { - return nil, err - } - return m, nil -} +type BenchmarkService_StreamingCallServer = grpc.BidiStreamServer[SimpleRequest, SimpleResponse] func _BenchmarkService_StreamingFromClient_Handler(srv interface{}, stream grpc.ServerStream) error { - return srv.(BenchmarkServiceServer).StreamingFromClient(&benchmarkServiceStreamingFromClientServer{ServerStream: stream}) + return srv.(BenchmarkServiceServer).StreamingFromClient(&grpc.StreamServerImpl[SimpleRequest, SimpleResponse]{ServerStream: stream}) } -type BenchmarkService_StreamingFromClientServer interface { - SendAndClose(*SimpleResponse) error - Recv() (*SimpleRequest, error) - grpc.ServerStream -} - -type benchmarkServiceStreamingFromClientServer struct { - grpc.ServerStream -} - -func (x *benchmarkServiceStreamingFromClientServer) SendAndClose(m *SimpleResponse) error { - return x.ServerStream.SendMsg(m) -} - -func (x *benchmarkServiceStreamingFromClientServer) Recv() (*SimpleRequest, error) { - m := new(SimpleRequest) - if err := x.ServerStream.RecvMsg(m); err != nil { - return nil, err - } - return m, nil -} +type BenchmarkService_StreamingFromClientServer = grpc.ClientStreamServer[SimpleRequest, SimpleResponse] func _BenchmarkService_StreamingFromServer_Handler(srv interface{}, stream grpc.ServerStream) error { m := new(SimpleRequest) if err := stream.RecvMsg(m); err != nil { return err } - return srv.(BenchmarkServiceServer).StreamingFromServer(m, &benchmarkServiceStreamingFromServerServer{ServerStream: stream}) + return srv.(BenchmarkServiceServer).StreamingFromServer(m, &grpc.StreamServerImpl[SimpleRequest, SimpleResponse]{ServerStream: stream}) } -type BenchmarkService_StreamingFromServerServer interface { - Send(*SimpleResponse) error - grpc.ServerStream -} - -type benchmarkServiceStreamingFromServerServer struct { - grpc.ServerStream -} - -func (x *benchmarkServiceStreamingFromServerServer) Send(m *SimpleResponse) error { - return x.ServerStream.SendMsg(m) -} +type BenchmarkService_StreamingFromServerServer = grpc.ServerStreamServer[SimpleResponse] func _BenchmarkService_StreamingBothWays_Handler(srv interface{}, stream grpc.ServerStream) error { - return srv.(BenchmarkServiceServer).StreamingBothWays(&benchmarkServiceStreamingBothWaysServer{ServerStream: stream}) -} - -type BenchmarkService_StreamingBothWaysServer interface { - Send(*SimpleResponse) error - Recv() (*SimpleRequest, error) - grpc.ServerStream -} - -type benchmarkServiceStreamingBothWaysServer struct { - grpc.ServerStream -} - -func (x *benchmarkServiceStreamingBothWaysServer) Send(m *SimpleResponse) error { - return x.ServerStream.SendMsg(m) + return srv.(BenchmarkServiceServer).StreamingBothWays(&grpc.StreamServerImpl[SimpleRequest, SimpleResponse]{ServerStream: stream}) } -func (x *benchmarkServiceStreamingBothWaysServer) Recv() (*SimpleRequest, error) { - m := new(SimpleRequest) - if err := x.ServerStream.RecvMsg(m); err != nil { - return nil, err - } - return m, nil -} +type BenchmarkService_StreamingBothWaysServer = grpc.BidiStreamServer[SimpleRequest, SimpleResponse] // BenchmarkService_ServiceDesc is the grpc.ServiceDesc for BenchmarkService service. // It's only intended for direct use with grpc.RegisterService, diff --git a/interop/grpc_testing/report_qps_scenario_service_grpc.pb.go b/interop/grpc_testing/report_qps_scenario_service_grpc.pb.go index bda87e942c3..dabdf9ffaae 100644 --- a/interop/grpc_testing/report_qps_scenario_service_grpc.pb.go +++ b/interop/grpc_testing/report_qps_scenario_service_grpc.pb.go @@ -32,8 +32,8 @@ import ( // This is a compile-time assertion to ensure that this generated file // is compatible with the grpc package it is being compiled against. -// Requires gRPC-Go v1.62.0 or later. -const _ = grpc.SupportPackageIsVersion8 +// Requires gRPC-Go v1.64.0 or later. +const _ = grpc.SupportPackageIsVersion9 const ( ReportQpsScenarioService_ReportScenario_FullMethodName = "/grpc.testing.ReportQpsScenarioService/ReportScenario" diff --git a/interop/grpc_testing/test_grpc.pb.go b/interop/grpc_testing/test_grpc.pb.go index d8f8545c98b..7a7455a72ae 100644 --- a/interop/grpc_testing/test_grpc.pb.go +++ b/interop/grpc_testing/test_grpc.pb.go @@ -32,8 +32,8 @@ import ( // This is a compile-time assertion to ensure that this generated file // is compatible with the grpc package it is being compiled against. -// Requires gRPC-Go v1.62.0 or later. -const _ = grpc.SupportPackageIsVersion8 +// Requires gRPC-Go v1.64.0 or later. +const _ = grpc.SupportPackageIsVersion9 const ( TestService_EmptyCall_FullMethodName = "/grpc.testing.TestService/EmptyCall" @@ -122,7 +122,7 @@ func (c *testServiceClient) StreamingOutputCall(ctx context.Context, in *Streami if err != nil { return nil, err } - x := &testServiceStreamingOutputCallClient{ClientStream: stream} + x := &grpc.StreamClientImpl[StreamingOutputCallRequest, StreamingOutputCallResponse]{ClientStream: stream} if err := x.ClientStream.SendMsg(in); err != nil { return nil, err } @@ -132,22 +132,7 @@ func (c *testServiceClient) StreamingOutputCall(ctx context.Context, in *Streami return x, nil } -type TestService_StreamingOutputCallClient interface { - Recv() (*StreamingOutputCallResponse, error) - grpc.ClientStream -} - -type testServiceStreamingOutputCallClient struct { - grpc.ClientStream -} - -func (x *testServiceStreamingOutputCallClient) Recv() (*StreamingOutputCallResponse, error) { - m := new(StreamingOutputCallResponse) - if err := x.ClientStream.RecvMsg(m); err != nil { - return nil, err - } - return m, nil -} +type TestService_StreamingOutputCallClient = grpc.ServerStreamClient[StreamingOutputCallResponse] func (c *testServiceClient) StreamingInputCall(ctx context.Context, opts ...grpc.CallOption) (TestService_StreamingInputCallClient, error) { cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) @@ -155,34 +140,11 @@ func (c *testServiceClient) StreamingInputCall(ctx context.Context, opts ...grpc if err != nil { return nil, err } - x := &testServiceStreamingInputCallClient{ClientStream: stream} + x := &grpc.StreamClientImpl[StreamingInputCallRequest, StreamingInputCallResponse]{ClientStream: stream} return x, nil } -type TestService_StreamingInputCallClient interface { - Send(*StreamingInputCallRequest) error - CloseAndRecv() (*StreamingInputCallResponse, error) - grpc.ClientStream -} - -type testServiceStreamingInputCallClient struct { - grpc.ClientStream -} - -func (x *testServiceStreamingInputCallClient) Send(m *StreamingInputCallRequest) error { - return x.ClientStream.SendMsg(m) -} - -func (x *testServiceStreamingInputCallClient) CloseAndRecv() (*StreamingInputCallResponse, error) { - if err := x.ClientStream.CloseSend(); err != nil { - return nil, err - } - m := new(StreamingInputCallResponse) - if err := x.ClientStream.RecvMsg(m); err != nil { - return nil, err - } - return m, nil -} +type TestService_StreamingInputCallClient = grpc.ClientStreamClient[StreamingInputCallRequest, StreamingInputCallResponse] func (c *testServiceClient) FullDuplexCall(ctx context.Context, opts ...grpc.CallOption) (TestService_FullDuplexCallClient, error) { cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) @@ -190,31 +152,11 @@ func (c *testServiceClient) FullDuplexCall(ctx context.Context, opts ...grpc.Cal if err != nil { return nil, err } - x := &testServiceFullDuplexCallClient{ClientStream: stream} + x := &grpc.StreamClientImpl[StreamingOutputCallRequest, StreamingOutputCallResponse]{ClientStream: stream} return x, nil } -type TestService_FullDuplexCallClient interface { - Send(*StreamingOutputCallRequest) error - Recv() (*StreamingOutputCallResponse, error) - grpc.ClientStream -} - -type testServiceFullDuplexCallClient struct { - grpc.ClientStream -} - -func (x *testServiceFullDuplexCallClient) Send(m *StreamingOutputCallRequest) error { - return x.ClientStream.SendMsg(m) -} - -func (x *testServiceFullDuplexCallClient) Recv() (*StreamingOutputCallResponse, error) { - m := new(StreamingOutputCallResponse) - if err := x.ClientStream.RecvMsg(m); err != nil { - return nil, err - } - return m, nil -} +type TestService_FullDuplexCallClient = grpc.BidiStreamClient[StreamingOutputCallRequest, StreamingOutputCallResponse] func (c *testServiceClient) HalfDuplexCall(ctx context.Context, opts ...grpc.CallOption) (TestService_HalfDuplexCallClient, error) { cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) @@ -222,31 +164,11 @@ func (c *testServiceClient) HalfDuplexCall(ctx context.Context, opts ...grpc.Cal if err != nil { return nil, err } - x := &testServiceHalfDuplexCallClient{ClientStream: stream} + x := &grpc.StreamClientImpl[StreamingOutputCallRequest, StreamingOutputCallResponse]{ClientStream: stream} return x, nil } -type TestService_HalfDuplexCallClient interface { - Send(*StreamingOutputCallRequest) error - Recv() (*StreamingOutputCallResponse, error) - grpc.ClientStream -} - -type testServiceHalfDuplexCallClient struct { - grpc.ClientStream -} - -func (x *testServiceHalfDuplexCallClient) Send(m *StreamingOutputCallRequest) error { - return x.ClientStream.SendMsg(m) -} - -func (x *testServiceHalfDuplexCallClient) Recv() (*StreamingOutputCallResponse, error) { - m := new(StreamingOutputCallResponse) - if err := x.ClientStream.RecvMsg(m); err != nil { - return nil, err - } - return m, nil -} +type TestService_HalfDuplexCallClient = grpc.BidiStreamClient[StreamingOutputCallRequest, StreamingOutputCallResponse] func (c *testServiceClient) UnimplementedCall(ctx context.Context, in *Empty, opts ...grpc.CallOption) (*Empty, error) { cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) @@ -391,99 +313,28 @@ func _TestService_StreamingOutputCall_Handler(srv interface{}, stream grpc.Serve if err := stream.RecvMsg(m); err != nil { return err } - return srv.(TestServiceServer).StreamingOutputCall(m, &testServiceStreamingOutputCallServer{ServerStream: stream}) + return srv.(TestServiceServer).StreamingOutputCall(m, &grpc.StreamServerImpl[StreamingOutputCallRequest, StreamingOutputCallResponse]{ServerStream: stream}) } -type TestService_StreamingOutputCallServer interface { - Send(*StreamingOutputCallResponse) error - grpc.ServerStream -} - -type testServiceStreamingOutputCallServer struct { - grpc.ServerStream -} - -func (x *testServiceStreamingOutputCallServer) Send(m *StreamingOutputCallResponse) error { - return x.ServerStream.SendMsg(m) -} +type TestService_StreamingOutputCallServer = grpc.ServerStreamServer[StreamingOutputCallResponse] func _TestService_StreamingInputCall_Handler(srv interface{}, stream grpc.ServerStream) error { - return srv.(TestServiceServer).StreamingInputCall(&testServiceStreamingInputCallServer{ServerStream: stream}) -} - -type TestService_StreamingInputCallServer interface { - SendAndClose(*StreamingInputCallResponse) error - Recv() (*StreamingInputCallRequest, error) - grpc.ServerStream -} - -type testServiceStreamingInputCallServer struct { - grpc.ServerStream + return srv.(TestServiceServer).StreamingInputCall(&grpc.StreamServerImpl[StreamingInputCallRequest, StreamingInputCallResponse]{ServerStream: stream}) } -func (x *testServiceStreamingInputCallServer) SendAndClose(m *StreamingInputCallResponse) error { - return x.ServerStream.SendMsg(m) -} - -func (x *testServiceStreamingInputCallServer) Recv() (*StreamingInputCallRequest, error) { - m := new(StreamingInputCallRequest) - if err := x.ServerStream.RecvMsg(m); err != nil { - return nil, err - } - return m, nil -} +type TestService_StreamingInputCallServer = grpc.ClientStreamServer[StreamingInputCallRequest, StreamingInputCallResponse] func _TestService_FullDuplexCall_Handler(srv interface{}, stream grpc.ServerStream) error { - return srv.(TestServiceServer).FullDuplexCall(&testServiceFullDuplexCallServer{ServerStream: stream}) -} - -type TestService_FullDuplexCallServer interface { - Send(*StreamingOutputCallResponse) error - Recv() (*StreamingOutputCallRequest, error) - grpc.ServerStream + return srv.(TestServiceServer).FullDuplexCall(&grpc.StreamServerImpl[StreamingOutputCallRequest, StreamingOutputCallResponse]{ServerStream: stream}) } -type testServiceFullDuplexCallServer struct { - grpc.ServerStream -} - -func (x *testServiceFullDuplexCallServer) Send(m *StreamingOutputCallResponse) error { - return x.ServerStream.SendMsg(m) -} - -func (x *testServiceFullDuplexCallServer) Recv() (*StreamingOutputCallRequest, error) { - m := new(StreamingOutputCallRequest) - if err := x.ServerStream.RecvMsg(m); err != nil { - return nil, err - } - return m, nil -} +type TestService_FullDuplexCallServer = grpc.BidiStreamServer[StreamingOutputCallRequest, StreamingOutputCallResponse] func _TestService_HalfDuplexCall_Handler(srv interface{}, stream grpc.ServerStream) error { - return srv.(TestServiceServer).HalfDuplexCall(&testServiceHalfDuplexCallServer{ServerStream: stream}) -} - -type TestService_HalfDuplexCallServer interface { - Send(*StreamingOutputCallResponse) error - Recv() (*StreamingOutputCallRequest, error) - grpc.ServerStream + return srv.(TestServiceServer).HalfDuplexCall(&grpc.StreamServerImpl[StreamingOutputCallRequest, StreamingOutputCallResponse]{ServerStream: stream}) } -type testServiceHalfDuplexCallServer struct { - grpc.ServerStream -} - -func (x *testServiceHalfDuplexCallServer) Send(m *StreamingOutputCallResponse) error { - return x.ServerStream.SendMsg(m) -} - -func (x *testServiceHalfDuplexCallServer) Recv() (*StreamingOutputCallRequest, error) { - m := new(StreamingOutputCallRequest) - if err := x.ServerStream.RecvMsg(m); err != nil { - return nil, err - } - return m, nil -} +type TestService_HalfDuplexCallServer = grpc.BidiStreamServer[StreamingOutputCallRequest, StreamingOutputCallResponse] func _TestService_UnimplementedCall_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(Empty) diff --git a/interop/grpc_testing/worker_service_grpc.pb.go b/interop/grpc_testing/worker_service_grpc.pb.go index 5aacda00a39..8df2d3c542f 100644 --- a/interop/grpc_testing/worker_service_grpc.pb.go +++ b/interop/grpc_testing/worker_service_grpc.pb.go @@ -32,8 +32,8 @@ import ( // This is a compile-time assertion to ensure that this generated file // is compatible with the grpc package it is being compiled against. -// Requires gRPC-Go v1.62.0 or later. -const _ = grpc.SupportPackageIsVersion8 +// Requires gRPC-Go v1.64.0 or later. +const _ = grpc.SupportPackageIsVersion9 const ( WorkerService_RunServer_FullMethodName = "/grpc.testing.WorkerService/RunServer" @@ -80,31 +80,11 @@ func (c *workerServiceClient) RunServer(ctx context.Context, opts ...grpc.CallOp if err != nil { return nil, err } - x := &workerServiceRunServerClient{ClientStream: stream} + x := &grpc.StreamClientImpl[ServerArgs, ServerStatus]{ClientStream: stream} return x, nil } -type WorkerService_RunServerClient interface { - Send(*ServerArgs) error - Recv() (*ServerStatus, error) - grpc.ClientStream -} - -type workerServiceRunServerClient struct { - grpc.ClientStream -} - -func (x *workerServiceRunServerClient) Send(m *ServerArgs) error { - return x.ClientStream.SendMsg(m) -} - -func (x *workerServiceRunServerClient) Recv() (*ServerStatus, error) { - m := new(ServerStatus) - if err := x.ClientStream.RecvMsg(m); err != nil { - return nil, err - } - return m, nil -} +type WorkerService_RunServerClient = grpc.BidiStreamClient[ServerArgs, ServerStatus] func (c *workerServiceClient) RunClient(ctx context.Context, opts ...grpc.CallOption) (WorkerService_RunClientClient, error) { cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) @@ -112,31 +92,11 @@ func (c *workerServiceClient) RunClient(ctx context.Context, opts ...grpc.CallOp if err != nil { return nil, err } - x := &workerServiceRunClientClient{ClientStream: stream} + x := &grpc.StreamClientImpl[ClientArgs, ClientStatus]{ClientStream: stream} return x, nil } -type WorkerService_RunClientClient interface { - Send(*ClientArgs) error - Recv() (*ClientStatus, error) - grpc.ClientStream -} - -type workerServiceRunClientClient struct { - grpc.ClientStream -} - -func (x *workerServiceRunClientClient) Send(m *ClientArgs) error { - return x.ClientStream.SendMsg(m) -} - -func (x *workerServiceRunClientClient) Recv() (*ClientStatus, error) { - m := new(ClientStatus) - if err := x.ClientStream.RecvMsg(m); err != nil { - return nil, err - } - return m, nil -} +type WorkerService_RunClientClient = grpc.BidiStreamClient[ClientArgs, ClientStatus] func (c *workerServiceClient) CoreCount(ctx context.Context, in *CoreRequest, opts ...grpc.CallOption) (*CoreResponse, error) { cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) @@ -213,56 +173,16 @@ func RegisterWorkerServiceServer(s grpc.ServiceRegistrar, srv WorkerServiceServe } func _WorkerService_RunServer_Handler(srv interface{}, stream grpc.ServerStream) error { - return srv.(WorkerServiceServer).RunServer(&workerServiceRunServerServer{ServerStream: stream}) + return srv.(WorkerServiceServer).RunServer(&grpc.StreamServerImpl[ServerArgs, ServerStatus]{ServerStream: stream}) } -type WorkerService_RunServerServer interface { - Send(*ServerStatus) error - Recv() (*ServerArgs, error) - grpc.ServerStream -} - -type workerServiceRunServerServer struct { - grpc.ServerStream -} - -func (x *workerServiceRunServerServer) Send(m *ServerStatus) error { - return x.ServerStream.SendMsg(m) -} - -func (x *workerServiceRunServerServer) Recv() (*ServerArgs, error) { - m := new(ServerArgs) - if err := x.ServerStream.RecvMsg(m); err != nil { - return nil, err - } - return m, nil -} +type WorkerService_RunServerServer = grpc.BidiStreamServer[ServerArgs, ServerStatus] func _WorkerService_RunClient_Handler(srv interface{}, stream grpc.ServerStream) error { - return srv.(WorkerServiceServer).RunClient(&workerServiceRunClientServer{ServerStream: stream}) + return srv.(WorkerServiceServer).RunClient(&grpc.StreamServerImpl[ClientArgs, ClientStatus]{ServerStream: stream}) } -type WorkerService_RunClientServer interface { - Send(*ClientStatus) error - Recv() (*ClientArgs, error) - grpc.ServerStream -} - -type workerServiceRunClientServer struct { - grpc.ServerStream -} - -func (x *workerServiceRunClientServer) Send(m *ClientStatus) error { - return x.ServerStream.SendMsg(m) -} - -func (x *workerServiceRunClientServer) Recv() (*ClientArgs, error) { - m := new(ClientArgs) - if err := x.ServerStream.RecvMsg(m); err != nil { - return nil, err - } - return m, nil -} +type WorkerService_RunClientServer = grpc.BidiStreamServer[ClientArgs, ClientStatus] func _WorkerService_CoreCount_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(CoreRequest) diff --git a/interop/stress/grpc_testing/metrics_grpc.pb.go b/interop/stress/grpc_testing/metrics_grpc.pb.go index 167ae0d694a..dc775ba4541 100644 --- a/interop/stress/grpc_testing/metrics_grpc.pb.go +++ b/interop/stress/grpc_testing/metrics_grpc.pb.go @@ -36,8 +36,8 @@ import ( // This is a compile-time assertion to ensure that this generated file // is compatible with the grpc package it is being compiled against. -// Requires gRPC-Go v1.62.0 or later. -const _ = grpc.SupportPackageIsVersion8 +// Requires gRPC-Go v1.64.0 or later. +const _ = grpc.SupportPackageIsVersion9 const ( MetricsService_GetAllGauges_FullMethodName = "/grpc.testing.MetricsService/GetAllGauges" @@ -69,7 +69,7 @@ func (c *metricsServiceClient) GetAllGauges(ctx context.Context, in *EmptyMessag if err != nil { return nil, err } - x := &metricsServiceGetAllGaugesClient{ClientStream: stream} + x := &grpc.StreamClientImpl[EmptyMessage, GaugeResponse]{ClientStream: stream} if err := x.ClientStream.SendMsg(in); err != nil { return nil, err } @@ -79,22 +79,7 @@ func (c *metricsServiceClient) GetAllGauges(ctx context.Context, in *EmptyMessag return x, nil } -type MetricsService_GetAllGaugesClient interface { - Recv() (*GaugeResponse, error) - grpc.ClientStream -} - -type metricsServiceGetAllGaugesClient struct { - grpc.ClientStream -} - -func (x *metricsServiceGetAllGaugesClient) Recv() (*GaugeResponse, error) { - m := new(GaugeResponse) - if err := x.ClientStream.RecvMsg(m); err != nil { - return nil, err - } - return m, nil -} +type MetricsService_GetAllGaugesClient = grpc.ServerStreamClient[GaugeResponse] func (c *metricsServiceClient) GetGauge(ctx context.Context, in *GaugeRequest, opts ...grpc.CallOption) (*GaugeResponse, error) { cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) @@ -146,21 +131,10 @@ func _MetricsService_GetAllGauges_Handler(srv interface{}, stream grpc.ServerStr if err := stream.RecvMsg(m); err != nil { return err } - return srv.(MetricsServiceServer).GetAllGauges(m, &metricsServiceGetAllGaugesServer{ServerStream: stream}) -} - -type MetricsService_GetAllGaugesServer interface { - Send(*GaugeResponse) error - grpc.ServerStream + return srv.(MetricsServiceServer).GetAllGauges(m, &grpc.StreamServerImpl[EmptyMessage, GaugeResponse]{ServerStream: stream}) } -type metricsServiceGetAllGaugesServer struct { - grpc.ServerStream -} - -func (x *metricsServiceGetAllGaugesServer) Send(m *GaugeResponse) error { - return x.ServerStream.SendMsg(m) -} +type MetricsService_GetAllGaugesServer = grpc.ServerStreamServer[GaugeResponse] func _MetricsService_GetGauge_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(GaugeRequest) diff --git a/reflection/grpc_testing/test_grpc.pb.go b/reflection/grpc_testing/test_grpc.pb.go index 8a8a93fc332..685083109be 100644 --- a/reflection/grpc_testing/test_grpc.pb.go +++ b/reflection/grpc_testing/test_grpc.pb.go @@ -29,8 +29,8 @@ import ( // This is a compile-time assertion to ensure that this generated file // is compatible with the grpc package it is being compiled against. -// Requires gRPC-Go v1.62.0 or later. -const _ = grpc.SupportPackageIsVersion8 +// Requires gRPC-Go v1.64.0 or later. +const _ = grpc.SupportPackageIsVersion9 const ( SearchService_Search_FullMethodName = "/grpc.testing.SearchService/Search" @@ -69,31 +69,11 @@ func (c *searchServiceClient) StreamingSearch(ctx context.Context, opts ...grpc. if err != nil { return nil, err } - x := &searchServiceStreamingSearchClient{ClientStream: stream} + x := &grpc.StreamClientImpl[SearchRequest, SearchResponse]{ClientStream: stream} return x, nil } -type SearchService_StreamingSearchClient interface { - Send(*SearchRequest) error - Recv() (*SearchResponse, error) - grpc.ClientStream -} - -type searchServiceStreamingSearchClient struct { - grpc.ClientStream -} - -func (x *searchServiceStreamingSearchClient) Send(m *SearchRequest) error { - return x.ClientStream.SendMsg(m) -} - -func (x *searchServiceStreamingSearchClient) Recv() (*SearchResponse, error) { - m := new(SearchResponse) - if err := x.ClientStream.RecvMsg(m); err != nil { - return nil, err - } - return m, nil -} +type SearchService_StreamingSearchClient = grpc.BidiStreamClient[SearchRequest, SearchResponse] // SearchServiceServer is the server API for SearchService service. // All implementations must embed UnimplementedSearchServiceServer @@ -146,30 +126,10 @@ func _SearchService_Search_Handler(srv interface{}, ctx context.Context, dec fun } func _SearchService_StreamingSearch_Handler(srv interface{}, stream grpc.ServerStream) error { - return srv.(SearchServiceServer).StreamingSearch(&searchServiceStreamingSearchServer{ServerStream: stream}) + return srv.(SearchServiceServer).StreamingSearch(&grpc.StreamServerImpl[SearchRequest, SearchResponse]{ServerStream: stream}) } -type SearchService_StreamingSearchServer interface { - Send(*SearchResponse) error - Recv() (*SearchRequest, error) - grpc.ServerStream -} - -type searchServiceStreamingSearchServer struct { - grpc.ServerStream -} - -func (x *searchServiceStreamingSearchServer) Send(m *SearchResponse) error { - return x.ServerStream.SendMsg(m) -} - -func (x *searchServiceStreamingSearchServer) Recv() (*SearchRequest, error) { - m := new(SearchRequest) - if err := x.ServerStream.RecvMsg(m); err != nil { - return nil, err - } - return m, nil -} +type SearchService_StreamingSearchServer = grpc.BidiStreamServer[SearchRequest, SearchResponse] // SearchService_ServiceDesc is the grpc.ServiceDesc for SearchService service. // It's only intended for direct use with grpc.RegisterService, diff --git a/regenerate.sh b/regenerate.sh index 716885c422d..ae0574ce199 100755 --- a/regenerate.sh +++ b/regenerate.sh @@ -73,11 +73,6 @@ SOURCES=( ${WORKDIR}/grpc-proto/grpc/core/*.proto ) -# Generates sources with bleeding-edge flags enabled -FUTURE_SOURCES=( - examples/route_guide/routeguide/route_guide.proto -) - # These options of the form 'Mfoo.proto=bar' instruct the codegen to use an # import path of 'bar' in the generated code when 'foo.proto' is imported in # one of the sources. @@ -98,7 +93,7 @@ Mgrpc/testing/empty.proto=google.golang.org/grpc/interop/grpc_testing for src in ${SOURCES[@]}; do echo "protoc ${src}" - protoc --go_out=${OPTS}:${WORKDIR}/out --go-grpc_out=${OPTS}:${WORKDIR}/out \ + protoc --go_out=${OPTS}:${WORKDIR}/out --go-grpc_out=${OPTS},use_generic_streams=true:${WORKDIR}/out \ -I"." \ -I${WORKDIR}/grpc-proto \ -I${WORKDIR}/googleapis \ @@ -116,16 +111,6 @@ for src in ${LEGACY_SOURCES[@]}; do ${src} done -for src in ${FUTURE_SOURCES[@]}; do - echo "protoc ${src}" - protoc --go_out=${OPTS}:${WORKDIR}/out --go-grpc_out=${OPTS},use_generic_streams=true:${WORKDIR}/out \ - -I"." \ - -I${WORKDIR}/grpc-proto \ - -I${WORKDIR}/googleapis \ - -I${WORKDIR}/protobuf/src \ - ${src} -done - # The go_package option in grpc/lookup/v1/rls.proto doesn't match the # current location. Move it into the right place. mkdir -p ${WORKDIR}/out/google.golang.org/grpc/internal/proto/grpc_lookup_v1