1 Star 0 Fork 0

陈天/taibak

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
task.pb.go 11.38 KB
一键复制 编辑 原始数据 按行查看 历史
陈天 提交于 2022-04-30 21:31 +08:00 . [*]整合后的第一次合并
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.25.0
// protoc v3.12.4
// source: task.proto
package rpc
import (
context "context"
proto "github.com/golang/protobuf/proto"
grpc "google.golang.org/grpc"
codes "google.golang.org/grpc/codes"
status "google.golang.org/grpc/status"
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)
)
// This is a compile-time assertion that a sufficiently up-to-date version
// of the legacy proto package is being used.
const _ = proto.ProtoPackageIsVersion4
type TaskRequest struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Command string `protobuf:"bytes,2,opt,name=command,proto3" json:"command,omitempty"` // 命令
Timeout int32 `protobuf:"varint,3,opt,name=timeout,proto3" json:"timeout,omitempty"` // 任务执行超时时间
Id int64 `protobuf:"varint,4,opt,name=id,proto3" json:"id,omitempty"` // 执行任务唯一ID
}
func (x *TaskRequest) Reset() {
*x = TaskRequest{}
if protoimpl.UnsafeEnabled {
mi := &file_task_proto_msgTypes[0]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *TaskRequest) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*TaskRequest) ProtoMessage() {}
func (x *TaskRequest) ProtoReflect() protoreflect.Message {
mi := &file_task_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 TaskRequest.ProtoReflect.Descriptor instead.
func (*TaskRequest) Descriptor() ([]byte, []int) {
return file_task_proto_rawDescGZIP(), []int{0}
}
func (x *TaskRequest) GetCommand() string {
if x != nil {
return x.Command
}
return ""
}
func (x *TaskRequest) GetTimeout() int32 {
if x != nil {
return x.Timeout
}
return 0
}
func (x *TaskRequest) GetId() int64 {
if x != nil {
return x.Id
}
return 0
}
type TaskResponse struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Output string `protobuf:"bytes,1,opt,name=output,proto3" json:"output,omitempty"` // 命令标准输出
Error string `protobuf:"bytes,2,opt,name=error,proto3" json:"error,omitempty"` // 命令错误
}
func (x *TaskResponse) Reset() {
*x = TaskResponse{}
if protoimpl.UnsafeEnabled {
mi := &file_task_proto_msgTypes[1]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *TaskResponse) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*TaskResponse) ProtoMessage() {}
func (x *TaskResponse) ProtoReflect() protoreflect.Message {
mi := &file_task_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 TaskResponse.ProtoReflect.Descriptor instead.
func (*TaskResponse) Descriptor() ([]byte, []int) {
return file_task_proto_rawDescGZIP(), []int{1}
}
func (x *TaskResponse) GetOutput() string {
if x != nil {
return x.Output
}
return ""
}
func (x *TaskResponse) GetError() string {
if x != nil {
return x.Error
}
return ""
}
var File_task_proto protoreflect.FileDescriptor
var file_task_proto_rawDesc = []byte{
0x0a, 0x0a, 0x74, 0x61, 0x73, 0x6b, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x03, 0x72, 0x70,
0x63, 0x1a, 0x0c, 0x64, 0x62, 0x74, 0x61, 0x73, 0x6b, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22,
0x51, 0x0a, 0x0b, 0x54, 0x61, 0x73, 0x6b, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x18,
0x0a, 0x07, 0x63, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52,
0x07, 0x63, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x12, 0x18, 0x0a, 0x07, 0x74, 0x69, 0x6d, 0x65,
0x6f, 0x75, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, 0x52, 0x07, 0x74, 0x69, 0x6d, 0x65, 0x6f,
0x75, 0x74, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x04, 0x20, 0x01, 0x28, 0x03, 0x52, 0x02,
0x69, 0x64, 0x22, 0x3c, 0x0a, 0x0c, 0x54, 0x61, 0x73, 0x6b, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e,
0x73, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x6f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x18, 0x01, 0x20, 0x01,
0x28, 0x09, 0x52, 0x06, 0x6f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x12, 0x14, 0x0a, 0x05, 0x65, 0x72,
0x72, 0x6f, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x65, 0x72, 0x72, 0x6f, 0x72,
0x32, 0x68, 0x0a, 0x04, 0x54, 0x61, 0x73, 0x6b, 0x12, 0x2c, 0x0a, 0x03, 0x52, 0x75, 0x6e, 0x12,
0x10, 0x2e, 0x72, 0x70, 0x63, 0x2e, 0x54, 0x61, 0x73, 0x6b, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73,
0x74, 0x1a, 0x11, 0x2e, 0x72, 0x70, 0x63, 0x2e, 0x54, 0x61, 0x73, 0x6b, 0x52, 0x65, 0x73, 0x70,
0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x32, 0x0a, 0x05, 0x44, 0x62, 0x52, 0x75, 0x6e, 0x12,
0x12, 0x2e, 0x72, 0x70, 0x63, 0x2e, 0x44, 0x62, 0x54, 0x61, 0x73, 0x6b, 0x52, 0x65, 0x71, 0x75,
0x65, 0x73, 0x74, 0x1a, 0x13, 0x2e, 0x72, 0x70, 0x63, 0x2e, 0x44, 0x62, 0x54, 0x61, 0x73, 0x6b,
0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74,
0x6f, 0x33,
}
var (
file_task_proto_rawDescOnce sync.Once
file_task_proto_rawDescData = file_task_proto_rawDesc
)
func file_task_proto_rawDescGZIP() []byte {
file_task_proto_rawDescOnce.Do(func() {
file_task_proto_rawDescData = protoimpl.X.CompressGZIP(file_task_proto_rawDescData)
})
return file_task_proto_rawDescData
}
var file_task_proto_msgTypes = make([]protoimpl.MessageInfo, 2)
var file_task_proto_goTypes = []interface{}{
(*TaskRequest)(nil), // 0: rpc.TaskRequest
(*TaskResponse)(nil), // 1: rpc.TaskResponse
(*DbTaskRequest)(nil), // 2: rpc.DbTaskRequest
(*DbTaskResponse)(nil), // 3: rpc.DbTaskResponse
}
var file_task_proto_depIdxs = []int32{
0, // 0: rpc.Task.Run:input_type -> rpc.TaskRequest
2, // 1: rpc.Task.DbRun:input_type -> rpc.DbTaskRequest
1, // 2: rpc.Task.Run:output_type -> rpc.TaskResponse
3, // 3: rpc.Task.DbRun:output_type -> rpc.DbTaskResponse
2, // [2:4] is the sub-list for method output_type
0, // [0:2] is the sub-list for method input_type
0, // [0:0] is the sub-list for extension type_name
0, // [0:0] is the sub-list for extension extendee
0, // [0:0] is the sub-list for field type_name
}
func init() { file_task_proto_init() }
func file_task_proto_init() {
if File_task_proto != nil {
return
}
file_dbtask_proto_init()
if !protoimpl.UnsafeEnabled {
file_task_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*TaskRequest); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_task_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*TaskResponse); 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_task_proto_rawDesc,
NumEnums: 0,
NumMessages: 2,
NumExtensions: 0,
NumServices: 1,
},
GoTypes: file_task_proto_goTypes,
DependencyIndexes: file_task_proto_depIdxs,
MessageInfos: file_task_proto_msgTypes,
}.Build()
File_task_proto = out.File
file_task_proto_rawDesc = nil
file_task_proto_goTypes = nil
file_task_proto_depIdxs = nil
}
// Reference imports to suppress errors if they are not otherwise used.
var _ context.Context
var _ grpc.ClientConnInterface
// This is a compile-time assertion to ensure that this generated file
// is compatible with the grpc package it is being compiled against.
const _ = grpc.SupportPackageIsVersion6
// TaskClient is the client API for Task service.
//
// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream.
type TaskClient interface {
Run(ctx context.Context, in *TaskRequest, opts ...grpc.CallOption) (*TaskResponse, error)
DbRun(ctx context.Context, in *DbTaskRequest, opts ...grpc.CallOption) (*DbTaskResponse, error)
}
type taskClient struct {
cc grpc.ClientConnInterface
}
func NewTaskClient(cc grpc.ClientConnInterface) TaskClient {
return &taskClient{cc}
}
func (c *taskClient) Run(ctx context.Context, in *TaskRequest, opts ...grpc.CallOption) (*TaskResponse, error) {
out := new(TaskResponse)
err := c.cc.Invoke(ctx, "/rpc.Task/Run", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *taskClient) DbRun(ctx context.Context, in *DbTaskRequest, opts ...grpc.CallOption) (*DbTaskResponse, error) {
out := new(DbTaskResponse)
err := c.cc.Invoke(ctx, "/rpc.Task/DbRun", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
// TaskServer is the server API for Task service.
type TaskServer interface {
Run(context.Context, *TaskRequest) (*TaskResponse, error)
DbRun(context.Context, *DbTaskRequest) (*DbTaskResponse, error)
}
// UnimplementedTaskServer can be embedded to have forward compatible implementations.
type UnimplementedTaskServer struct {
}
func (*UnimplementedTaskServer) Run(context.Context, *TaskRequest) (*TaskResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method Run not implemented")
}
func (*UnimplementedTaskServer) DbRun(context.Context, *DbTaskRequest) (*DbTaskResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method DbRun not implemented")
}
func RegisterTaskServer(s *grpc.Server, srv TaskServer) {
s.RegisterService(&_Task_serviceDesc, srv)
}
func _Task_Run_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(TaskRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(TaskServer).Run(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/rpc.Task/Run",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(TaskServer).Run(ctx, req.(*TaskRequest))
}
return interceptor(ctx, in, info, handler)
}
func _Task_DbRun_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(DbTaskRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(TaskServer).DbRun(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/rpc.Task/DbRun",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(TaskServer).DbRun(ctx, req.(*DbTaskRequest))
}
return interceptor(ctx, in, info, handler)
}
var _Task_serviceDesc = grpc.ServiceDesc{
ServiceName: "rpc.Task",
HandlerType: (*TaskServer)(nil),
Methods: []grpc.MethodDesc{
{
MethodName: "Run",
Handler: _Task_Run_Handler,
},
{
MethodName: "DbRun",
Handler: _Task_DbRun_Handler,
},
},
Streams: []grpc.StreamDesc{},
Metadata: "task.proto",
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Go
1
https://gitee.com/hakwolf/taibak.git
git@gitee.com:hakwolf/taibak.git
hakwolf
taibak
taibak
000f062082a1

搜索帮助