task

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Dec 21, 2023 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrInvalidLengthTask        = fmt.Errorf("proto: negative length found during unmarshaling")
	ErrIntOverflowTask          = fmt.Errorf("proto: integer overflow")
	ErrUnexpectedEndOfGroupTask = fmt.Errorf("proto: unexpected end of group")
)
View Source
var ResultCode_name = map[int32]string{
	0: "Success",
	1: "Failed",
}
View Source
var ResultCode_value = map[string]int32{
	"Success": 0,
	"Failed":  1,
}
View Source
var TaskCode_name = map[int32]string{
	0: "TestOnly",
	1: "SystemInit",
	2: "MetricLogMerge",
	3: "MetricStorageUsage",
}
View Source
var TaskCode_value = map[string]int32{
	"TestOnly":           0,
	"SystemInit":         1,
	"MetricLogMerge":     2,
	"MetricStorageUsage": 3,
}
View Source
var TaskStatus_name = map[int32]string{
	0: "Created",
	1: "Running",
	2: "Completed",
}
View Source
var TaskStatus_value = map[string]int32{
	"Created":   0,
	"Running":   1,
	"Completed": 2,
}

Functions

This section is empty.

Types

type CronTask

type CronTask struct {
	ID uint64 `protobuf:"varint,1,opt,name=ID,proto3" json:"ID,omitempty"`
	// TaskMetadata task metadata
	Metadata TaskMetadata `protobuf:"bytes,2,opt,name=Metadata,proto3" json:"Metadata"`
	// CronExpr cron expr
	CronExpr string `protobuf:"bytes,3,opt,name=CronExpr,proto3" json:"CronExpr,omitempty"`
	// NextTime the next time it should be scheduled for execution. Unix timestamp in ms
	NextTime int64 `protobuf:"varint,4,opt,name=NextTime,proto3" json:"NextTime,omitempty"`
	// TriggerTimes the number of times it was triggered
	TriggerTimes uint64 `protobuf:"varint,5,opt,name=TriggerTimes,proto3" json:"TriggerTimes,omitempty"`
	// CreateAt time of the cron task created. Unix timestamp in ms
	CreateAt int64 `protobuf:"varint,6,opt,name=CreateAt,proto3" json:"CreateAt,omitempty"`
	// CreateAt time of the cron task created. Unix timestamp in ms
	UpdateAt             int64    `protobuf:"varint,7,opt,name=UpdateAt,proto3" json:"UpdateAt,omitempty"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

CronTask task execute info.

func (CronTask) DebugString

func (m CronTask) DebugString() string

DebugString returns the debug string

func (*CronTask) Descriptor

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

func (*CronTask) GetCreateAt

func (m *CronTask) GetCreateAt() int64

func (*CronTask) GetCronExpr

func (m *CronTask) GetCronExpr() string

func (*CronTask) GetID

func (m *CronTask) GetID() uint64

func (*CronTask) GetMetadata

func (m *CronTask) GetMetadata() TaskMetadata

func (*CronTask) GetNextTime

func (m *CronTask) GetNextTime() int64

func (*CronTask) GetTriggerTimes

func (m *CronTask) GetTriggerTimes() uint64

func (*CronTask) GetUpdateAt

func (m *CronTask) GetUpdateAt() int64

func (*CronTask) Marshal

func (m *CronTask) Marshal() (dAtA []byte, err error)

func (*CronTask) MarshalTo

func (m *CronTask) MarshalTo(dAtA []byte) (int, error)

func (*CronTask) MarshalToSizedBuffer

func (m *CronTask) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*CronTask) ProtoMessage

func (*CronTask) ProtoMessage()

func (*CronTask) Reset

func (m *CronTask) Reset()

func (*CronTask) Size

func (m *CronTask) Size() (n int)

func (*CronTask) String

func (m *CronTask) String() string

func (*CronTask) Unmarshal

func (m *CronTask) Unmarshal(dAtA []byte) error

func (*CronTask) XXX_DiscardUnknown

func (m *CronTask) XXX_DiscardUnknown()

func (*CronTask) XXX_Marshal

func (m *CronTask) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*CronTask) XXX_Merge

func (m *CronTask) XXX_Merge(src proto.Message)

func (*CronTask) XXX_Size

func (m *CronTask) XXX_Size() int

func (*CronTask) XXX_Unmarshal

func (m *CronTask) XXX_Unmarshal(b []byte) error

type ExecuteResult

type ExecuteResult struct {
	// Code result code
	Code ResultCode `protobuf:"varint,1,opt,name=Code,proto3,enum=task.ResultCode" json:"Code,omitempty"`
	// Error error message
	Error                string   `protobuf:"bytes,2,opt,name=Error,proto3" json:"Error,omitempty"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

ExecuteResult task execute result

func (*ExecuteResult) Descriptor

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

func (*ExecuteResult) GetCode

func (m *ExecuteResult) GetCode() ResultCode

func (*ExecuteResult) GetError

func (m *ExecuteResult) GetError() string

func (*ExecuteResult) Marshal

func (m *ExecuteResult) Marshal() (dAtA []byte, err error)

func (*ExecuteResult) MarshalTo

func (m *ExecuteResult) MarshalTo(dAtA []byte) (int, error)

func (*ExecuteResult) MarshalToSizedBuffer

func (m *ExecuteResult) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*ExecuteResult) ProtoMessage

