worker

package
v0.0.0-...-de0472c Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 11, 2022 License: MulanPSL-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	SyncCommandRunRequest_Action_name = map[int32]string{
		0: "ActionNotUse",
		1: "ActionExecute",
		2: "ActionInput",
		3: "ActionExit",
	}
	SyncCommandRunRequest_Action_value = map[string]int32{
		"ActionNotUse":  0,
		"ActionExecute": 1,
		"ActionInput":   2,
		"ActionExit":    3,
	}
)

Enum value maps for SyncCommandRunRequest_Action.

View Source
var File_worker_proto protoreflect.FileDescriptor
View Source
var Worker_ServiceDesc = grpc.ServiceDesc{
	ServiceName: "eternal.protobuf.worker.Worker",
	HandlerType: (*WorkerServer)(nil),
	Methods: []grpc.MethodDesc{
		{
			MethodName: "HeartCheck",
			Handler:    _Worker_HeartCheck_Handler,
		},
		{
			MethodName: "AsyncCommandRun",
			Handler:    _Worker_AsyncCommandRun_Handler,
		},
	},
	Streams: []grpc.StreamDesc{
		{
			StreamName:    "SyncCommandRun",
			Handler:       _Worker_SyncCommandRun_Handler,
			ServerStreams: true,
			ClientStreams: true,
		},
		{
			StreamName:    "AsyncCommandOutput",
			Handler:       _Worker_AsyncCommandOutput_Handler,
			ServerStreams: true,
		},
	},
	Metadata: "worker.proto",
}

Worker_ServiceDesc is the grpc.ServiceDesc for Worker service. It's only intended for direct use with grpc.RegisterService, and not to be introspected or modified (even as a copy)

Functions

func RegisterWorkerServer

func RegisterWorkerServer(s grpc.ServiceRegistrar, srv WorkerServer)

Types

type AsyncCommandOutputRequest

type AsyncCommandOutputRequest struct {
	CommandId string `protobuf:"bytes,1,opt,name=commandId,proto3" json:"commandId,omitempty"` // 查询的命令ID
	// contains filtered or unexported fields
}

func (*AsyncCommandOutputRequest) Descriptor deprecated

func (*AsyncCommandOutputRequest) Descriptor() ([]byte, []int)

Deprecated: Use AsyncCommandOutputRequest.ProtoReflect.Descriptor instead.

func (*AsyncCommandOutputRequest) GetCommandId

func (x *AsyncCommandOutputRequest) GetCommandId() string

func (*AsyncCommandOutputRequest) ProtoMessage

func (*AsyncCommandOutputRequest) ProtoMessage()

func (*AsyncCommandOutputRequest) ProtoReflect

func (*AsyncCommandOutputRequest) Reset

func (x *AsyncCommandOutputRequest) Reset()

func (*AsyncCommandOutputRequest) String

func (x *AsyncCommandOutputRequest) String() string

type AsyncCommandOutputResponse

type AsyncCommandOutputResponse struct {
	Output []byte `protobuf:"bytes,1,opt,name=output,proto3" json:"output,omitempty"` // 执行命令的输出
	// contains filtered or unexported fields
}

func (*AsyncCommandOutputResponse) Descriptor deprecated

func (*AsyncCommandOutputResponse) Descriptor() ([]byte, []int)

Deprecated: Use AsyncCommandOutputResponse.ProtoReflect.Descriptor instead.

func (*AsyncCommandOutputResponse) GetOutput

func (x *AsyncCommandOutputResponse) GetOutput() []byte

func (*AsyncCommandOutputResponse) ProtoMessage

func (*AsyncCommandOutputResponse) ProtoMessage()

func (*AsyncCommandOutputResponse) ProtoReflect

func (*AsyncCommandOutputResponse) Reset

func (x *AsyncCommandOutputResponse) Reset()

func (*AsyncCommandOutputResponse) String

func (x *AsyncCommandOutputResponse) String() string

type AsyncCommandRunRequest

type AsyncCommandRunRequest struct {
	Command string `protobuf:"bytes,1,opt,name=command,proto3" json:"command,omitempty"` // 可执行的完整的命令,应该包含执行需要的所有信息
	// contains filtered or unexported fields
}

func (*AsyncCommandRunRequest) Descriptor deprecated

func (*AsyncCommandRunRequest) Descriptor() ([]byte, []int)

Deprecated: Use AsyncCommandRunRequest.ProtoReflect.Descriptor instead.

func (*AsyncCommandRunRequest) GetCommand

func (x *AsyncCommandRunRequest) GetCommand() string

func (*AsyncCommandRunRequest) ProtoMessage

func (*AsyncCommandRunRequest) ProtoMessage()

func (*AsyncCommandRunRequest) ProtoReflect

func (x *AsyncCommandRunRequest) ProtoReflect() protoreflect.Message

func (*AsyncCommandRunRequest) Reset

func (x *AsyncCommandRunRequest) Reset()

func (*AsyncCommandRunRequest) String

func (x *AsyncCommandRunRequest) String() string

type AsyncCommandRunResponse

