github.com/hxx258456/ccgo@v0.0.5-0.20230213014102-48b35f46f66f/grpc/interop/grpc_testing/worker_service_grpc.pb.go (about)

     1  // Code generated by protoc-gen-go-grpc. DO NOT EDIT.
     2  // versions:
     3  // - protoc-gen-go-grpc v1.2.0
     4  // - protoc             v3.14.0
     5  // source: grpc/testing/worker_service.proto
     6  
     7  package grpc_testing
     8  
     9  import (
    10  	context "context"
    11  	grpc "github.com/hxx258456/ccgo/grpc"
    12  	codes "github.com/hxx258456/ccgo/grpc/codes"
    13  	status "github.com/hxx258456/ccgo/grpc/status"
    14  )
    15  
    16  // This is a compile-time assertion to ensure that this generated file
    17  // is compatible with the grpc package it is being compiled against.
    18  // Requires gRPC-Go v1.32.0 or later.
    19  const _ = grpc.SupportPackageIsVersion7
    20  
    21  // WorkerServiceClient is the client API for WorkerService service.
    22  //
    23  // 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.
    24  type WorkerServiceClient interface {
    25  	// Start server with specified workload.
    26  	// First request sent specifies the ServerConfig followed by ServerStatus
    27  	// response. After that, a "Mark" can be sent anytime to request the latest
    28  	// stats. Closing the stream will initiate shutdown of the test server
    29  	// and once the shutdown has finished, the OK status is sent to terminate
    30  	// this RPC.
    31  	RunServer(ctx context.Context, opts ...grpc.CallOption) (WorkerService_RunServerClient, error)
    32  	// Start client with specified workload.
    33  	// First request sent specifies the ClientConfig followed by ClientStatus
    34  	// response. After that, a "Mark" can be sent anytime to request the latest
    35  	// stats. Closing the stream will initiate shutdown of the test client
    36  	// and once the shutdown has finished, the OK status is sent to terminate
    37  	// this RPC.
    38  	RunClient(ctx context.Context, opts ...grpc.CallOption) (WorkerService_RunClientClient, error)
    39  	// Just return the core count - unary call
    40  	CoreCount(ctx context.Context, in *CoreRequest, opts ...grpc.CallOption) (*CoreResponse, error)
    41  	// Quit this worker
    42  	QuitWorker(ctx context.Context, in *Void, opts ...grpc.CallOption) (*Void, error)
    43  }
    44  
    45  type workerServiceClient struct {
    46  	cc grpc.ClientConnInterface
    47  }
    48  
    49  func NewWorkerServiceClient(cc grpc.ClientConnInterface) WorkerServiceClient {
    50  	return &workerServiceClient{cc}
    51  }
    52  
    53  func (c *workerServiceClient) RunServer(ctx context.Context, opts ...grpc.CallOption) (WorkerService_RunServerClient, error) {
    54  	stream, err := c.cc.NewStream(ctx, &WorkerService_ServiceDesc.Streams[0], "/grpc.testing.WorkerService/RunServer", opts...)
    55  	if err != nil {
    56  		return nil, err
    57  	}
    58  	x := &workerServiceRunServerClient{stream}
    59  	return x, nil
    60  }
    61  
    62  type WorkerService_RunServerClient interface {
    63  	Send(*ServerArgs) error
    64  	Recv() (*ServerStatus, error)
    65  	grpc.ClientStream
    66  }
    67  
    68  type workerServiceRunServerClient struct {
    69  	grpc.ClientStream
    70  }
    71  
    72  func (x *workerServiceRunServerClient) Send(m *ServerArgs) error {
    73  	return x.ClientStream.SendMsg(m)
    74  }
    75  
    76  func (x *workerServiceRunServerClient) Recv() (*ServerStatus, error) {
    77  	m := new(ServerStatus)
    78  	if err := x.ClientStream.RecvMsg(m); err != nil {
    79  		return nil, err
    80  	}
    81  	return m, nil
    82  }
    83  
    84  func (c *workerServiceClient) RunClient(ctx context.Context, opts ...grpc.CallOption) (WorkerService_RunClientClient, error) {
    85  	stream, err := c.cc.NewStream(ctx, &WorkerService_ServiceDesc.Streams[1], "/grpc.testing.WorkerService/RunClient", opts...)
    86  	if err != nil {
    87  		return nil, err
    88  	}
    89  	x := &workerServiceRunClientClient{stream}
    90  	return x, nil
    91  }
    92  
    93  type WorkerService_RunClientClient interface {
    94  	Send(*ClientArgs) error
    95  	Recv() (*ClientStatus, error)
    96  	grpc.ClientStream
    97  }
    98  
    99  type workerServiceRunClientClient struct {
   100  	grpc.ClientStream
   101  }
   102  
   103  func (x *workerServiceRunClientClient) Send(m *ClientArgs) error {
   104  	return x.ClientStream.SendMsg(m)
   105  }
   106  
   107  func (x *workerServiceRunClientClient) Recv() (*ClientStatus, error) {
   108  	m := new(ClientStatus)
   109  	if err := x.ClientStream.RecvMsg(m); err != nil {
   110  		return nil, err
   111  	}
   112  	return m, nil
   113  }
   114  
   115  func (c *workerServiceClient) CoreCount(ctx context.Context, in *CoreRequest, opts ...grpc.CallOption) (*CoreResponse, error) {
   116  	out := new(CoreResponse)
   117  	err := c.cc.Invoke(ctx, "/grpc.testing.WorkerService/CoreCount", in, out, opts...)
   118  	if err != nil {
   119  		return nil, err
   120  	}
   121  	return out, nil
   122  }
   123  
   124  func (c *workerServiceClient) QuitWorker(ctx context.Context, in *Void, opts ...grpc.CallOption) (*Void, error) {
   125  	out := new(Void)
   126  	err := c.cc.Invoke(ctx, "/grpc.testing.WorkerService/QuitWorker", in, out, opts...)
   127  	if err != nil {
   128  		return nil, err
   129  	}
   130  	return out, nil
   131  }
   132  
   133  // WorkerServiceServer is the server API for WorkerService service.
   134  // All implementations must embed UnimplementedWorkerServiceServer
   135  // for forward compatibility
   136  type WorkerServiceServer interface {
   137  	// Start server with specified workload.
   138  	// First request sent specifies the ServerConfig followed by ServerStatus
   139  	// response. After that, a "Mark" can be sent anytime to request the latest
   140  	// stats. Closing the stream will initiate shutdown of the test server
   141  	// and once the shutdown has finished, the OK status is sent to terminate
   142  	// this RPC.
   143  	RunServer(WorkerService_RunServerServer) error
   144  	// Start client with specified workload.
   145  	// First request sent specifies the ClientConfig followed by ClientStatus
   146  	// response. After that, a "Mark" can be sent anytime to request the latest
   147  	// stats. Closing the stream will initiate shutdown of the test client
   148  	// and once the shutdown has finished, the OK status is sent to terminate
   149  	// this RPC.
   150  	RunClient(WorkerService_RunClientServer) error
   151  	// Just return the core count - unary call
   152  	CoreCount(context.Context, *CoreRequest) (*CoreResponse, error)
   153  	// Quit this worker
   154  	QuitWorker(context.Context, *Void) (*Void, error)
   155  	mustEmbedUnimplementedWorkerServiceServer()
   156  }
   157  
   158  // UnimplementedWorkerServiceServer must be embedded to have forward compatible implementations.
   159  type UnimplementedWorkerServiceServer struct {
   160  }
   161  
   162  func (UnimplementedWorkerServiceServer) RunServer(WorkerService_RunServerServer) error {
   163  	return status.Errorf(codes.Unimplemented, "method RunServer not implemented")
   164  }
   165  func (UnimplementedWorkerServiceServer) RunClient(WorkerService_RunClientServer) error {
   166  	return status.Errorf(codes.Unimplemented, "method RunClient not implemented")
   167  }
   168  func (UnimplementedWorkerServiceServer) CoreCount(context.Context, *CoreRequest) (*CoreResponse, error) {
   169  	return nil, status.Errorf(codes.Unimplemented, "method CoreCount not implemented")
   170  }
   171  func (UnimplementedWorkerServiceServer) QuitWorker(context.Context, *Void) (*Void, error) {
   172  	return nil, status.Errorf(codes.Unimplemented, "method QuitWorker not implemented")
   173  }
   174  func (UnimplementedWorkerServiceServer) mustEmbedUnimplementedWorkerServiceServer() {}
   175  
   176  // UnsafeWorkerServiceServer may be embedded to opt out of forward compatibility for this service.
   177  // Use of this interface is not recommended, as added methods to WorkerServiceServer will
   178  // result in compilation errors.
   179  type UnsafeWorkerServiceServer interface {
   180  	mustEmbedUnimplementedWorkerServiceServer()
   181  }
   182  
   183  func RegisterWorkerServiceServer(s grpc.ServiceRegistrar, srv WorkerServiceServer) {
   184  	s.RegisterService(&WorkerService_ServiceDesc, srv)
   185  }
   186  
   187  func _WorkerService_RunServer_Handler(srv interface{}, stream grpc.ServerStream) error {
   188  	return srv.(WorkerServiceServer).RunServer(&workerServiceRunServerServer{stream})
   189  }
   190  
   191  type WorkerService_RunServerServer interface {
   192  	Send(*ServerStatus) error
   193  	Recv() (*ServerArgs, error)
   194  	grpc.ServerStream
   195  }
   196  
   197  type workerServiceRunServerServer struct {
   198  	grpc.ServerStream
   199  }
   200  
   201  func (x *workerServiceRunServerServer) Send(m *ServerStatus) error {
   202  	return x.ServerStream.SendMsg(m)
   203  }
   204  
   205  func (x *workerServiceRunServerServer) Recv() (*ServerArgs, error) {
   206  	m := new(ServerArgs)
   207  	if err := x.ServerStream.RecvMsg(m); err != nil {
   208  		return nil, err
   209  	}
   210  	return m, nil
   211  }
   212  
   213  func _WorkerService_RunClient_Handler(srv interface{}, stream grpc.ServerStream) error {
   214  	return srv.(WorkerServiceServer).RunClient(&workerServiceRunClientServer{stream})
   215  }
   216  
   217  type WorkerService_RunClientServer interface {
   218  	Send(*ClientStatus) error
   219  	Recv() (*ClientArgs, error)
   220  	grpc.ServerStream
   221  }
   222  
   223  type workerServiceRunClientServer struct {
   224  	grpc.ServerStream
   225  }
   226  
   227  func (x *workerServiceRunClientServer) Send(m *ClientStatus) error {
   228  	return x.ServerStream.SendMsg(m)
   229  }
   230  
   231  func (x *workerServiceRunClientServer) Recv() (*ClientArgs, error) {
   232  	m := new(ClientArgs)
   233  	if err := x.ServerStream.RecvMsg(m); err != nil {
   234  		return nil, err
   235  	}
   236  	return m, nil
   237  }
   238  
   239  func _WorkerService_CoreCount_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
   240  	in := new(CoreRequest)
   241  	if err := dec(in); err != nil {
   242  		return nil, err
   243  	}
   244  	if interceptor == nil {
   245  		return srv.(WorkerServiceServer).CoreCount(ctx, in)
   246  	}
   247  	info := &grpc.UnaryServerInfo{
   248  		Server:     srv,
   249  		FullMethod: "/grpc.testing.WorkerService/CoreCount",
   250  	}
   251  	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
   252  		return srv.(WorkerServiceServer).CoreCount(ctx, req.(*CoreRequest))
   253  	}
   254  	return interceptor(ctx, in, info, handler)
   255  }
   256  
   257  func _WorkerService_QuitWorker_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
   258  	in := new(Void)
   259  	if err := dec(in); err != nil {
   260  		return nil, err
   261  	}
   262  	if interceptor == nil {
   263  		return srv.(WorkerServiceServer).QuitWorker(ctx, in)
   264  	}
   265  	info := &grpc.UnaryServerInfo{
   266  		Server:     srv,
   267  		FullMethod: "/grpc.testing.WorkerService/QuitWorker",
   268  	}
   269  	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
   270  		return srv.(WorkerServiceServer).QuitWorker(ctx, req.(*Void))
   271  	}
   272  	return interceptor(ctx, in, info, handler)
   273  }
   274  
   275  // WorkerService_ServiceDesc is the grpc.ServiceDesc for WorkerService service.
   276  // It's only intended for direct use with grpc.RegisterService,
   277  // and not to be introspected or modified (even as a copy)
   278  var WorkerService_ServiceDesc = grpc.ServiceDesc{
   279  	ServiceName: "grpc.testing.WorkerService",
   280  	HandlerType: (*WorkerServiceServer)(nil),
   281  	Methods: []grpc.MethodDesc{
   282  		{
   283  			MethodName: "CoreCount",
   284  			Handler:    _WorkerService_CoreCount_Handler,
   285  		},
   286  		{
   287  			MethodName: "QuitWorker",
   288  			Handler:    _WorkerService_QuitWorker_Handler,
   289  		},
   290  	},
   291  	Streams: []grpc.StreamDesc{
   292  		{
   293  			StreamName:    "RunServer",
   294  			Handler:       _WorkerService_RunServer_Handler,
   295  			ServerStreams: true,
   296  			ClientStreams: true,
   297  		},
   298  		{
   299  			StreamName:    "RunClient",
   300  			Handler:       _WorkerService_RunClient_Handler,
   301  			ServerStreams: true,
   302  			ClientStreams: true,
   303  		},
   304  	},
   305  	Metadata: "grpc/testing/worker_service.proto",
   306  }