google.golang.org/grpc@v1.62.1/interop/grpc_testing/worker_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.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.32.0 or later.
    36  const _ = grpc.SupportPackageIsVersion7
    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) (WorkerService_RunServerClient, 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) (WorkerService_RunClientClient, 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) (WorkerService_RunServerClient, error) {
    78  	stream, err := c.cc.NewStream(ctx, &WorkerService_ServiceDesc.Streams[0], WorkerService_RunServer_FullMethodName, opts...)
    79  	if err != nil {
    80  		return nil, err
    81  	}
    82  	x := &workerServiceRunServerClient{stream}
    83  	return x, nil
    84  }
    85  
    86  type WorkerService_RunServerClient interface {
    87  	Send(*ServerArgs) error
    88  	Recv() (*ServerStatus, error)
    89  	grpc.ClientStream
    90  }
    91  
    92  type workerServiceRunServerClient struct {
    93  	grpc.ClientStream
    94  }
    95  
    96  func (x *workerServiceRunServerClient) Send(m *ServerArgs) error {
    97  	return x.ClientStream.SendMsg(m)
    98  }
    99  
   100  func (x *workerServiceRunServerClient) Recv() (*ServerStatus, error) {
   101  	m := new(ServerStatus)
   102  	if err := x.ClientStream.RecvMsg(m); err != nil {
   103  		return nil, err
   104  	}
   105  	return m, nil
   106  }
   107  
   108  func (c *workerServiceClient) RunClient(ctx context.Context, opts ...grpc.CallOption) (WorkerService_RunClientClient, error) {
   109  	stream, err := c.cc.NewStream(ctx, &WorkerService_ServiceDesc.Streams[1], WorkerService_RunClient_FullMethodName, opts...)
   110  	if err != nil {
   111  		return nil, err
   112  	}
   113  	x := &workerServiceRunClientClient{stream}
   114  	return x, nil
   115  }
   116  
   117  type WorkerService_RunClientClient interface {
   118  	Send(*ClientArgs) error
   119  	Recv() (*ClientStatus, error)
   120  	grpc.ClientStream
   121  }
   122  
   123  type workerServiceRunClientClient struct {
   124  	grpc.ClientStream
   125  }
   126  
   127  func (x *workerServiceRunClientClient) Send(m *ClientArgs) error {
   128  	return x.ClientStream.SendMsg(m)
   129  }
   130  
   131  func (x *workerServiceRunClientClient) Recv() (*ClientStatus, error) {
   132  	m := new(ClientStatus)
   133  	if err := x.ClientStream.RecvMsg(m); err != nil {
   134  		return nil, err
   135  	}
   136  	return m, nil
   137  }
   138  
   139  func (c *workerServiceClient) CoreCount(ctx context.Context, in *CoreRequest, opts ...grpc.CallOption) (*CoreResponse, error) {
   140  	out := new(CoreResponse)
   141  	err := c.cc.Invoke(ctx, WorkerService_CoreCount_FullMethodName, in, out, opts...)
   142  	if err != nil {
   143  		return nil, err
   144  	}
   145  	return out, nil
   146  }
   147  
   148  func (c *workerServiceClient) QuitWorker(ctx context.Context, in *Void, opts ...grpc.CallOption) (*Void, error) {
   149  	out := new(Void)
   150  	err := c.cc.Invoke(ctx, WorkerService_QuitWorker_FullMethodName, in, out, opts...)
   151  	if err != nil {
   152  		return nil, err
   153  	}
   154  	return out, nil
   155  }
   156  
   157  // WorkerServiceServer is the server API for WorkerService service.
   158  // All implementations must embed UnimplementedWorkerServiceServer
   159  // for forward compatibility
   160  type WorkerServiceServer interface {
   161  	// Start server with specified workload.
   162  	// First request sent specifies the ServerConfig followed by ServerStatus
   163  	// response. After that, a "Mark" can be sent anytime to request the latest
   164  	// stats. Closing the stream will initiate shutdown of the test server
   165  	// and once the shutdown has finished, the OK status is sent to terminate
   166  	// this RPC.
   167  	RunServer(WorkerService_RunServerServer) error
   168  	// Start client with specified workload.
   169  	// First request sent specifies the ClientConfig followed by ClientStatus
   170  	// response. After that, a "Mark" can be sent anytime to request the latest
   171  	// stats. Closing the stream will initiate shutdown of the test client
   172  	// and once the shutdown has finished, the OK status is sent to terminate
   173  	// this RPC.
   174  	RunClient(WorkerService_RunClientServer) error
   175  	// Just return the core count - unary call
   176  	CoreCount(context.Context, *CoreRequest) (*CoreResponse, error)
   177  	// Quit this worker
   178  	QuitWorker(context.Context, *Void) (*Void, error)
   179  	mustEmbedUnimplementedWorkerServiceServer()
   180  }
   181  
   182  // UnimplementedWorkerServiceServer must be embedded to have forward compatible implementations.
   183  type UnimplementedWorkerServiceServer struct {
   184  }
   185  
   186  func (UnimplementedWorkerServiceServer) RunServer(WorkerService_RunServerServer) error {
   187  	return status.Errorf(codes.Unimplemented, "method RunServer not implemented")
   188  }
   189  func (UnimplementedWorkerServiceServer) RunClient(WorkerService_RunClientServer) error {
   190  	return status.Errorf(codes.Unimplemented, "method RunClient not implemented")
   191  }
   192  func (UnimplementedWorkerServiceServer) CoreCount(context.Context, *CoreRequest) (*CoreResponse, error) {
   193  	return nil, status.Errorf(codes.Unimplemented, "method CoreCount not implemented")
   194  }
   195  func (UnimplementedWorkerServiceServer) QuitWorker(context.Context, *Void) (*Void, error) {
   196  	return nil, status.Errorf(codes.Unimplemented, "method QuitWorker not implemented")
   197  }
   198  func (UnimplementedWorkerServiceServer) mustEmbedUnimplementedWorkerServiceServer() {}
   199  
   200  // UnsafeWorkerServiceServer may be embedded to opt out of forward compatibility for this service.
   201  // Use of this interface is not recommended, as added methods to WorkerServiceServer will
   202  // result in compilation errors.
   203  type UnsafeWorkerServiceServer interface {
   204  	mustEmbedUnimplementedWorkerServiceServer()
   205  }
   206  
   207  func RegisterWorkerServiceServer(s grpc.ServiceRegistrar, srv WorkerServiceServer) {
   208  	s.RegisterService(&WorkerService_ServiceDesc, srv)
   209  }
   210  
   211  func _WorkerService_RunServer_Handler(srv interface{}, stream grpc.ServerStream) error {
   212  	return srv.(WorkerServiceServer).RunServer(&workerServiceRunServerServer{stream})
   213  }
   214  
   215  type WorkerService_RunServerServer interface {
   216  	Send(*ServerStatus) error
   217  	Recv() (*ServerArgs, error)
   218  	grpc.ServerStream
   219  }
   220  
   221  type workerServiceRunServerServer struct {
   222  	grpc.ServerStream
   223  }
   224  
   225  func (x *workerServiceRunServerServer) Send(m *ServerStatus) error {
   226  	return x.ServerStream.SendMsg(m)
   227  }
   228  
   229  func (x *workerServiceRunServerServer) Recv() (*ServerArgs, error) {
   230  	m := new(ServerArgs)
   231  	if err := x.ServerStream.RecvMsg(m); err != nil {
   232  		return nil, err
   233  	}
   234  	return m, nil
   235  }
   236  
   237  func _WorkerService_RunClient_Handler(srv interface{}, stream grpc.ServerStream) error {
   238  	return srv.(WorkerServiceServer).RunClient(&workerServiceRunClientServer{stream})
   239  }
   240  
   241  type WorkerService_RunClientServer interface {
   242  	Send(*ClientStatus) error
   243  	Recv() (*ClientArgs, error)
   244  	grpc.ServerStream
   245  }
   246  
   247  type workerServiceRunClientServer struct {
   248  	grpc.ServerStream
   249  }
   250  
   251  func (x *workerServiceRunClientServer) Send(m *ClientStatus) error {
   252  	return x.ServerStream.SendMsg(m)
   253  }
   254  
   255  func (x *workerServiceRunClientServer) Recv() (*ClientArgs, error) {
   256  	m := new(ClientArgs)
   257  	if err := x.ServerStream.RecvMsg(m); err != nil {
   258  		return nil, err
   259  	}
   260  	return m, nil
   261  }
   262  
   263  func _WorkerService_CoreCount_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
   264  	in := new(CoreRequest)
   265  	if err := dec(in); err != nil {
   266  		return nil, err
   267  	}
   268  	if interceptor == nil {
   269  		return srv.(WorkerServiceServer).CoreCount(ctx, in)
   270  	}
   271  	info := &grpc.UnaryServerInfo{
   272  		Server:     srv,
   273  		FullMethod: WorkerService_CoreCount_FullMethodName,
   274  	}
   275  	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
   276  		return srv.(WorkerServiceServer).CoreCount(ctx, req.(*CoreRequest))
   277  	}
   278  	return interceptor(ctx, in, info, handler)
   279  }
   280  
   281  func _WorkerService_QuitWorker_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
   282  	in := new(Void)
   283  	if err := dec(in); err != nil {
   284  		return nil, err
   285  	}
   286  	if interceptor == nil {
   287  		return srv.(WorkerServiceServer).QuitWorker(ctx, in)
   288  	}
   289  	info := &grpc.UnaryServerInfo{
   290  		Server:     srv,
   291  		FullMethod: WorkerService_QuitWorker_FullMethodName,
   292  	}
   293  	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
   294  		return srv.(WorkerServiceServer).QuitWorker(ctx, req.(*Void))
   295  	}
   296  	return interceptor(ctx, in, info, handler)
   297  }
   298  
   299  // WorkerService_ServiceDesc is the grpc.ServiceDesc for WorkerService service.
   300  // It's only intended for direct use with grpc.RegisterService,
   301  // and not to be introspected or modified (even as a copy)
   302  var WorkerService_ServiceDesc = grpc.ServiceDesc{
   303  	ServiceName: "grpc.testing.WorkerService",
   304  	HandlerType: (*WorkerServiceServer)(nil),
   305  	Methods: []grpc.MethodDesc{
   306  		{
   307  			MethodName: "CoreCount",
   308  			Handler:    _WorkerService_CoreCount_Handler,
   309  		},
   310  		{
   311  			MethodName: "QuitWorker",
   312  			Handler:    _WorkerService_QuitWorker_Handler,
   313  		},
   314  	},
   315  	Streams: []grpc.StreamDesc{
   316  		{
   317  			StreamName:    "RunServer",
   318  			Handler:       _WorkerService_RunServer_Handler,
   319  			ServerStreams: true,
   320  			ClientStreams: true,
   321  		},
   322  		{
   323  			StreamName:    "RunClient",
   324  			Handler:       _WorkerService_RunClient_Handler,
   325  			ServerStreams: true,
   326  			ClientStreams: true,
   327  		},
   328  	},
   329  	Metadata: "grpc/testing/worker_service.proto",
   330  }