type AsyncCommandRunResponse struct {
	CommandId string `protobuf:"bytes,1,opt,name=commandId,proto3" json:"commandId,omitempty"`  // 执行的任务ID
	StartTime int64  `protobuf:"varint,2,opt,name=startTime,proto3" json:"startTime,omitempty"` // 执行的开始时间
	// contains filtered or unexported fields
}

func (*AsyncCommandRunResponse) Descriptor deprecated

func (*AsyncCommandRunResponse) Descriptor() ([]byte, []int)

Deprecated: Use AsyncCommandRunResponse.ProtoReflect.Descriptor instead.

func (*AsyncCommandRunResponse) GetCommandId

func (x *AsyncCommandRunResponse) GetCommandId() string

func (*AsyncCommandRunResponse) GetStartTime

func (x *AsyncCommandRunResponse) GetStartTime() int64

func (*AsyncCommandRunResponse) ProtoMessage

func (*AsyncCommandRunResponse) ProtoMessage()

func (*AsyncCommandRunResponse) ProtoReflect

func (x *AsyncCommandRunResponse) ProtoReflect() protoreflect.Message

func (*AsyncCommandRunResponse) Reset

func (x *AsyncCommandRunResponse) Reset()

func (*AsyncCommandRunResponse) String

func (x *AsyncCommandRunResponse) String() string

type HeartCheckRequest

type HeartCheckRequest struct {
	// contains filtered or unexported fields
}

func (*HeartCheckRequest) Descriptor deprecated

func (*HeartCheckRequest) Descriptor() ([]byte, []int)

Deprecated: Use HeartCheckRequest.ProtoReflect.Descriptor instead.

func (*HeartCheckRequest) ProtoMessage

func (*HeartCheckRequest) ProtoMessage()

func (*HeartCheckRequest) ProtoReflect

func (x *HeartCheckRequest) ProtoReflect() protoreflect.Message

func (*HeartCheckRequest) Reset

func (x *HeartCheckRequest) Reset()

func (*HeartCheckRequest) String

func (x *HeartCheckRequest) String() string

type HeartCheckResponse

type HeartCheckResponse struct {
	// contains filtered or unexported fields
}

func (*HeartCheckResponse) Descriptor deprecated

func (*HeartCheckResponse) Descriptor() ([]byte, []int)

Deprecated: Use HeartCheckResponse.ProtoReflect.Descriptor instead.

func (*HeartCheckResponse) ProtoMessage

func (*HeartCheckResponse) ProtoMessage()

func (*HeartCheckResponse) ProtoReflect

func (x *HeartCheckResponse) ProtoReflect() protoreflect.Message

func (*HeartCheckResponse) Reset

func (x *HeartCheckResponse) Reset()

func (*HeartCheckResponse) String

func (x *HeartCheckResponse) String() string

type SyncCommandRunRequest

type SyncCommandRunRequest struct {
	Action SyncCommandRunRequest_Action `protobuf:"varint,1,opt,name=action,proto3,enum=eternal.protobuf.worker.SyncCommandRunRequest_Action" json:"action,omitempty"` // 执行的操作
	Data   []byte                       `protobuf:"bytes,2,opt,name=data,proto3" json:"data,omitempty"`                                                                // 数据字节数组,根据动作决定处理方式
	// contains filtered or unexported fields
}

func (*SyncCommandRunRequest) Descriptor deprecated

func (*SyncCommandRunRequest) Descriptor() ([]byte, []int)

Deprecated: Use SyncCommandRunRequest.ProtoReflect.Descriptor instead.

func (*SyncCommandRunRequest) GetAction

func (*SyncCommandRunRequest) GetData

func (x *SyncCommandRunRequest) GetData() []byte

func (*SyncCommandRunRequest) ProtoMessage

func (*SyncCommandRunRequest) ProtoMessage()

func (*SyncCommandRunRequest) ProtoReflect

func (x *SyncCommandRunRequest) ProtoReflect() protoreflect.Message

func (*SyncCommandRunRequest) Reset

func (x *SyncCommandRunRequest) Reset()

func (*SyncCommandRunRequest) String

func (x *SyncCommandRunRequest) String() string

type SyncCommandRunRequest_Action

type SyncCommandRunRequest_Action int32
const (
	SyncCommandRunRequest_ActionNotUse  SyncCommandRunRequest_Action = 0 // 未使用的枚举值
	SyncCommandRunRequest_ActionExecute SyncCommandRunRequest_Action = 1 // 启动命令
	SyncCommandRunRequest_ActionInput   SyncCommandRunRequest_Action = 2 // 向命令追加输入
	SyncCommandRunRequest_ActionExit    SyncCommandRunRequest_Action = 3 // 结束命令
)

func (SyncCommandRunRequest_Action) Descriptor

func (SyncCommandRunRequest_Action) Enum

func (SyncCommandRunRequest_Action) EnumDescriptor deprecated

func (SyncCommandRunRequest_Action) EnumDescriptor() ([]byte, []int)

Deprecated: Use SyncCommandRunRequest_Action.Descriptor instead.

func (SyncCommandRunRequest_Action) Number