func (*ExecuteResult) ProtoMessage()

func (*ExecuteResult) Reset

func (m *ExecuteResult) Reset()

func (*ExecuteResult) Size

func (m *ExecuteResult) Size() (n int)

func (*ExecuteResult) String

func (m *ExecuteResult) String() string

func (*ExecuteResult) Unmarshal

func (m *ExecuteResult) Unmarshal(dAtA []byte) error

func (*ExecuteResult) XXX_DiscardUnknown

func (m *ExecuteResult) XXX_DiscardUnknown()

func (*ExecuteResult) XXX_Marshal

func (m *ExecuteResult) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*ExecuteResult) XXX_Merge

func (m *ExecuteResult) XXX_Merge(src proto.Message)

func (*ExecuteResult) XXX_Size

func (m *ExecuteResult) XXX_Size() int

func (*ExecuteResult) XXX_Unmarshal

func (m *ExecuteResult) XXX_Unmarshal(b []byte) error

type ResultCode

type ResultCode int32

ResultCode result code

const (
	// Success success
	ResultCode_Success ResultCode = 0
	// Failed failed
	ResultCode_Failed ResultCode = 1
)

func (ResultCode) EnumDescriptor

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

func (ResultCode) String

func (x ResultCode) String() string

type Task

type Task struct {
	ID uint64 `protobuf:"varint,1,opt,name=ID,proto3" json:"ID,omitempty"`
	// TaskMetadata task metadata
	Metadata TaskMetadata `protobuf:"bytes,2,opt,name=Metadata,proto3" json:"Metadata"`
	// ParentTaskID used to record the parent task of the current task
	ParentTaskID string `protobuf:"bytes,3,opt,name=ParentTaskID,proto3" json:"ParentTaskID,omitempty"`
	// TaskStatus task status
	Status TaskStatus `protobuf:"varint,4,opt,name=Status,proto3,enum=task.TaskStatus" json:"Status,omitempty"`
	// TaskRunner is the UUID of the CN node which the task run is assigned to
	TaskRunner string `protobuf:"bytes,5,opt,name=TaskRunner,proto3" json:"TaskRunner,omitempty"`
	// Epoch indicates how many times the current task is scheduled, the first time it is scheduled
	// is 1. Each time it is scheduled, Epoch++.
	Epoch uint32 `protobuf:"varint,6,opt,name=Epoch,proto3" json:"Epoch,omitempty"`
	// LastHeartbeat time of the last heartbeat reported by TaskRunner. Unix timestamp in ms
	LastHeartbeat int64 `protobuf:"varint,7,opt,name=LastHeartbeat,proto3" json:"LastHeartbeat,omitempty"`
	// CreateAt time of the task created. Unix timestamp in ms
	CreateAt int64 `protobuf:"varint,8,opt,name=CreateAt,proto3" json:"CreateAt,omitempty"`
	// CompletedAt time of the task completed. Unix timestamp in ms
	CompletedAt int64 `protobuf:"varint,9,opt,name=CompletedAt,proto3" json:"CompletedAt,omitempty"`
	// ExecuteResult execute result
	ExecuteResult        *ExecuteResult `protobuf:"bytes,10,opt,name=ExecuteResult,proto3" json:"ExecuteResult,omitempty"`
	XXX_NoUnkeyedLiteral struct{}       `json:"-"`
	XXX_unrecognized     []byte         `json:"-"`
	XXX_sizecache        int32          `json:"-"`
}

Task task execute info.

