service_grpc.pb.go 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124
  1. // Code generated by protoc-gen-go-grpc. DO NOT EDIT.
  2. // versions:
  3. // - protoc-gen-go-grpc v1.5.1
  4. // - protoc v6.31.1
  5. // source: service.proto
  6. package pb
  7. import (
  8. context "context"
  9. grpc "google.golang.org/grpc"
  10. codes "google.golang.org/grpc/codes"
  11. status "google.golang.org/grpc/status"
  12. )
  13. // This is a compile-time assertion to ensure that this generated file
  14. // is compatible with the grpc package it is being compiled against.
  15. // Requires gRPC-Go v1.64.0 or later.
  16. const _ = grpc.SupportPackageIsVersion9
  17. const (
  18. Service_Download_FullMethodName = "/pb.Service/Download"
  19. )
  20. // ServiceClient is the client API for Service service.
  21. //
  22. // 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.
  23. type ServiceClient interface {
  24. Download(ctx context.Context, in *Request, opts ...grpc.CallOption) (grpc.ServerStreamingClient[Response], error)
  25. }
  26. type serviceClient struct {
  27. cc grpc.ClientConnInterface
  28. }
  29. func NewServiceClient(cc grpc.ClientConnInterface) ServiceClient {
  30. return &serviceClient{cc}
  31. }
  32. func (c *serviceClient) Download(ctx context.Context, in *Request, opts ...grpc.CallOption) (grpc.ServerStreamingClient[Response], error) {
  33. cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
  34. stream, err := c.cc.NewStream(ctx, &Service_ServiceDesc.Streams[0], Service_Download_FullMethodName, cOpts...)
  35. if err != nil {
  36. return nil, err
  37. }
  38. x := &grpc.GenericClientStream[Request, Response]{ClientStream: stream}
  39. if err := x.ClientStream.SendMsg(in); err != nil {
  40. return nil, err
  41. }
  42. if err := x.ClientStream.CloseSend(); err != nil {
  43. return nil, err
  44. }
  45. return x, nil
  46. }
  47. // This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name.
  48. type Service_DownloadClient = grpc.ServerStreamingClient[Response]
  49. // ServiceServer is the server API for Service service.
  50. // All implementations must embed UnimplementedServiceServer
  51. // for forward compatibility.
  52. type ServiceServer interface {
  53. Download(*Request, grpc.ServerStreamingServer[Response]) error
  54. mustEmbedUnimplementedServiceServer()
  55. }
  56. // UnimplementedServiceServer must be embedded to have
  57. // forward compatible implementations.
  58. //
  59. // NOTE: this should be embedded by value instead of pointer to avoid a nil
  60. // pointer dereference when methods are called.
  61. type UnimplementedServiceServer struct{}
  62. func (UnimplementedServiceServer) Download(*Request, grpc.ServerStreamingServer[Response]) error {
  63. return status.Errorf(codes.Unimplemented, "method Download not implemented")
  64. }
  65. func (UnimplementedServiceServer) mustEmbedUnimplementedServiceServer() {}
  66. func (UnimplementedServiceServer) testEmbeddedByValue() {}
  67. // UnsafeServiceServer may be embedded to opt out of forward compatibility for this service.
  68. // Use of this interface is not recommended, as added methods to ServiceServer will
  69. // result in compilation errors.
  70. type UnsafeServiceServer interface {
  71. mustEmbedUnimplementedServiceServer()
  72. }
  73. func RegisterServiceServer(s grpc.ServiceRegistrar, srv ServiceServer) {
  74. // If the following call pancis, it indicates UnimplementedServiceServer was
  75. // embedded by pointer and is nil. This will cause panics if an
  76. // unimplemented method is ever invoked, so we test this at initialization
  77. // time to prevent it from happening at runtime later due to I/O.
  78. if t, ok := srv.(interface{ testEmbeddedByValue() }); ok {
  79. t.testEmbeddedByValue()
  80. }
  81. s.RegisterService(&Service_ServiceDesc, srv)
  82. }
  83. func _Service_Download_Handler(srv interface{}, stream grpc.ServerStream) error {
  84. m := new(Request)
  85. if err := stream.RecvMsg(m); err != nil {
  86. return err
  87. }
  88. return srv.(ServiceServer).Download(m, &grpc.GenericServerStream[Request, Response]{ServerStream: stream})
  89. }
  90. // This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name.
  91. type Service_DownloadServer = grpc.ServerStreamingServer[Response]
  92. // Service_ServiceDesc is the grpc.ServiceDesc for Service service.
  93. // It's only intended for direct use with grpc.RegisterService,
  94. // and not to be introspected or modified (even as a copy)
  95. var Service_ServiceDesc = grpc.ServiceDesc{
  96. ServiceName: "pb.Service",
  97. HandlerType: (*ServiceServer)(nil),
  98. Methods: []grpc.MethodDesc{},
  99. Streams: []grpc.StreamDesc{
  100. {
  101. StreamName: "Download",
  102. Handler: _Service_Download_Handler,
  103. ServerStreams: true,
  104. },
  105. },
  106. Metadata: "service.proto",
  107. }