github.com/weedge/lib@v0.0.0-20230424045628-a36dcc1d90e4/client/etcd/cmd/pb/origin-hello_grpc.pb.go (about)

     1  // Code generated by protoc-gen-go-grpc. DO NOT EDIT.
     2  
     3  package pb
     4  
     5  import (
     6  	context "context"
     7  	grpc "google.golang.org/grpc"
     8  	codes "google.golang.org/grpc/codes"
     9  	status "google.golang.org/grpc/status"
    10  )
    11  
    12  // This is a compile-time assertion to ensure that this generated file
    13  // is compatible with the grpc package it is being compiled against.
    14  // Requires gRPC-Go v1.32.0 or later.
    15  const _ = grpc.SupportPackageIsVersion7
    16  
    17  // HelloClient is the client API for Hello service.
    18  //
    19  // 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.
    20  type HelloClient interface {
    21  	Echo(ctx context.Context, in *EchoRequest, opts ...grpc.CallOption) (*EchoRequest, error)
    22  	Stream(ctx context.Context, in *EchoRequest, opts ...grpc.CallOption) (Hello_StreamClient, error)
    23  }
    24  
    25  type helloClient struct {
    26  	cc grpc.ClientConnInterface
    27  }
    28  
    29  func NewHelloClient(cc grpc.ClientConnInterface) HelloClient {
    30  	return &helloClient{cc}
    31  }
    32  
    33  func (c *helloClient) Echo(ctx context.Context, in *EchoRequest, opts ...grpc.CallOption) (*EchoRequest, error) {
    34  	out := new(EchoRequest)
    35  	err := c.cc.Invoke(ctx, "/Hello/Echo", in, out, opts...)
    36  	if err != nil {
    37  		return nil, err
    38  	}
    39  	return out, nil
    40  }
    41  
    42  func (c *helloClient) Stream(ctx context.Context, in *EchoRequest, opts ...grpc.CallOption) (Hello_StreamClient, error) {
    43  	stream, err := c.cc.NewStream(ctx, &Hello_ServiceDesc.Streams[0], "/Hello/Stream", opts...)
    44  	if err != nil {
    45  		return nil, err
    46  	}
    47  	x := &helloStreamClient{stream}
    48  	if err := x.ClientStream.SendMsg(in); err != nil {
    49  		return nil, err
    50  	}
    51  	if err := x.ClientStream.CloseSend(); err != nil {
    52  		return nil, err
    53  	}
    54  	return x, nil
    55  }
    56  
    57  type Hello_StreamClient interface {
    58  	Recv() (*EchoRequest, error)
    59  	grpc.ClientStream
    60  }
    61  
    62  type helloStreamClient struct {
    63  	grpc.ClientStream
    64  }
    65  
    66  func (x *helloStreamClient) Recv() (*EchoRequest, error) {
    67  	m := new(EchoRequest)
    68  	if err := x.ClientStream.RecvMsg(m); err != nil {
    69  		return nil, err
    70  	}
    71  	return m, nil
    72  }
    73  
    74  // HelloServer is the server API for Hello service.
    75  // All implementations must embed UnimplementedHelloServer
    76  // for forward compatibility
    77  type HelloServer interface {
    78  	Echo(context.Context, *EchoRequest) (*EchoRequest, error)
    79  	Stream(*EchoRequest, Hello_StreamServer) error
    80  	mustEmbedUnimplementedHelloServer()
    81  }
    82  
    83  // UnimplementedHelloServer must be embedded to have forward compatible implementations.
    84  type UnimplementedHelloServer struct {
    85  }
    86  
    87  func (UnimplementedHelloServer) Echo(context.Context, *EchoRequest) (*EchoRequest, error) {
    88  	return nil, status.Errorf(codes.Unimplemented, "method Echo not implemented")
    89  }
    90  func (UnimplementedHelloServer) Stream(*EchoRequest, Hello_StreamServer) error {
    91  	return status.Errorf(codes.Unimplemented, "method Stream not implemented")
    92  }
    93  func (UnimplementedHelloServer) mustEmbedUnimplementedHelloServer() {}
    94  
    95  // UnsafeHelloServer may be embedded to opt out of forward compatibility for this service.
    96  // Use of this interface is not recommended, as added methods to HelloServer will
    97  // result in compilation errors.
    98  type UnsafeHelloServer interface {
    99  	mustEmbedUnimplementedHelloServer()
   100  }
   101  
   102  func RegisterHelloServer(s grpc.ServiceRegistrar, srv HelloServer) {
   103  	s.RegisterService(&Hello_ServiceDesc, srv)
   104  }
   105  
   106  func _Hello_Echo_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
   107  	in := new(EchoRequest)
   108  	if err := dec(in); err != nil {
   109  		return nil, err
   110  	}
   111  	if interceptor == nil {
   112  		return srv.(HelloServer).Echo(ctx, in)
   113  	}
   114  	info := &grpc.UnaryServerInfo{
   115  		Server:     srv,
   116  		FullMethod: "/Hello/Echo",
   117  	}
   118  	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
   119  		return srv.(HelloServer).Echo(ctx, req.(*EchoRequest))
   120  	}
   121  	return interceptor(ctx, in, info, handler)
   122  }
   123  
   124  func _Hello_Stream_Handler(srv interface{}, stream grpc.ServerStream) error {
   125  	m := new(EchoRequest)
   126  	if err := stream.RecvMsg(m); err != nil {
   127  		return err
   128  	}
   129  	return srv.(HelloServer).Stream(m, &helloStreamServer{stream})
   130  }
   131  
   132  type Hello_StreamServer interface {
   133  	Send(*EchoRequest) error
   134  	grpc.ServerStream
   135  }
   136  
   137  type helloStreamServer struct {
   138  	grpc.ServerStream
   139  }
   140  
   141  func (x *helloStreamServer) Send(m *EchoRequest) error {
   142  	return x.ServerStream.SendMsg(m)
   143  }
   144  
   145  // Hello_ServiceDesc is the grpc.ServiceDesc for Hello service.
   146  // It's only intended for direct use with grpc.RegisterService,
   147  // and not to be introspected or modified (even as a copy)
   148  var Hello_ServiceDesc = grpc.ServiceDesc{
   149  	ServiceName: "Hello",
   150  	HandlerType: (*HelloServer)(nil),
   151  	Methods: []grpc.MethodDesc{
   152  		{
   153  			MethodName: "Echo",
   154  			Handler:    _Hello_Echo_Handler,
   155  		},
   156  	},
   157  	Streams: []grpc.StreamDesc{
   158  		{
   159  			StreamName:    "Stream",
   160  			Handler:       _Hello_Stream_Handler,
   161  			ServerStreams: true,
   162  		},
   163  	},
   164  	Metadata: "pb/origin-hello.proto",
   165  }