func (SyncCommandRunRequest_Action) String

func (SyncCommandRunRequest_Action) Type

type SyncCommandRunResponse

type SyncCommandRunResponse struct {
	CommandId string `protobuf:"bytes,1,opt,name=commandId,proto3" json:"commandId,omitempty"` // 执行的任务ID
	Output    []byte `protobuf:"bytes,2,opt,name=output,proto3" json:"output,omitempty"`       // 输出
	// contains filtered or unexported fields
}

func (*SyncCommandRunResponse) Descriptor deprecated

func (*SyncCommandRunResponse) Descriptor() ([]byte, []int)

Deprecated: Use SyncCommandRunResponse.ProtoReflect.Descriptor instead.

func (*SyncCommandRunResponse) GetCommandId

func (x *SyncCommandRunResponse) GetCommandId() string

func (*SyncCommandRunResponse) GetOutput

func (x *SyncCommandRunResponse) GetOutput() []byte

func (*SyncCommandRunResponse) ProtoMessage

func (*SyncCommandRunResponse) ProtoMessage()

func (*SyncCommandRunResponse) ProtoReflect

func (x *SyncCommandRunResponse) ProtoReflect() protoreflect.Message

func (*SyncCommandRunResponse) Reset

func (x *SyncCommandRunResponse) Reset()

func (*SyncCommandRunResponse) String

func (x *SyncCommandRunResponse) String() string

type UnimplementedWorkerServer

type UnimplementedWorkerServer struct {
}

UnimplementedWorkerServer must be embedded to have forward compatible implementations.

func (UnimplementedWorkerServer) AsyncCommandRun

func (UnimplementedWorkerServer) HeartCheck

func (UnimplementedWorkerServer) SyncCommandRun

type UnsafeWorkerServer

type UnsafeWorkerServer interface {
	// contains filtered or unexported methods
}

UnsafeWorkerServer may be embedded to opt out of forward compatibility for this service. Use of this interface is not recommended, as added methods to WorkerServer will result in compilation errors.

type WorkerClient

type WorkerClient interface {
	// HeartCheck 心跳检测
	HeartCheck(ctx context.Context, in *HeartCheckRequest, opts ...grpc.CallOption) (*HeartCheckResponse, error)
	// SyncCommandRun 执行一个同步的命令
	// 该模式支持双向流式数据的传输
	SyncCommandRun(ctx context.Context, opts ...grpc.CallOption) (Worker_SyncCommandRunClient, error)
	// AsyncCommandRun 执行一个异步命令
	// 该操作将会立刻返回状态,并将命令转为异步执行
	AsyncCommandRun(ctx context.Context, in *AsyncCommandRunRequest, opts ...grpc.CallOption) (*AsyncCommandRunResponse, error)
	// AsyncCommandOutput 查询一个历史命令的日志
	// 该方法以流式数据响应命令日志,每个数据流的大小为4k
	// 任何状态下都不可忽略响应的内容
	AsyncCommandOutput(ctx context.Context, in *AsyncCommandOutputRequest, opts ...grpc.CallOption) (Worker_AsyncCommandOutputClient, error)
}

WorkerClient is the client API for Worker 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.

func NewWorkerClient

func NewWorkerClient(cc grpc.ClientConnInterface) WorkerClient

type WorkerServer

type WorkerServer interface {
	// HeartCheck 心跳检测
	HeartCheck(context.Context, *HeartCheckRequest) (*HeartCheckResponse, error)
	// SyncCommandRun 执行一个同步的命令
	// 该模式支持双向流式数据的传输
	SyncCommandRun(Worker_SyncCommandRunServer) error
	// AsyncCommandRun 执行一个异步命令
	// 该操作将会立刻返回状态,并将命令转为异步执行
	AsyncCommandRun(context.Context, *AsyncCommandRunRequest) (*AsyncCommandRunResponse, error)
	// AsyncCommandOutput 查询一个历史命令的日志
	// 该方法以流式数据响应命令日志,每个数据流的大小为4k
	// 任何状态下都不可忽略响应的内容
	AsyncCommandOutput(*AsyncCommandOutputRequest, Worker_AsyncCommandOutputServer) error
	// contains filtered or unexported methods
}

WorkerServer is the server API for Worker service. All implementations must embed UnimplementedWorkerServer for forward compatibility

type Worker_AsyncCommandOutputClient

type Worker_AsyncCommandOutputClient interface {
	Recv() (*AsyncCommandOutputResponse, error)
	grpc.ClientStream
}

type Worker_AsyncCommandOutputServer

type Worker_AsyncCommandOutputServer interface {
	Send(*AsyncCommandOutputResponse) error
	grpc.ServerStream
}

type Worker_SyncCommandRunClient

type Worker_SyncCommandRunClient interface {
	Send(*SyncCommandRunRequest) error
	Recv() (*SyncCommandRunResponse, error)
	grpc.ClientStream
}

type Worker_SyncCommandRunServer

type Worker_SyncCommandRunServer interface {
	Send(*SyncCommandRunResponse) error
	Recv() (*SyncCommandRunRequest, error)
	grpc.ServerStream
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL