google.golang.org/grpc@v1.72.2/interop/grpc_testing/benchmark_service_grpc.pb.go (about)

     1  // Copyright 2015 gRPC authors.
     2  //
     3  // Licensed under the Apache License, Version 2.0 (the "License");
     4  // you may not use this file except in compliance with the License.
     5  // You may obtain a copy of the License at
     6  //
     7  //     http://www.apache.org/licenses/LICENSE-2.0
     8  //
     9  // Unless required by applicable law or agreed to in writing, software
    10  // distributed under the License is distributed on an "AS IS" BASIS,
    11  // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    12  // See the License for the specific language governing permissions and
    13  // limitations under the License.
    14  
    15  // An integration test service that covers all the method signature permutations
    16  // of unary/streaming requests/responses.
    17  
    18  // Code generated by protoc-gen-go-grpc. DO NOT EDIT.
    19  // versions:
    20  // - protoc-gen-go-grpc v1.5.1
    21  // - protoc             v5.27.1
    22  // source: grpc/testing/benchmark_service.proto
    23  
    24  package grpc_testing
    25  
    26  import (
    27  	context "context"
    28  	grpc "google.golang.org/grpc"
    29  	codes "google.golang.org/grpc/codes"
    30  	status "google.golang.org/grpc/status"
    31  )
    32  
    33  // This is a compile-time assertion to ensure that this generated file
    34  // is compatible with the grpc package it is being compiled against.
    35  // Requires gRPC-Go v1.64.0 or later.
    36  const _ = grpc.SupportPackageIsVersion9
    37  
    38  const (
    39  	BenchmarkService_UnaryCall_FullMethodName           = "/grpc.testing.BenchmarkService/UnaryCall"
    40  	BenchmarkService_StreamingCall_FullMethodName       = "/grpc.testing.BenchmarkService/StreamingCall"
    41  	BenchmarkService_StreamingFromClient_FullMethodName = "/grpc.testing.BenchmarkService/StreamingFromClient"
    42  	BenchmarkService_StreamingFromServer_FullMethodName = "/grpc.testing.BenchmarkService/StreamingFromServer"
    43  	BenchmarkService_StreamingBothWays_FullMethodName   = "/grpc.testing.BenchmarkService/StreamingBothWays"
    44  )
    45  
    46  // BenchmarkServiceClient is the client API for BenchmarkService service.
    47  //
    48  // For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.
    49  type BenchmarkServiceClient interface {
    50  	// One request followed by one response.
    51  	// The server returns the client payload as-is.
    52  	UnaryCall(ctx context.Context, in *SimpleRequest, opts ...grpc.CallOption) (*SimpleResponse, error)
    53  	// Repeated sequence of one request followed by one response.
    54  	// Should be called streaming ping-pong
    55  	// The server returns the client payload as-is on each response
    56  	StreamingCall(ctx context.Context, opts ...grpc.CallOption) (grpc.BidiStreamingClient[SimpleRequest, SimpleResponse], error)
    57  	// Single-sided unbounded streaming from client to server
    58  	// The server returns the client payload as-is once the client does WritesDone
    59  	StreamingFromClient(ctx context.Context, opts ...grpc.CallOption) (grpc.ClientStreamingClient[SimpleRequest, SimpleResponse], error)
    60  	// Single-sided unbounded streaming from server to client
    61  	// The server repeatedly returns the client payload as-is
    62  	StreamingFromServer(ctx context.Context, in *SimpleRequest, opts ...grpc.CallOption) (grpc.ServerStreamingClient[SimpleResponse], error)
    63  	// Two-sided unbounded streaming between server to client
    64  	// Both sides send the content of their own choice to the other
    65  	StreamingBothWays(ctx context.Context, opts ...grpc.CallOption) (grpc.BidiStreamingClient[SimpleRequest, SimpleResponse], error)
    66  }
    67  
    68  type benchmarkServiceClient struct {
    69  	cc grpc.ClientConnInterface
    70  }
    71  
    72  func NewBenchmarkServiceClient(cc grpc.ClientConnInterface) BenchmarkServiceClient {
    73  	return &benchmarkServiceClient{cc}
    74  }
    75  
    76  func (c *benchmarkServiceClient) UnaryCall(ctx context.Context, in *SimpleRequest, opts ...grpc.CallOption) (*SimpleResponse, error) {
    77  	cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
    78  	out := new(SimpleResponse)
    79  	err := c.cc.Invoke(ctx, BenchmarkService_UnaryCall_FullMethodName, in, out, cOpts...)
    80  	if err != nil {
    81  		return nil, err
    82  	}
    83  	return out, nil
    84  }
    85  
    86  func (c *benchmarkServiceClient) StreamingCall(ctx context.Context, opts ...grpc.CallOption) (grpc.BidiStreamingClient[SimpleRequest, SimpleResponse], error) {
    87  	cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
    88  	stream, err := c.cc.NewStream(ctx, &BenchmarkService_ServiceDesc.Streams[0], BenchmarkService_StreamingCall_FullMethodName, cOpts...)
    89  	if err != nil {
    90  		return nil, err
    91  	}
    92  	x := &grpc.GenericClientStream[SimpleRequest, SimpleResponse]{ClientStream: stream}
    93  	return x, nil
    94  }
    95  
    96  // This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name.
    97  type BenchmarkService_StreamingCallClient = grpc.BidiStreamingClient[SimpleRequest, SimpleResponse]
    98  
    99  func (c *benchmarkServiceClient) StreamingFromClient(ctx context.Context, opts ...grpc.CallOption) (grpc.ClientStreamingClient[SimpleRequest, SimpleResponse], error) {
   100  	cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
   101  	stream, err := c.cc.NewStream(ctx, &BenchmarkService_ServiceDesc.Streams[1], BenchmarkService_StreamingFromClient_FullMethodName, cOpts...)
   102  	if err != nil {
   103  		return nil, err
   104  	}
   105  	x := &grpc.GenericClientStream[SimpleRequest, SimpleResponse]{ClientStream: stream}
   106  	return x, nil
   107  }
   108  
   109  // This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name.
   110  type BenchmarkService_StreamingFromClientClient = grpc.ClientStreamingClient[SimpleRequest, SimpleResponse]
   111  
   112  func (c *benchmarkServiceClient) StreamingFromServer(ctx context.Context, in *SimpleRequest, opts ...grpc.CallOption) (grpc.ServerStreamingClient[SimpleResponse], error) {
   113  	cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
   114  	stream, err := c.cc.NewStream(ctx, &BenchmarkService_ServiceDesc.Streams[2], BenchmarkService_StreamingFromServer_FullMethodName, cOpts...)
   115  	if err != nil {
   116  		return nil, err
   117  	}
   118  	x := &grpc.GenericClientStream[SimpleRequest, SimpleResponse]{ClientStream: stream}
   119  	if err := x.ClientStream.SendMsg(in); err != nil {
   120  		return nil, err
   121  	}
   122  	if err := x.ClientStream.CloseSend(); err != nil {
   123  		return nil, err
   124  	}
   125  	return x, nil
   126  }
   127  
   128  // This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name.
   129  type BenchmarkService_StreamingFromServerClient = grpc.ServerStreamingClient[SimpleResponse]
   130  
   131  func (c *benchmarkServiceClient) StreamingBothWays(ctx context.Context, opts ...grpc.CallOption) (grpc.BidiStreamingClient[SimpleRequest, SimpleResponse], error) {
   132  	cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
   133  	stream, err := c.cc.NewStream(ctx, &BenchmarkService_ServiceDesc.Streams[3], BenchmarkService_StreamingBothWays_FullMethodName, cOpts...)
   134  	if err != nil {
   135  		return nil, err
   136  	}
   137  	x := &grpc.GenericClientStream[SimpleRequest, SimpleResponse]{ClientStream: stream}
   138  	return x, nil
   139  }
   140  
   141  // This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name.
   142  type BenchmarkService_StreamingBothWaysClient = grpc.BidiStreamingClient[SimpleRequest, SimpleResponse]
   143  
   144  // BenchmarkServiceServer is the server API for BenchmarkService service.
   145  // All implementations must embed UnimplementedBenchmarkServiceServer
   146  // for forward compatibility.
   147  type BenchmarkServiceServer interface {
   148  	// One request followed by one response.
   149  	// The server returns the client payload as-is.
   150  	UnaryCall(context.Context, *SimpleRequest) (*SimpleResponse, error)
   151  	// Repeated sequence of one request followed by one response.
   152  	// Should be called streaming ping-pong
   153  	// The server returns the client payload as-is on each response
   154  	StreamingCall(grpc.BidiStreamingServer[SimpleRequest, SimpleResponse]) error
   155  	// Single-sided unbounded streaming from client to server
   156  	// The server returns the client payload as-is once the client does WritesDone
   157  	StreamingFromClient(grpc.ClientStreamingServer[SimpleRequest, SimpleResponse]) error
   158  	// Single-sided unbounded streaming from server to client
   159  	// The server repeatedly returns the client payload as-is
   160  	StreamingFromServer(*SimpleRequest, grpc.ServerStreamingServer[SimpleResponse]) error
   161  	// Two-sided unbounded streaming between server to client
   162  	// Both sides send the content of their own choice to the other
   163  	StreamingBothWays(grpc.BidiStreamingServer[SimpleRequest, SimpleResponse]) error
   164  	mustEmbedUnimplementedBenchmarkServiceServer()
   165  }
   166  
   167  // UnimplementedBenchmarkServiceServer must be embedded to have
   168  // forward compatible implementations.
   169  //
   170  // NOTE: this should be embedded by value instead of pointer to avoid a nil
   171  // pointer dereference when methods are called.
   172  type UnimplementedBenchmarkServiceServer struct{}
   173  
   174  func (UnimplementedBenchmarkServiceServer) UnaryCall(context.Context, *SimpleRequest) (*SimpleResponse, error) {
   175  	return nil, status.Errorf(codes.Unimplemented, "method UnaryCall not implemented")
   176  }
   177  func (UnimplementedBenchmarkServiceServer) StreamingCall(grpc.BidiStreamingServer[SimpleRequest, SimpleResponse]) error {
   178  	return status.Errorf(codes.Unimplemented, "method StreamingCall not implemented")
   179  }
   180  func (UnimplementedBenchmarkServiceServer) StreamingFromClient(grpc.ClientStreamingServer[SimpleRequest, SimpleResponse]) error {
   181  	return status.Errorf(codes.Unimplemented, "method StreamingFromClient not implemented")
   182  }
   183  func (UnimplementedBenchmarkServiceServer) StreamingFromServer(*SimpleRequest, grpc.ServerStreamingServer[SimpleResponse]) error {
   184  	return status.Errorf(codes.Unimplemented, "method StreamingFromServer not implemented")
   185  }
   186  func (UnimplementedBenchmarkServiceServer) StreamingBothWays(grpc.BidiStreamingServer[SimpleRequest, SimpleResponse]) error {
   187  	return status.Errorf(codes.Unimplemented, "method StreamingBothWays not implemented")
   188  }
   189  func (UnimplementedBenchmarkServiceServer) mustEmbedUnimplementedBenchmarkServiceServer() {}
   190  func (UnimplementedBenchmarkServiceServer) testEmbeddedByValue()                          {}
   191  
   192  // UnsafeBenchmarkServiceServer may be embedded to opt out of forward compatibility for this service.
   193  // Use of this interface is not recommended, as added methods to BenchmarkServiceServer will
   194  // result in compilation errors.
   195  type UnsafeBenchmarkServiceServer interface {
   196  	mustEmbedUnimplementedBenchmarkServiceServer()
   197  }
   198  
   199  func RegisterBenchmarkServiceServer(s grpc.ServiceRegistrar, srv BenchmarkServiceServer) {
   200  	// If the following call panics, it indicates UnimplementedBenchmarkServiceServer was
   201  	// embedded by pointer and is nil.  This will cause panics if an
   202  	// unimplemented method is ever invoked, so we test this at initialization
   203  	// time to prevent it from happening at runtime later due to I/O.
   204  	if t, ok := srv.(interface{ testEmbeddedByValue() }); ok {
   205  		t.testEmbeddedByValue()
   206  	}
   207  	s.RegisterService(&BenchmarkService_ServiceDesc, srv)
   208  }
   209  
   210  func _BenchmarkService_UnaryCall_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
   211  	in := new(SimpleRequest)
   212  	if err := dec(in); err != nil {
   213  		return nil, err
   214  	}
   215  	if interceptor == nil {
   216  		return srv.(BenchmarkServiceServer).UnaryCall(ctx, in)
   217  	}
   218  	info := &grpc.UnaryServerInfo{
   219  		Server:     srv,
   220  		FullMethod: BenchmarkService_UnaryCall_FullMethodName,
   221  	}
   222  	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
   223  		return srv.(BenchmarkServiceServer).UnaryCall(ctx, req.(*SimpleRequest))
   224  	}
   225  	return interceptor(ctx, in, info, handler)
   226  }
   227  
   228  func _BenchmarkService_StreamingCall_Handler(srv interface{}, stream grpc.ServerStream) error {
   229  	return srv.(BenchmarkServiceServer).StreamingCall(&grpc.GenericServerStream[SimpleRequest, SimpleResponse]{ServerStream: stream})
   230  }
   231  
   232  // This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name.
   233  type BenchmarkService_StreamingCallServer = grpc.BidiStreamingServer[SimpleRequest, SimpleResponse]
   234  
   235  func _BenchmarkService_StreamingFromClient_Handler(srv interface{}, stream grpc.ServerStream) error {
   236  	return srv.(BenchmarkServiceServer).StreamingFromClient(&grpc.GenericServerStream[SimpleRequest, SimpleResponse]{ServerStream: stream})
   237  }
   238  
   239  // This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name.
   240  type BenchmarkService_StreamingFromClientServer = grpc.ClientStreamingServer[SimpleRequest, SimpleResponse]
   241  
   242  func _BenchmarkService_StreamingFromServer_Handler(srv interface{}, stream grpc.ServerStream) error {
   243  	m := new(SimpleRequest)
   244  	if err := stream.RecvMsg(m); err != nil {
   245  		return err
   246  	}
   247  	return srv.(BenchmarkServiceServer).StreamingFromServer(m, &grpc.GenericServerStream[SimpleRequest, SimpleResponse]{ServerStream: stream})
   248  }
   249  
   250  // This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name.
   251  type BenchmarkService_StreamingFromServerServer = grpc.ServerStreamingServer[SimpleResponse]
   252  
   253  func _BenchmarkService_StreamingBothWays_Handler(srv interface{}, stream grpc.ServerStream) error {
   254  	return srv.(BenchmarkServiceServer).StreamingBothWays(&grpc.GenericServerStream[SimpleRequest, SimpleResponse]{ServerStream: stream})
   255  }
   256  
   257  // This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name.
   258  type BenchmarkService_StreamingBothWaysServer = grpc.BidiStreamingServer[SimpleRequest, SimpleResponse]
   259  
   260  // BenchmarkService_ServiceDesc is the grpc.ServiceDesc for BenchmarkService service.
   261  // It's only intended for direct use with grpc.RegisterService,
   262  // and not to be introspected or modified (even as a copy)
   263  var BenchmarkService_ServiceDesc = grpc.ServiceDesc{
   264  	ServiceName: "grpc.testing.BenchmarkService",
   265  	HandlerType: (*BenchmarkServiceServer)(nil),
   266  	Methods: []grpc.MethodDesc{
   267  		{
   268  			MethodName: "UnaryCall",
   269  			Handler:    _BenchmarkService_UnaryCall_Handler,
   270  		},
   271  	},
   272  	Streams: []grpc.StreamDesc{
   273  		{
   274  			StreamName:    "StreamingCall",
   275  			Handler:       _BenchmarkService_StreamingCall_Handler,
   276  			ServerStreams: true,
   277  			ClientStreams: true,
   278  		},
   279  		{
   280  			StreamName:    "StreamingFromClient",
   281  			Handler:       _BenchmarkService_StreamingFromClient_Handler,
   282  			ClientStreams: true,
   283  		},
   284  		{
   285  			StreamName:    "StreamingFromServer",
   286  			Handler:       _BenchmarkService_StreamingFromServer_Handler,
   287  			ServerStreams: true,
   288  		},
   289  		{
   290  			StreamName:    "StreamingBothWays",
   291  			Handler:       _BenchmarkService_StreamingBothWays_Handler,
   292  			ServerStreams: true,
   293  			ClientStreams: true,
   294  		},
   295  	},
   296  	Metadata: "grpc/testing/benchmark_service.proto",
   297  }