func (Task) DebugString

func (m Task) DebugString() string

DebugString returns the debug string

func (*Task) Descriptor

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

func (*Task) GetCompletedAt

func (m *Task) GetCompletedAt() int64

func (*Task) GetCreateAt

func (m *Task) GetCreateAt() int64

func (Task) GetDelayDuration

func (m Task) GetDelayDuration() time.Duration

GetDelayDuration returns delay duration

func (*Task) GetEpoch

func (m *Task) GetEpoch() uint32

func (*Task) GetExecuteResult

func (m *Task) GetExecuteResult() *ExecuteResult

func (*Task) GetID

func (m *Task) GetID() uint64

func (*Task) GetLastHeartbeat

func (m *Task) GetLastHeartbeat() int64

func (*Task) GetMetadata

func (m *Task) GetMetadata() TaskMetadata

func (*Task) GetParentTaskID

func (m *Task) GetParentTaskID() string

func (*Task) GetStatus

func (m *Task) GetStatus() TaskStatus

func (*Task) GetTaskRunner

func (m *Task) GetTaskRunner() string

func (Task) IsDelayTask

func (m Task) IsDelayTask() bool

IsDelayTask returns true if the task is a delay task

func (Task) IsInitTask added in v0.7.0

func (m Task) IsInitTask() bool

IsInitTask returns true if the task is an init task

func (*Task) Marshal

func (m *Task) Marshal() (dAtA []byte, err error)

func (*Task) MarshalTo

func (m *Task) MarshalTo(dAtA []byte) (int, error)

func (*Task) MarshalToSizedBuffer

func (m *Task) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*Task) ProtoMessage

func (*Task) ProtoMessage()

func (*Task) Reset

func (m *Task) Reset()

func (*Task) Size

func (m *Task) Size() (n int)

func (*Task) String

func (m *Task) String() string

func (*Task) Unmarshal

func (m *Task) Unmarshal(dAtA []byte) error

func (*Task) XXX_DiscardUnknown

func (m *Task) XXX_DiscardUnknown()

func (*Task) XXX_Marshal

func (m *Task) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*Task) XXX_Merge

func (m *Task) XXX_Merge(src proto.Message)

func (*Task) XXX_Size

func (m *Task) XXX_Size() int

func (*Task) XXX_Unmarshal

func (m *Task) XXX_Unmarshal(b []byte) error

type TaskCode

type TaskCode int32

TaskCode task code

const (
	// TestOnly reserved for testing.
	TaskCode_TestOnly TaskCode = 0
	// SystemInit system init task
	TaskCode_SystemInit TaskCode = 1
	// MetricLogMerge handle metric/log exported data merge task
	TaskCode_MetricLogMerge TaskCode = 2
	// MetricStorageUsage handle metric server_storage_usage collection
	TaskCode_MetricStorageUsage TaskCode = 3
)

func (TaskCode) EnumDescriptor

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

func (TaskCode) String

func (x TaskCode) String() string

type TaskMetadata

type TaskMetadata struct {
	// ID task id, global unique
	ID string `protobuf:"bytes,1,opt,name=ID,proto3" json:"ID,omitempty"`
	// Executor used to select a particular task executor to run a task
	Executor TaskCode `protobuf:"varint,2,opt,name=Executor,proto3,enum=task.TaskCode" json:"Executor,omitempty"`
	// Context context needed to run the task
	Context []byte `protobuf:"bytes,3,opt,name=Context,proto3" json:"Context,omitempty"`
	// Options options for execute task
	Options              TaskOptions `protobuf:"bytes,4,opt,name=Options,proto3" json:"Options"`
	XXX_NoUnkeyedLiteral struct{}    `json:"-"`
	XXX_unrecognized     []byte      `json:"-"`
	XXX_sizecache        int32       `json:"-"`
}

TaskMetadata is a task metadata abstraction that can be scheduled for execution at any CN node.

func (*TaskMetadata) Descriptor

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

func (*TaskMetadata) GetContext

func (m *TaskMetadata) GetContext() []byte

func (*TaskMetadata) GetExecutor

func (m *TaskMetadata) GetExecutor() TaskCode

func (*TaskMetadata) GetID

func (m *TaskMetadata) GetID() string

func (*TaskMetadata) GetOptions

func (m *TaskMetadata) GetOptions() TaskOptions

func (*TaskMetadata) Marshal

func (m *TaskMetadata) Marshal() (dAtA []byte, err error)

