worker_grpc.pb.go 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121
  1. // Code generated by protoc-gen-go-grpc. DO NOT EDIT.
  2. // versions:
  3. // - protoc-gen-go-grpc v1.5.1
  4. // - protoc v5.29.3
  5. // source: worker.proto
  6. package worker_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. WorkerService_WorkerStream_FullMethodName = "/worker_pb.WorkerService/WorkerStream"
  19. )
  20. // WorkerServiceClient is the client API for WorkerService 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. //
  24. // WorkerService provides bidirectional communication between admin and worker
  25. type WorkerServiceClient interface {
  26. // WorkerStream maintains a bidirectional stream for worker communication
  27. WorkerStream(ctx context.Context, opts ...grpc.CallOption) (grpc.BidiStreamingClient[WorkerMessage, AdminMessage], error)
  28. }
  29. type workerServiceClient struct {
  30. cc grpc.ClientConnInterface
  31. }
  32. func NewWorkerServiceClient(cc grpc.ClientConnInterface) WorkerServiceClient {
  33. return &workerServiceClient{cc}
  34. }
  35. func (c *workerServiceClient) WorkerStream(ctx context.Context, opts ...grpc.CallOption) (grpc.BidiStreamingClient[WorkerMessage, AdminMessage], error) {
  36. cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
  37. stream, err := c.cc.NewStream(ctx, &WorkerService_ServiceDesc.Streams[0], WorkerService_WorkerStream_FullMethodName, cOpts...)
  38. if err != nil {
  39. return nil, err
  40. }
  41. x := &grpc.GenericClientStream[WorkerMessage, AdminMessage]{ClientStream: stream}
  42. return x, nil
  43. }
  44. // This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name.
  45. type WorkerService_WorkerStreamClient = grpc.BidiStreamingClient[WorkerMessage, AdminMessage]
  46. // WorkerServiceServer is the server API for WorkerService service.
  47. // All implementations must embed UnimplementedWorkerServiceServer
  48. // for forward compatibility.
  49. //
  50. // WorkerService provides bidirectional communication between admin and worker
  51. type WorkerServiceServer interface {
  52. // WorkerStream maintains a bidirectional stream for worker communication
  53. WorkerStream(grpc.BidiStreamingServer[WorkerMessage, AdminMessage]) error
  54. mustEmbedUnimplementedWorkerServiceServer()
  55. }
  56. // UnimplementedWorkerServiceServer 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 UnimplementedWorkerServiceServer struct{}
  62. func (UnimplementedWorkerServiceServer) WorkerStream(grpc.BidiStreamingServer[WorkerMessage, AdminMessage]) error {
  63. return status.Errorf(codes.Unimplemented, "method WorkerStream not implemented")
  64. }
  65. func (UnimplementedWorkerServiceServer) mustEmbedUnimplementedWorkerServiceServer() {}
  66. func (UnimplementedWorkerServiceServer) testEmbeddedByValue() {}
  67. // UnsafeWorkerServiceServer may be embedded to opt out of forward compatibility for this service.
  68. // Use of this interface is not recommended, as added methods to WorkerServiceServer will
  69. // result in compilation errors.
  70. type UnsafeWorkerServiceServer interface {
  71. mustEmbedUnimplementedWorkerServiceServer()
  72. }
  73. func RegisterWorkerServiceServer(s grpc.ServiceRegistrar, srv WorkerServiceServer) {
  74. // If the following call pancis, it indicates UnimplementedWorkerServiceServer 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(&WorkerService_ServiceDesc, srv)
  82. }
  83. func _WorkerService_WorkerStream_Handler(srv interface{}, stream grpc.ServerStream) error {
  84. return srv.(WorkerServiceServer).WorkerStream(&grpc.GenericServerStream[WorkerMessage, AdminMessage]{ServerStream: stream})
  85. }
  86. // This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name.
  87. type WorkerService_WorkerStreamServer = grpc.BidiStreamingServer[WorkerMessage, AdminMessage]
  88. // WorkerService_ServiceDesc is the grpc.ServiceDesc for WorkerService service.
  89. // It's only intended for direct use with grpc.RegisterService,
  90. // and not to be introspected or modified (even as a copy)
  91. var WorkerService_ServiceDesc = grpc.ServiceDesc{
  92. ServiceName: "worker_pb.WorkerService",
  93. HandlerType: (*WorkerServiceServer)(nil),
  94. Methods: []grpc.MethodDesc{},
  95. Streams: []grpc.StreamDesc{
  96. {
  97. StreamName: "WorkerStream",
  98. Handler: _WorkerService_WorkerStream_Handler,
  99. ServerStreams: true,
  100. ClientStreams: true,
  101. },
  102. },
  103. Metadata: "worker.proto",
  104. }