196 lines
8.2 KiB
Go
196 lines
8.2 KiB
Go
|
|
// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
|
||
|
|
// versions:
|
||
|
|
// - protoc-gen-go-grpc v1.5.1
|
||
|
|
// - protoc v6.32.0
|
||
|
|
// source: task.proto
|
||
|
|
|
||
|
|
package taskProcessor
|
||
|
|
|
||
|
|
import (
|
||
|
|
context "context"
|
||
|
|
grpc "google.golang.org/grpc"
|
||
|
|
codes "google.golang.org/grpc/codes"
|
||
|
|
status "google.golang.org/grpc/status"
|
||
|
|
emptypb "google.golang.org/protobuf/types/known/emptypb"
|
||
|
|
)
|
||
|
|
|
||
|
|
// This is a compile-time assertion to ensure that this generated file
|
||
|
|
// is compatible with the grpc package it is being compiled against.
|
||
|
|
// Requires gRPC-Go v1.64.0 or later.
|
||
|
|
const _ = grpc.SupportPackageIsVersion9
|
||
|
|
|
||
|
|
const (
|
||
|
|
TaskProcessor_RequestTask_FullMethodName = "/taskProcessor.TaskProcessor/RequestTask"
|
||
|
|
TaskProcessor_SendResult_FullMethodName = "/taskProcessor.TaskProcessor/SendResult"
|
||
|
|
TaskProcessor_ProcessorStatus_FullMethodName = "/taskProcessor.TaskProcessor/ProcessorStatus"
|
||
|
|
)
|
||
|
|
|
||
|
|
// TaskProcessorClient is the client API for TaskProcessor service.
|
||
|
|
//
|
||
|
|
// 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.
|
||
|
|
type TaskProcessorClient interface {
|
||
|
|
RequestTask(ctx context.Context, in *emptypb.Empty, opts ...grpc.CallOption) (grpc.ServerStreamingClient[Task], error)
|
||
|
|
SendResult(ctx context.Context, opts ...grpc.CallOption) (grpc.ClientStreamingClient[Result, emptypb.Empty], error)
|
||
|
|
ProcessorStatus(ctx context.Context, in *ProcessorStatusRequest, opts ...grpc.CallOption) (*ProcessorStatusResponse, error)
|
||
|
|
}
|
||
|
|
|
||
|
|
type taskProcessorClient struct {
|
||
|
|
cc grpc.ClientConnInterface
|
||
|
|
}
|
||
|
|
|
||
|
|
func NewTaskProcessorClient(cc grpc.ClientConnInterface) TaskProcessorClient {
|
||
|
|
return &taskProcessorClient{cc}
|
||
|
|
}
|
||
|
|
|
||
|
|
func (c *taskProcessorClient) RequestTask(ctx context.Context, in *emptypb.Empty, opts ...grpc.CallOption) (grpc.ServerStreamingClient[Task], error) {
|
||
|
|
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
||
|
|
stream, err := c.cc.NewStream(ctx, &TaskProcessor_ServiceDesc.Streams[0], TaskProcessor_RequestTask_FullMethodName, cOpts...)
|
||
|
|
if err != nil {
|
||
|
|
return nil, err
|
||
|
|
}
|
||
|
|
x := &grpc.GenericClientStream[emptypb.Empty, Task]{ClientStream: stream}
|
||
|
|
if err := x.ClientStream.SendMsg(in); err != nil {
|
||
|
|
return nil, err
|
||
|
|
}
|
||
|
|
if err := x.ClientStream.CloseSend(); err != nil {
|
||
|
|
return nil, err
|
||
|
|
}
|
||
|
|
return x, nil
|
||
|
|
}
|
||
|
|
|
||
|
|
// This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name.
|
||
|
|
type TaskProcessor_RequestTaskClient = grpc.ServerStreamingClient[Task]
|
||
|
|
|
||
|
|
func (c *taskProcessorClient) SendResult(ctx context.Context, opts ...grpc.CallOption) (grpc.ClientStreamingClient[Result, emptypb.Empty], error) {
|
||
|
|
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
||
|
|
stream, err := c.cc.NewStream(ctx, &TaskProcessor_ServiceDesc.Streams[1], TaskProcessor_SendResult_FullMethodName, cOpts...)
|
||
|
|
if err != nil {
|
||
|
|
return nil, err
|
||
|
|
}
|
||
|
|
x := &grpc.GenericClientStream[Result, emptypb.Empty]{ClientStream: stream}
|
||
|
|
return x, nil
|
||
|
|
}
|
||
|
|
|
||
|
|
// This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name.
|
||
|
|
type TaskProcessor_SendResultClient = grpc.ClientStreamingClient[Result, emptypb.Empty]
|
||
|
|
|
||
|
|
func (c *taskProcessorClient) ProcessorStatus(ctx context.Context, in *ProcessorStatusRequest, opts ...grpc.CallOption) (*ProcessorStatusResponse, error) {
|
||
|
|
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
||
|
|
out := new(ProcessorStatusResponse)
|
||
|
|
err := c.cc.Invoke(ctx, TaskProcessor_ProcessorStatus_FullMethodName, in, out, cOpts...)
|
||
|
|
if err != nil {
|
||
|
|
return nil, err
|
||
|
|
}
|
||
|
|
return out, nil
|
||
|
|
}
|
||
|
|
|
||
|
|
// TaskProcessorServer is the server API for TaskProcessor service.
|
||
|
|
// All implementations must embed UnimplementedTaskProcessorServer
|
||
|
|
// for forward compatibility.
|
||
|
|
type TaskProcessorServer interface {
|
||
|
|
RequestTask(*emptypb.Empty, grpc.ServerStreamingServer[Task]) error
|
||
|
|
SendResult(grpc.ClientStreamingServer[Result, emptypb.Empty]) error
|
||
|
|
ProcessorStatus(context.Context, *ProcessorStatusRequest) (*ProcessorStatusResponse, error)
|
||
|
|
mustEmbedUnimplementedTaskProcessorServer()
|
||
|
|
}
|
||
|
|
|
||
|
|
// UnimplementedTaskProcessorServer must be embedded to have
|
||
|
|
// forward compatible implementations.
|
||
|
|
//
|
||
|
|
// NOTE: this should be embedded by value instead of pointer to avoid a nil
|
||
|
|
// pointer dereference when methods are called.
|
||
|
|
type UnimplementedTaskProcessorServer struct{}
|
||
|
|
|
||
|
|
func (UnimplementedTaskProcessorServer) RequestTask(*emptypb.Empty, grpc.ServerStreamingServer[Task]) error {
|
||
|
|
return status.Errorf(codes.Unimplemented, "method RequestTask not implemented")
|
||
|
|
}
|
||
|
|
func (UnimplementedTaskProcessorServer) SendResult(grpc.ClientStreamingServer[Result, emptypb.Empty]) error {
|
||
|
|
return status.Errorf(codes.Unimplemented, "method SendResult not implemented")
|
||
|
|
}
|
||
|
|
func (UnimplementedTaskProcessorServer) ProcessorStatus(context.Context, *ProcessorStatusRequest) (*ProcessorStatusResponse, error) {
|
||
|
|
return nil, status.Errorf(codes.Unimplemented, "method ProcessorStatus not implemented")
|
||
|
|
}
|
||
|
|
func (UnimplementedTaskProcessorServer) mustEmbedUnimplementedTaskProcessorServer() {}
|
||
|
|
func (UnimplementedTaskProcessorServer) testEmbeddedByValue() {}
|
||
|
|
|
||
|
|
// UnsafeTaskProcessorServer may be embedded to opt out of forward compatibility for this service.
|
||
|
|
// Use of this interface is not recommended, as added methods to TaskProcessorServer will
|
||
|
|
// result in compilation errors.
|
||
|
|
type UnsafeTaskProcessorServer interface {
|
||
|
|
mustEmbedUnimplementedTaskProcessorServer()
|
||
|
|
}
|
||
|
|
|
||
|
|
func RegisterTaskProcessorServer(s grpc.ServiceRegistrar, srv TaskProcessorServer) {
|
||
|
|
// If the following call pancis, it indicates UnimplementedTaskProcessorServer was
|
||
|
|
// embedded by pointer and is nil. This will cause panics if an
|
||
|
|
// unimplemented method is ever invoked, so we test this at initialization
|
||
|
|
// time to prevent it from happening at runtime later due to I/O.
|
||
|
|
if t, ok := srv.(interface{ testEmbeddedByValue() }); ok {
|
||
|
|
t.testEmbeddedByValue()
|
||
|
|
}
|
||
|
|
s.RegisterService(&TaskProcessor_ServiceDesc, srv)
|
||
|
|
}
|
||
|
|
|
||
|
|
func _TaskProcessor_RequestTask_Handler(srv interface{}, stream grpc.ServerStream) error {
|
||
|
|
m := new(emptypb.Empty)
|
||
|
|
if err := stream.RecvMsg(m); err != nil {
|
||
|
|
return err
|
||
|
|
}
|
||
|
|
return srv.(TaskProcessorServer).RequestTask(m, &grpc.GenericServerStream[emptypb.Empty, Task]{ServerStream: stream})
|
||
|
|
}
|
||
|
|
|
||
|
|
// This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name.
|
||
|
|
type TaskProcessor_RequestTaskServer = grpc.ServerStreamingServer[Task]
|
||
|
|
|
||
|
|
func _TaskProcessor_SendResult_Handler(srv interface{}, stream grpc.ServerStream) error {
|
||
|
|
return srv.(TaskProcessorServer).SendResult(&grpc.GenericServerStream[Result, emptypb.Empty]{ServerStream: stream})
|
||
|
|
}
|
||
|
|
|
||
|
|
// This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name.
|
||
|
|
type TaskProcessor_SendResultServer = grpc.ClientStreamingServer[Result, emptypb.Empty]
|
||
|
|
|
||
|
|
func _TaskProcessor_ProcessorStatus_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||
|
|
in := new(ProcessorStatusRequest)
|
||
|
|
if err := dec(in); err != nil {
|
||
|
|
return nil, err
|
||
|
|
}
|
||
|
|
if interceptor == nil {
|
||
|
|
return srv.(TaskProcessorServer).ProcessorStatus(ctx, in)
|
||
|
|
}
|
||
|
|
info := &grpc.UnaryServerInfo{
|
||
|
|
Server: srv,
|
||
|
|
FullMethod: TaskProcessor_ProcessorStatus_FullMethodName,
|
||
|
|
}
|
||
|
|
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||
|
|
return srv.(TaskProcessorServer).ProcessorStatus(ctx, req.(*ProcessorStatusRequest))
|
||
|
|
}
|
||
|
|
return interceptor(ctx, in, info, handler)
|
||
|
|
}
|
||
|
|
|
||
|
|
// TaskProcessor_ServiceDesc is the grpc.ServiceDesc for TaskProcessor service.
|
||
|
|
// It's only intended for direct use with grpc.RegisterService,
|
||
|
|
// and not to be introspected or modified (even as a copy)
|
||
|
|
var TaskProcessor_ServiceDesc = grpc.ServiceDesc{
|
||
|
|
ServiceName: "taskProcessor.TaskProcessor",
|
||
|
|
HandlerType: (*TaskProcessorServer)(nil),
|
||
|
|
Methods: []grpc.MethodDesc{
|
||
|
|
{
|
||
|
|
MethodName: "ProcessorStatus",
|
||
|
|
Handler: _TaskProcessor_ProcessorStatus_Handler,
|
||
|
|
},
|
||
|
|
},
|
||
|
|
Streams: []grpc.StreamDesc{
|
||
|
|
{
|
||
|
|
StreamName: "RequestTask",
|
||
|
|
Handler: _TaskProcessor_RequestTask_Handler,
|
||
|
|
ServerStreams: true,
|
||
|
|
},
|
||
|
|
{
|
||
|
|
StreamName: "SendResult",
|
||
|
|
Handler: _TaskProcessor_SendResult_Handler,
|
||
|
|
ClientStreams: true,
|
||
|
|
},
|
||
|
|
},
|
||
|
|
Metadata: "task.proto",
|
||
|
|
}
|