func (*TaskMetadata) MarshalTo

func (m *TaskMetadata) MarshalTo(dAtA []byte) (int, error)

func (*TaskMetadata) MarshalToSizedBuffer

func (m *TaskMetadata) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*TaskMetadata) ProtoMessage

func (*TaskMetadata) ProtoMessage()

func (*TaskMetadata) Reset

func (m *TaskMetadata) Reset()

func (*TaskMetadata) Size

func (m *TaskMetadata) Size() (n int)

func (*TaskMetadata) String

func (m *TaskMetadata) String() string

func (*TaskMetadata) Unmarshal

func (m *TaskMetadata) Unmarshal(dAtA []byte) error

func (*TaskMetadata) XXX_DiscardUnknown

func (m *TaskMetadata) XXX_DiscardUnknown()

func (*TaskMetadata) XXX_Marshal

func (m *TaskMetadata) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*TaskMetadata) XXX_Merge

func (m *TaskMetadata) XXX_Merge(src proto.Message)

func (*TaskMetadata) XXX_Size

func (m *TaskMetadata) XXX_Size() int

func (*TaskMetadata) XXX_Unmarshal

func (m *TaskMetadata) XXX_Unmarshal(b []byte) error

type TaskOptions

type TaskOptions struct {
	// MaxRetryTimes 0 means disable retry
	MaxRetryTimes uint32 `protobuf:"varint,1,opt,name=MaxRetryTimes,proto3" json:"MaxRetryTimes,omitempty"`
	// RetryInterval retry interval
	RetryInterval int64 `protobuf:"varint,2,opt,name=RetryInterval,proto3" json:"RetryInterval,omitempty"`
	// DelayDuration delay duration. Controls how long a task is delayed before it is scheduled for
	// execution.
	DelayDuration int64 `protobuf:"varint,3,opt,name=DelayDuration,proto3" json:"DelayDuration,omitempty"`
	// Concurrency is the max number of a task running at the same time. 0 means no limits.
	Concurrency          uint32   `protobuf:"varint,4,opt,name=Concurrency,proto3" json:"Concurrency,omitempty"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

TaskOptions task options

func (*TaskOptions) Descriptor

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

func (*TaskOptions) GetConcurrency added in v0.7.0

func (m *TaskOptions) GetConcurrency() uint32

func (*TaskOptions) GetDelayDuration

func (m *TaskOptions) GetDelayDuration() int64

func (*TaskOptions) GetMaxRetryTimes

func (m *TaskOptions) GetMaxRetryTimes() uint32

func (*TaskOptions) GetRetryInterval

func (m *TaskOptions) GetRetryInterval() int64

func (*TaskOptions) Marshal

func (m *TaskOptions) Marshal() (dAtA []byte, err error)

func (*TaskOptions) MarshalTo

func (m *TaskOptions) MarshalTo(dAtA []byte) (int, error)

func (*TaskOptions) MarshalToSizedBuffer

func (m *TaskOptions) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*TaskOptions) ProtoMessage

func (*TaskOptions) ProtoMessage()

func (*TaskOptions) Reset

func (m *TaskOptions) Reset()

func (*TaskOptions) Size

func (m *TaskOptions) Size() (n int)

func (*TaskOptions) String

func (m *TaskOptions) String() string

func (*TaskOptions) Unmarshal

func (m *TaskOptions) Unmarshal(dAtA []byte) error

func (*TaskOptions) XXX_DiscardUnknown

func (m *TaskOptions) XXX_DiscardUnknown()

func (*TaskOptions) XXX_Marshal

func (m *TaskOptions) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*TaskOptions) XXX_Merge

func (m *TaskOptions) XXX_Merge(src proto.Message)

func (*TaskOptions) XXX_Size

func (m *TaskOptions) XXX_Size() int

func (*TaskOptions) XXX_Unmarshal

func (m *TaskOptions) XXX_Unmarshal(b []byte) error

type TaskStatus

type TaskStatus int32

TaskStatus task status

const (
	// Create is the state of waiting to be scheduled.
	TaskStatus_Created TaskStatus = 0
	// Running is running state. Task is assigned to a CN node and is running
	TaskStatus_Running TaskStatus = 1
	// Completed the task has been completed.
	TaskStatus_Completed TaskStatus = 2
)

func (TaskStatus) EnumDescriptor

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

func (TaskStatus) String

func (x TaskStatus) String() string

Jump to

Keyboard shortcuts

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