...

Source file src/google.golang.org/grpc/interop/grpc_testing/worker_service_grpc.pb.go

Documentation: google.golang.org/grpc/interop/grpc_testing

     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.3.0
    21  // - protoc             v4.25.2
    22  // source: grpc/testing/worker_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  	WorkerService_RunServer_FullMethodName  = "/grpc.testing.WorkerService/RunServer"
    40  	WorkerService_RunClient_FullMethodName  = "/grpc.testing.WorkerService/RunClient"
    41  	WorkerService_CoreCount_FullMethodName  = "/grpc.testing.WorkerService/CoreCount"
    42  	WorkerService_QuitWorker_FullMethodName = "/grpc.testing.WorkerService/QuitWorker"
    43  )
    44  
    45  // WorkerServiceClient is the client API for WorkerService service.
    46  //
    47  // 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.
    48  type WorkerServiceClient interface {
    49  	// Start server with specified workload.
    50  	// First request sent specifies the ServerConfig followed by ServerStatus
    51  	// response. After that, a "Mark" can be sent anytime to request the latest
    52  	// stats. Closing the stream will initiate shutdown of the test server
    53  	// and once the shutdown has finished, the OK status is sent to terminate
    54  	// this RPC.
    55  	RunServer(ctx context.Context, opts ...grpc.CallOption) (grpc.BidiStreamingClient[ServerArgs, ServerStatus], error)
    56  	// Start client with specified workload.
    57  	// First request sent specifies the ClientConfig followed by ClientStatus
    58  	// response. After that, a "Mark" can be sent anytime to request the latest
    59  	// stats. Closing the stream will initiate shutdown of the test client
    60  	// and once the shutdown has finished, the OK status is sent to terminate
    61  	// this RPC.
    62  	RunClient(ctx context.Context, opts ...grpc.CallOption) (grpc.BidiStreamingClient[ClientArgs, ClientStatus], error)
    63  	// Just return the core count - unary call
    64  	CoreCount(ctx context.Context, in *CoreRequest, opts ...grpc.CallOption) (*CoreResponse, error)
    65  	// Quit this worker
    66  	QuitWorker(ctx context.Context, in *Void, opts ...grpc.CallOption) (*Void, error)
    67  }
    68  
    69  type workerServiceClient struct {
    70  	cc grpc.ClientConnInterface
    71  }
    72  
    73  func NewWorkerServiceClient(cc grpc.ClientConnInterface) WorkerServiceClient {
    74  	return &workerServiceClient{cc}
    75  }
    76  
    77  func (c *workerServiceClient) RunServer(ctx context.Context, opts ...grpc.CallOption) (grpc.BidiStreamingClient[ServerArgs, ServerStatus], error) {
    78  	cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
    79  	stream, err := c.cc.NewStream(ctx, &WorkerService_ServiceDesc.Streams[0], WorkerService_RunServer_FullMethodName, cOpts...)
    80  	if err != nil {
    81  		return nil, err
    82  	}
    83  	x := &grpc.GenericClientStream[ServerArgs, ServerStatus]{ClientStream: stream}
    84  	return x, nil
    85  }
    86  
    87  // This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name.
    88  type WorkerService_RunServerClient = grpc.BidiStreamingClient[ServerArgs, ServerStatus]
    89  
    90  func (c *workerServiceClient) RunClient(ctx context.Context, opts ...grpc.CallOption) (grpc.BidiStreamingClient[ClientArgs, ClientStatus], error) {
    91  	cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
    92  	stream, err := c.cc.NewStream(ctx, &WorkerService_ServiceDesc.Streams[1], WorkerService_RunClient_FullMethodName, cOpts...)
    93  	if err != nil {
    94  		return nil, err
    95  	}
    96  	x := &grpc.GenericClientStream[ClientArgs, ClientStatus]{ClientStream: stream}
    97  	return x, nil
    98  }
    99  
   100  // This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name.
   101  type WorkerService_RunClientClient = grpc.BidiStreamingClient[ClientArgs, ClientStatus]
   102  
   103  func (c *workerServiceClient) CoreCount(ctx context.Context, in *CoreRequest, opts ...grpc.CallOption) (*CoreResponse, error) {
   104  	cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
   105  	out := new(CoreResponse)
   106  	err := c.cc.Invoke(ctx, WorkerService_CoreCount_FullMethodName, in, out, cOpts...)
   107  	if err != nil {
   108  		return nil, err
   109  	}
   110  	return out, nil
   111  }
   112  
   113  func (c *workerServiceClient) QuitWorker(ctx context.Context, in *Void, opts ...grpc.CallOption) (*Void, error) {
   114  	cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
   115  	out := new(Void)
   116  	err := c.cc.Invoke(ctx, WorkerService_QuitWorker_FullMethodName, in, out, cOpts...)
   117  	if err != nil {
   118  		return nil, err
   119  	}
   120  	return out, nil
   121  }
   122  
   123  // WorkerServiceServer is the server API for WorkerService service.
   124  // All implementations must embed UnimplementedWorkerServiceServer
   125  // for forward compatibility
   126  type WorkerServiceServer interface {
   127  	// Start server with specified workload.
   128  	// First request sent specifies the ServerConfig followed by ServerStatus
   129  	// response. After that, a "Mark" can be sent anytime to request the latest
   130  	// stats. Closing the stream will initiate shutdown of the test server
   131  	// and once the shutdown has finished, the OK status is sent to terminate
   132  	// this RPC.
   133  	RunServer(grpc.BidiStreamingServer[ServerArgs, ServerStatus]) error
   134  	// Start client with specified workload.
   135  	// First request sent specifies the ClientConfig followed by ClientStatus
   136  	// response. After that, a "Mark" can be sent anytime to request the latest
   137  	// stats. Closing the stream will initiate shutdown of the test client
   138  	// and once the shutdown has finished, the OK status is sent to terminate
   139  	// this RPC.
   140  	RunClient(grpc.BidiStreamingServer[ClientArgs, ClientStatus]) error
   141  	// Just return the core count - unary call
   142  	CoreCount(context.Context, *CoreRequest) (*CoreResponse, error)
   143  	// Quit this worker
   144  	QuitWorker(context.Context, *Void) (*Void, error)
   145  	mustEmbedUnimplementedWorkerServiceServer()
   146  }
   147  
   148  // UnimplementedWorkerServiceServer must be embedded to have forward compatible implementations.
   149  type UnimplementedWorkerServiceServer struct {
   150  }
   151  
   152  func (UnimplementedWorkerServiceServer) RunServer(grpc.BidiStreamingServer[ServerArgs, ServerStatus]) error {
   153  	return status.Errorf(codes.Unimplemented, "method RunServer not implemented")
   154  }
   155  func (UnimplementedWorkerServiceServer) RunClient(grpc.BidiStreamingServer[ClientArgs, ClientStatus]) error {
   156  	return status.Errorf(codes.Unimplemented, "method RunClient not implemented")
   157  }
   158  func (UnimplementedWorkerServiceServer) CoreCount(context.Context, *CoreRequest) (*CoreResponse, error) {
   159  	return nil, status.Errorf(codes.Unimplemented, "method CoreCount not implemented")
   160  }
   161  func (UnimplementedWorkerServiceServer) QuitWorker(context.Context, *Void) (*Void, error) {
   162  	return nil, status.Errorf(codes.Unimplemented, "method QuitWorker not implemented")
   163  }
   164  func (UnimplementedWorkerServiceServer) mustEmbedUnimplementedWorkerServiceServer() {}
   165  
   166  // UnsafeWorkerServiceServer may be embedded to opt out of forward compatibility for this service.
   167  // Use of this interface is not recommended, as added methods to WorkerServiceServer will
   168  // result in compilation errors.
   169  type UnsafeWorkerServiceServer interface {
   170  	mustEmbedUnimplementedWorkerServiceServer()
   171  }
   172  
   173  func RegisterWorkerServiceServer(s grpc.ServiceRegistrar, srv WorkerServiceServer) {
   174  	s.RegisterService(&WorkerService_ServiceDesc, srv)
   175  }
   176  
   177  func _WorkerService_RunServer_Handler(srv interface{}, stream grpc.ServerStream) error {
   178  	return srv.(WorkerServiceServer).RunServer(&grpc.GenericServerStream[ServerArgs, ServerStatus]{ServerStream: stream})
   179  }
   180  
   181  // This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name.
   182  type WorkerService_RunServerServer = grpc.BidiStreamingServer[ServerArgs, ServerStatus]
   183  
   184  func _WorkerService_RunClient_Handler(srv interface{}, stream grpc.ServerStream) error {
   185  	return srv.(WorkerServiceServer).RunClient(&grpc.GenericServerStream[ClientArgs, ClientStatus]{ServerStream: stream})
   186  }
   187  
   188  // This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name.
   189  type WorkerService_RunClientServer = grpc.BidiStreamingServer[ClientArgs, ClientStatus]
   190  
   191  func _WorkerService_CoreCount_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
   192  	in := new(CoreRequest)
   193  	if err := dec(in); err != nil {
   194  		return nil, err
   195  	}
   196  	if interceptor == nil {
   197  		return srv.(WorkerServiceServer).CoreCount(ctx, in)
   198  	}
   199  	info := &grpc.UnaryServerInfo{
   200  		Server:     srv,
   201  		FullMethod: WorkerService_CoreCount_FullMethodName,
   202  	}
   203  	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
   204  		return srv.(WorkerServiceServer).CoreCount(ctx, req.(*CoreRequest))
   205  	}
   206  	return interceptor(ctx, in, info, handler)
   207  }
   208  
   209  func _WorkerService_QuitWorker_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
   210  	in := new(Void)
   211  	if err := dec(in); err != nil {
   212  		return nil, err
   213  	}
   214  	if interceptor == nil {
   215  		return srv.(WorkerServiceServer).QuitWorker(ctx, in)
   216  	}
   217  	info := &grpc.UnaryServerInfo{
   218  		Server:     srv,
   219  		FullMethod: WorkerService_QuitWorker_FullMethodName,
   220  	}
   221  	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
   222  		return srv.(WorkerServiceServer).QuitWorker(ctx, req.(*Void))
   223  	}
   224  	return interceptor(ctx, in, info, handler)
   225  }
   226  
   227  // WorkerService_ServiceDesc is the grpc.ServiceDesc for WorkerService service.
   228  // It's only intended for direct use with grpc.RegisterService,
   229  // and not to be introspected or modified (even as a copy)
   230  var WorkerService_ServiceDesc = grpc.ServiceDesc{
   231  	ServiceName: "grpc.testing.WorkerService",
   232  	HandlerType: (*WorkerServiceServer)(nil),
   233  	Methods: []grpc.MethodDesc{
   234  		{
   235  			MethodName: "CoreCount",
   236  			Handler:    _WorkerService_CoreCount_Handler,
   237  		},
   238  		{
   239  			MethodName: "QuitWorker",
   240  			Handler:    _WorkerService_QuitWorker_Handler,
   241  		},
   242  	},
   243  	Streams: []grpc.StreamDesc{
   244  		{
   245  			StreamName:    "RunServer",
   246  			Handler:       _WorkerService_RunServer_Handler,
   247  			ServerStreams: true,
   248  			ClientStreams: true,
   249  		},
   250  		{
   251  			StreamName:    "RunClient",
   252  			Handler:       _WorkerService_RunClient_Handler,
   253  			ServerStreams: true,
   254  			ClientStreams: true,
   255  		},
   256  	},
   257  	Metadata: "grpc/testing/worker_service.proto",
   258  }
   259  

View as plain text