storage

package
v0.0.0-...-503c688 Latest Latest
Warning

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

Go to latest
Published: Nov 8, 2023 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SetTaskManager

func SetTaskManager(is *TaskManager)

SetTaskManager sets the task manager.

Types

type TaskManager

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

TaskManager is the manager of global/sub task.

func GetTaskManager

func GetTaskManager() (*TaskManager, error)

GetTaskManager gets the task manager.

func NewTaskManager

func NewTaskManager(ctx context.Context, sePool *pools.ResourcePool) *TaskManager

NewTaskManager creates a new task manager.

func (*TaskManager) AddNewGlobalTask

func (stm *TaskManager) AddNewGlobalTask(key, tp string, concurrency int, meta []byte) (taskID int64, err error)

AddNewGlobalTask adds a new task to global task table.

func (*TaskManager) AddNewSubTask

func (stm *TaskManager) AddNewSubTask(globalTaskID int64, designatedTiDBID string, meta []byte, tp string, isRevert bool) error

AddNewSubTask adds a new task to subtask table.

func (*TaskManager) CancelGlobalTask

func (stm *TaskManager) CancelGlobalTask(taskID int64) error

CancelGlobalTask cancels global task

func (*TaskManager) CollectSubTaskError

func (stm *TaskManager) CollectSubTaskError(taskID int64) ([][]byte, error)

CollectSubTaskError collects the subtask error.

func (*TaskManager) DeleteSubtasksByTaskID

func (stm *TaskManager) DeleteSubtasksByTaskID(taskID int64) error

DeleteSubtasksByTaskID deletes the subtask of the given global task ID.

func (*TaskManager) GetGlobalTaskByID

func (stm *TaskManager) GetGlobalTaskByID(taskID int64) (task *proto.Task, err error)

GetGlobalTaskByID gets the task by the global task ID.

func (*TaskManager) GetGlobalTaskByKey

func (stm *TaskManager) GetGlobalTaskByKey(key string) (task *proto.Task, err error)

GetGlobalTaskByKey gets the task by the task key

func (*TaskManager) GetGlobalTasksInStates

func (stm *TaskManager) GetGlobalTasksInStates(states ...interface{}) (task []*proto.Task, err error)

GetGlobalTasksInStates gets the tasks in the states.

func (*TaskManager) GetNewGlobalTask

func (stm *TaskManager) GetNewGlobalTask() (task *proto.Task, err error)

GetNewGlobalTask get a new task from global task table, it's used by dispatcher only.

func (*TaskManager) GetSchedulerIDsByTaskID

func (stm *TaskManager) GetSchedulerIDsByTaskID(taskID int64) ([]string, error)

GetSchedulerIDsByTaskID gets the scheduler IDs of the given global task ID.

func (*TaskManager) GetSubtaskInStates

func (stm *TaskManager) GetSubtaskInStates(tidbID string, taskID int64, states ...interface{}) (*proto.Subtask, error)

GetSubtaskInStates gets the subtask in the states.

func (*TaskManager) GetSubtaskInStatesCnt

func (stm *TaskManager) GetSubtaskInStatesCnt(taskID int64, states ...interface{}) (int64, error)

GetSubtaskInStatesCnt gets the subtask count in the states.

func (*TaskManager) HasSubtasksInStates

func (stm *TaskManager) HasSubtasksInStates(tidbID string, taskID int64, states ...interface{}) (bool, error)

HasSubtasksInStates checks if there are subtasks in the states.

func (*TaskManager) IsGlobalTaskCancelling

func (stm *TaskManager) IsGlobalTaskCancelling(taskID int64) (bool, error)

IsGlobalTaskCancelling checks whether the task state is cancelling

func (*TaskManager) UpdateGlobalTaskAndAddSubTasks

func (stm *TaskManager) UpdateGlobalTaskAndAddSubTasks(gTask *proto.Task, subtasks []*proto.Subtask, isSubtaskRevert bool) error

UpdateGlobalTaskAndAddSubTasks update the global task and add new subtasks

func (*TaskManager) UpdateSubtaskHeartbeat

func (stm *TaskManager) UpdateSubtaskHeartbeat(instanceID string, taskID int64, heartbeat time.Time) error

UpdateSubtaskHeartbeat updates the heartbeat of the subtask.

func (*TaskManager) UpdateSubtaskStateAndError

func (stm *TaskManager) UpdateSubtaskStateAndError(id int64, state string, subTaskErr string) error

UpdateSubtaskStateAndError updates the subtask state.

Jump to

Keyboard shortcuts

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