diff --git a/.gitignore b/.gitignore index 148b1c3..809caf2 100644 --- a/.gitignore +++ b/.gitignore @@ -190,6 +190,5 @@ $RECYCLE.BIN/ .idea/* /.run/* *.env -*pb.go !**/.gitkeep main.go \ No newline at end of file diff --git a/pkg/grpc/plug.pb.go b/pkg/grpc/plug.pb.go new file mode 100644 index 0000000..57a792f --- /dev/null +++ b/pkg/grpc/plug.pb.go @@ -0,0 +1,376 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.32.0 +// protoc v3.19.6 +// source: plug.proto + +package gRPC + +import ( + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +type PlugTaskState int32 + +const ( + PlugTaskState_UNKNOWN PlugTaskState = 0 + PlugTaskState_STARTED PlugTaskState = 1 + PlugTaskState_RUNNING PlugTaskState = 2 + PlugTaskState_STOPPED PlugTaskState = 3 +) + +// Enum value maps for PlugTaskState. +var ( + PlugTaskState_name = map[int32]string{ + 0: "UNKNOWN", + 1: "STARTED", + 2: "RUNNING", + 3: "STOPPED", + } + PlugTaskState_value = map[string]int32{ + "UNKNOWN": 0, + "STARTED": 1, + "RUNNING": 2, + "STOPPED": 3, + } +) + +func (x PlugTaskState) Enum() *PlugTaskState { + p := new(PlugTaskState) + *p = x + return p +} + +func (x PlugTaskState) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (PlugTaskState) Descriptor() protoreflect.EnumDescriptor { + return file_plug_proto_enumTypes[0].Descriptor() +} + +func (PlugTaskState) Type() protoreflect.EnumType { + return &file_plug_proto_enumTypes[0] +} + +func (x PlugTaskState) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Use PlugTaskState.Descriptor instead. +func (PlugTaskState) EnumDescriptor() ([]byte, []int) { + return file_plug_proto_rawDescGZIP(), []int{0} +} + +type PlugTaskStatus struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + TaskId string `protobuf:"bytes,1,opt,name=task_id,json=taskId,proto3" json:"task_id,omitempty"` + TaskState PlugTaskState `protobuf:"varint,2,opt,name=task_state,json=taskState,proto3,enum=PlugTaskState" json:"task_state,omitempty"` +} + +func (x *PlugTaskStatus) Reset() { + *x = PlugTaskStatus{} + if protoimpl.UnsafeEnabled { + mi := &file_plug_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *PlugTaskStatus) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*PlugTaskStatus) ProtoMessage() {} + +func (x *PlugTaskStatus) ProtoReflect() protoreflect.Message { + mi := &file_plug_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use PlugTaskStatus.ProtoReflect.Descriptor instead. +func (*PlugTaskStatus) Descriptor() ([]byte, []int) { + return file_plug_proto_rawDescGZIP(), []int{0} +} + +func (x *PlugTaskStatus) GetTaskId() string { + if x != nil { + return x.TaskId + } + return "" +} + +func (x *PlugTaskStatus) GetTaskState() PlugTaskState { + if x != nil { + return x.TaskState + } + return PlugTaskState_UNKNOWN +} + +type PlugTask struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + TaskId string `protobuf:"bytes,1,opt,name=task_id,json=taskId,proto3" json:"task_id,omitempty"` +} + +func (x *PlugTask) Reset() { + *x = PlugTask{} + if protoimpl.UnsafeEnabled { + mi := &file_plug_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *PlugTask) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*PlugTask) ProtoMessage() {} + +func (x *PlugTask) ProtoReflect() protoreflect.Message { + mi := &file_plug_proto_msgTypes[1] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use PlugTask.ProtoReflect.Descriptor instead. +func (*PlugTask) Descriptor() ([]byte, []int) { + return file_plug_proto_rawDescGZIP(), []int{1} +} + +func (x *PlugTask) GetTaskId() string { + if x != nil { + return x.TaskId + } + return "" +} + +type PlugTaskCreation struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + UserId string `protobuf:"bytes,1,opt,name=user_id,json=userId,proto3" json:"user_id,omitempty"` + UserSourceName string `protobuf:"bytes,2,opt,name=user_source_name,json=userSourceName,proto3" json:"user_source_name,omitempty"` + DeepScrape bool `protobuf:"varint,3,opt,name=deep_scrape,json=deepScrape,proto3" json:"deep_scrape,omitempty"` +} + +func (x *PlugTaskCreation) Reset() { + *x = PlugTaskCreation{} + if protoimpl.UnsafeEnabled { + mi := &file_plug_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *PlugTaskCreation) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*PlugTaskCreation) ProtoMessage() {} + +func (x *PlugTaskCreation) ProtoReflect() protoreflect.Message { + mi := &file_plug_proto_msgTypes[2] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use PlugTaskCreation.ProtoReflect.Descriptor instead. +func (*PlugTaskCreation) Descriptor() ([]byte, []int) { + return file_plug_proto_rawDescGZIP(), []int{2} +} + +func (x *PlugTaskCreation) GetUserId() string { + if x != nil { + return x.UserId + } + return "" +} + +func (x *PlugTaskCreation) GetUserSourceName() string { + if x != nil { + return x.UserSourceName + } + return "" +} + +func (x *PlugTaskCreation) GetDeepScrape() bool { + if x != nil { + return x.DeepScrape + } + return false +} + +var File_plug_proto protoreflect.FileDescriptor + +var file_plug_proto_rawDesc = []byte{ + 0x0a, 0x0a, 0x70, 0x6c, 0x75, 0x67, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x58, 0x0a, 0x0e, + 0x50, 0x6c, 0x75, 0x67, 0x54, 0x61, 0x73, 0x6b, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x17, + 0x0a, 0x07, 0x74, 0x61, 0x73, 0x6b, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x06, 0x74, 0x61, 0x73, 0x6b, 0x49, 0x64, 0x12, 0x2d, 0x0a, 0x0a, 0x74, 0x61, 0x73, 0x6b, 0x5f, + 0x73, 0x74, 0x61, 0x74, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x0e, 0x2e, 0x50, 0x6c, + 0x75, 0x67, 0x54, 0x61, 0x73, 0x6b, 0x53, 0x74, 0x61, 0x74, 0x65, 0x52, 0x09, 0x74, 0x61, 0x73, + 0x6b, 0x53, 0x74, 0x61, 0x74, 0x65, 0x22, 0x23, 0x0a, 0x08, 0x50, 0x6c, 0x75, 0x67, 0x54, 0x61, + 0x73, 0x6b, 0x12, 0x17, 0x0a, 0x07, 0x74, 0x61, 0x73, 0x6b, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x06, 0x74, 0x61, 0x73, 0x6b, 0x49, 0x64, 0x22, 0x76, 0x0a, 0x10, 0x50, + 0x6c, 0x75, 0x67, 0x54, 0x61, 0x73, 0x6b, 0x43, 0x72, 0x65, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, + 0x17, 0x0a, 0x07, 0x75, 0x73, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x06, 0x75, 0x73, 0x65, 0x72, 0x49, 0x64, 0x12, 0x28, 0x0a, 0x10, 0x75, 0x73, 0x65, 0x72, + 0x5f, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x0e, 0x75, 0x73, 0x65, 0x72, 0x53, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x4e, 0x61, + 0x6d, 0x65, 0x12, 0x1f, 0x0a, 0x0b, 0x64, 0x65, 0x65, 0x70, 0x5f, 0x73, 0x63, 0x72, 0x61, 0x70, + 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0a, 0x64, 0x65, 0x65, 0x70, 0x53, 0x63, 0x72, + 0x61, 0x70, 0x65, 0x2a, 0x43, 0x0a, 0x0d, 0x50, 0x6c, 0x75, 0x67, 0x54, 0x61, 0x73, 0x6b, 0x53, + 0x74, 0x61, 0x74, 0x65, 0x12, 0x0b, 0x0a, 0x07, 0x55, 0x4e, 0x4b, 0x4e, 0x4f, 0x57, 0x4e, 0x10, + 0x00, 0x12, 0x0b, 0x0a, 0x07, 0x53, 0x54, 0x41, 0x52, 0x54, 0x45, 0x44, 0x10, 0x01, 0x12, 0x0b, + 0x0a, 0x07, 0x52, 0x55, 0x4e, 0x4e, 0x49, 0x4e, 0x47, 0x10, 0x02, 0x12, 0x0b, 0x0a, 0x07, 0x53, + 0x54, 0x4f, 0x50, 0x50, 0x45, 0x44, 0x10, 0x03, 0x32, 0x94, 0x01, 0x0a, 0x0d, 0x50, 0x6c, 0x75, + 0x67, 0x43, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x6f, 0x72, 0x12, 0x2f, 0x0a, 0x09, 0x54, 0x61, + 0x73, 0x6b, 0x53, 0x74, 0x61, 0x72, 0x74, 0x12, 0x11, 0x2e, 0x50, 0x6c, 0x75, 0x67, 0x54, 0x61, + 0x73, 0x6b, 0x43, 0x72, 0x65, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x1a, 0x0f, 0x2e, 0x50, 0x6c, 0x75, + 0x67, 0x54, 0x61, 0x73, 0x6b, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x28, 0x0a, 0x0a, 0x54, + 0x61, 0x73, 0x6b, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x09, 0x2e, 0x50, 0x6c, 0x75, 0x67, + 0x54, 0x61, 0x73, 0x6b, 0x1a, 0x0f, 0x2e, 0x50, 0x6c, 0x75, 0x67, 0x54, 0x61, 0x73, 0x6b, 0x53, + 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x28, 0x0a, 0x0a, 0x54, 0x61, 0x73, 0x6b, 0x43, 0x61, 0x6e, + 0x63, 0x65, 0x6c, 0x12, 0x09, 0x2e, 0x50, 0x6c, 0x75, 0x67, 0x54, 0x61, 0x73, 0x6b, 0x1a, 0x0f, + 0x2e, 0x50, 0x6c, 0x75, 0x67, 0x54, 0x61, 0x73, 0x6b, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x42, + 0x33, 0x5a, 0x31, 0x67, 0x69, 0x74, 0x2e, 0x64, 0x72, 0x61, 0x67, 0x73, 0x65, 0x2e, 0x69, 0x74, + 0x2f, 0x61, 0x6e, 0x74, 0x68, 0x72, 0x6f, 0x76, 0x65, 0x2f, 0x70, 0x6c, 0x75, 0x67, 0x2d, 0x5b, + 0x52, 0x45, 0x50, 0x4c, 0x41, 0x43, 0x45, 0x5f, 0x4d, 0x45, 0x5d, 0x2f, 0x61, 0x70, 0x69, 0x2f, + 0x67, 0x52, 0x50, 0x43, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_plug_proto_rawDescOnce sync.Once + file_plug_proto_rawDescData = file_plug_proto_rawDesc +) + +func file_plug_proto_rawDescGZIP() []byte { + file_plug_proto_rawDescOnce.Do(func() { + file_plug_proto_rawDescData = protoimpl.X.CompressGZIP(file_plug_proto_rawDescData) + }) + return file_plug_proto_rawDescData +} + +var file_plug_proto_enumTypes = make([]protoimpl.EnumInfo, 1) +var file_plug_proto_msgTypes = make([]protoimpl.MessageInfo, 3) +var file_plug_proto_goTypes = []interface{}{ + (PlugTaskState)(0), // 0: PlugTaskState + (*PlugTaskStatus)(nil), // 1: PlugTaskStatus + (*PlugTask)(nil), // 2: PlugTask + (*PlugTaskCreation)(nil), // 3: PlugTaskCreation +} +var file_plug_proto_depIdxs = []int32{ + 0, // 0: PlugTaskStatus.task_state:type_name -> PlugTaskState + 3, // 1: PlugConnector.TaskStart:input_type -> PlugTaskCreation + 2, // 2: PlugConnector.TaskStatus:input_type -> PlugTask + 2, // 3: PlugConnector.TaskCancel:input_type -> PlugTask + 1, // 4: PlugConnector.TaskStart:output_type -> PlugTaskStatus + 1, // 5: PlugConnector.TaskStatus:output_type -> PlugTaskStatus + 1, // 6: PlugConnector.TaskCancel:output_type -> PlugTaskStatus + 4, // [4:7] is the sub-list for method output_type + 1, // [1:4] is the sub-list for method input_type + 1, // [1:1] is the sub-list for extension type_name + 1, // [1:1] is the sub-list for extension extendee + 0, // [0:1] is the sub-list for field type_name +} + +func init() { file_plug_proto_init() } +func file_plug_proto_init() { + if File_plug_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_plug_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*PlugTaskStatus); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_plug_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*PlugTask); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_plug_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*PlugTaskCreation); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_plug_proto_rawDesc, + NumEnums: 1, + NumMessages: 3, + NumExtensions: 0, + NumServices: 1, + }, + GoTypes: file_plug_proto_goTypes, + DependencyIndexes: file_plug_proto_depIdxs, + EnumInfos: file_plug_proto_enumTypes, + MessageInfos: file_plug_proto_msgTypes, + }.Build() + File_plug_proto = out.File + file_plug_proto_rawDesc = nil + file_plug_proto_goTypes = nil + file_plug_proto_depIdxs = nil +} diff --git a/pkg/grpc/plug_grpc.pb.go b/pkg/grpc/plug_grpc.pb.go new file mode 100644 index 0000000..8606ff9 --- /dev/null +++ b/pkg/grpc/plug_grpc.pb.go @@ -0,0 +1,183 @@ +// Code generated by protoc-gen-go-grpc. DO NOT EDIT. +// versions: +// - protoc-gen-go-grpc v1.3.0 +// - protoc v3.19.6 +// source: plug.proto + +package gRPC + +import ( + context "context" + grpc "google.golang.org/grpc" + codes "google.golang.org/grpc/codes" + status "google.golang.org/grpc/status" +) + +// 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.32.0 or later. +const _ = grpc.SupportPackageIsVersion7 + +const ( + PlugConnector_TaskStart_FullMethodName = "/PlugConnector/TaskStart" + PlugConnector_TaskStatus_FullMethodName = "/PlugConnector/TaskStatus" + PlugConnector_TaskCancel_FullMethodName = "/PlugConnector/TaskCancel" +) + +// PlugConnectorClient is the client API for PlugConnector 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 PlugConnectorClient interface { + TaskStart(ctx context.Context, in *PlugTaskCreation, opts ...grpc.CallOption) (*PlugTaskStatus, error) + TaskStatus(ctx context.Context, in *PlugTask, opts ...grpc.CallOption) (*PlugTaskStatus, error) + TaskCancel(ctx context.Context, in *PlugTask, opts ...grpc.CallOption) (*PlugTaskStatus, error) +} + +type plugConnectorClient struct { + cc grpc.ClientConnInterface +} + +func NewPlugConnectorClient(cc grpc.ClientConnInterface) PlugConnectorClient { + return &plugConnectorClient{cc} +} + +func (c *plugConnectorClient) TaskStart(ctx context.Context, in *PlugTaskCreation, opts ...grpc.CallOption) (*PlugTaskStatus, error) { + out := new(PlugTaskStatus) + err := c.cc.Invoke(ctx, PlugConnector_TaskStart_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *plugConnectorClient) TaskStatus(ctx context.Context, in *PlugTask, opts ...grpc.CallOption) (*PlugTaskStatus, error) { + out := new(PlugTaskStatus) + err := c.cc.Invoke(ctx, PlugConnector_TaskStatus_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *plugConnectorClient) TaskCancel(ctx context.Context, in *PlugTask, opts ...grpc.CallOption) (*PlugTaskStatus, error) { + out := new(PlugTaskStatus) + err := c.cc.Invoke(ctx, PlugConnector_TaskCancel_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// PlugConnectorServer is the server API for PlugConnector service. +// All implementations must embed UnimplementedPlugConnectorServer +// for forward compatibility +type PlugConnectorServer interface { + TaskStart(context.Context, *PlugTaskCreation) (*PlugTaskStatus, error) + TaskStatus(context.Context, *PlugTask) (*PlugTaskStatus, error) + TaskCancel(context.Context, *PlugTask) (*PlugTaskStatus, error) + mustEmbedUnimplementedPlugConnectorServer() +} + +// UnimplementedPlugConnectorServer must be embedded to have forward compatible implementations. +type UnimplementedPlugConnectorServer struct { +} + +func (UnimplementedPlugConnectorServer) TaskStart(context.Context, *PlugTaskCreation) (*PlugTaskStatus, error) { + return nil, status.Errorf(codes.Unimplemented, "method TaskStart not implemented") +} +func (UnimplementedPlugConnectorServer) TaskStatus(context.Context, *PlugTask) (*PlugTaskStatus, error) { + return nil, status.Errorf(codes.Unimplemented, "method TaskStatus not implemented") +} +func (UnimplementedPlugConnectorServer) TaskCancel(context.Context, *PlugTask) (*PlugTaskStatus, error) { + return nil, status.Errorf(codes.Unimplemented, "method TaskCancel not implemented") +} +func (UnimplementedPlugConnectorServer) mustEmbedUnimplementedPlugConnectorServer() {} + +// UnsafePlugConnectorServer may be embedded to opt out of forward compatibility for this service. +// Use of this interface is not recommended, as added methods to PlugConnectorServer will +// result in compilation errors. +type UnsafePlugConnectorServer interface { + mustEmbedUnimplementedPlugConnectorServer() +} + +func RegisterPlugConnectorServer(s grpc.ServiceRegistrar, srv PlugConnectorServer) { + s.RegisterService(&PlugConnector_ServiceDesc, srv) +} + +func _PlugConnector_TaskStart_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(PlugTaskCreation) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(PlugConnectorServer).TaskStart(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: PlugConnector_TaskStart_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(PlugConnectorServer).TaskStart(ctx, req.(*PlugTaskCreation)) + } + return interceptor(ctx, in, info, handler) +} + +func _PlugConnector_TaskStatus_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(PlugTask) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(PlugConnectorServer).TaskStatus(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: PlugConnector_TaskStatus_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(PlugConnectorServer).TaskStatus(ctx, req.(*PlugTask)) + } + return interceptor(ctx, in, info, handler) +} + +func _PlugConnector_TaskCancel_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(PlugTask) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(PlugConnectorServer).TaskCancel(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: PlugConnector_TaskCancel_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(PlugConnectorServer).TaskCancel(ctx, req.(*PlugTask)) + } + return interceptor(ctx, in, info, handler) +} + +// PlugConnector_ServiceDesc is the grpc.ServiceDesc for PlugConnector service. +// It's only intended for direct use with grpc.RegisterService, +// and not to be introspected or modified (even as a copy) +var PlugConnector_ServiceDesc = grpc.ServiceDesc{ + ServiceName: "PlugConnector", + HandlerType: (*PlugConnectorServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "TaskStart", + Handler: _PlugConnector_TaskStart_Handler, + }, + { + MethodName: "TaskStatus", + Handler: _PlugConnector_TaskStatus_Handler, + }, + { + MethodName: "TaskCancel", + Handler: _PlugConnector_TaskCancel_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "plug.proto", +}