156 lines
6.6 KiB
Go
156 lines
6.6 KiB
Go
// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
|
|
// versions:
|
|
// - protoc-gen-go-grpc v1.5.1
|
|
// - protoc v6.33.1
|
|
// source: proto/taskTransport.proto
|
|
|
|
package taskTransportV1
|
|
|
|
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_RequestTasks_FullMethodName = "/taskTransport.TaskProcessor/RequestTasks"
|
|
TaskProcessor_SendResults_FullMethodName = "/taskTransport.TaskProcessor/SendResults"
|
|
)
|
|
|
|
// 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 {
|
|
RequestTasks(ctx context.Context, in *emptypb.Empty, opts ...grpc.CallOption) (grpc.ServerStreamingClient[Task], error)
|
|
SendResults(ctx context.Context, opts ...grpc.CallOption) (grpc.ClientStreamingClient[Result, emptypb.Empty], error)
|
|
}
|
|
|
|
type taskProcessorClient struct {
|
|
cc grpc.ClientConnInterface
|
|
}
|
|
|
|
func NewTaskProcessorClient(cc grpc.ClientConnInterface) TaskProcessorClient {
|
|
return &taskProcessorClient{cc}
|
|
}
|
|
|
|
func (c *taskProcessorClient) RequestTasks(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_RequestTasks_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_RequestTasksClient = grpc.ServerStreamingClient[Task]
|
|
|
|
func (c *taskProcessorClient) SendResults(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_SendResults_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_SendResultsClient = grpc.ClientStreamingClient[Result, emptypb.Empty]
|
|
|
|
// TaskProcessorServer is the server API for TaskProcessor service.
|
|
// All implementations must embed UnimplementedTaskProcessorServer
|
|
// for forward compatibility.
|
|
type TaskProcessorServer interface {
|
|
RequestTasks(*emptypb.Empty, grpc.ServerStreamingServer[Task]) error
|
|
SendResults(grpc.ClientStreamingServer[Result, emptypb.Empty]) 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) RequestTasks(*emptypb.Empty, grpc.ServerStreamingServer[Task]) error {
|
|
return status.Errorf(codes.Unimplemented, "method RequestTasks not implemented")
|
|
}
|
|
func (UnimplementedTaskProcessorServer) SendResults(grpc.ClientStreamingServer[Result, emptypb.Empty]) error {
|
|
return status.Errorf(codes.Unimplemented, "method SendResults 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_RequestTasks_Handler(srv interface{}, stream grpc.ServerStream) error {
|
|
m := new(emptypb.Empty)
|
|
if err := stream.RecvMsg(m); err != nil {
|
|
return err
|
|
}
|
|
return srv.(TaskProcessorServer).RequestTasks(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_RequestTasksServer = grpc.ServerStreamingServer[Task]
|
|
|
|
func _TaskProcessor_SendResults_Handler(srv interface{}, stream grpc.ServerStream) error {
|
|
return srv.(TaskProcessorServer).SendResults(&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_SendResultsServer = grpc.ClientStreamingServer[Result, emptypb.Empty]
|
|
|
|
// 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: "taskTransport.TaskProcessor",
|
|
HandlerType: (*TaskProcessorServer)(nil),
|
|
Methods: []grpc.MethodDesc{},
|
|
Streams: []grpc.StreamDesc{
|
|
{
|
|
StreamName: "RequestTasks",
|
|
Handler: _TaskProcessor_RequestTasks_Handler,
|
|
ServerStreams: true,
|
|
},
|
|
{
|
|
StreamName: "SendResults",
|
|
Handler: _TaskProcessor_SendResults_Handler,
|
|
ClientStreams: true,
|
|
},
|
|
},
|
|
Metadata: "proto/taskTransport.proto",
|
|
}
|