aboutsummaryrefslogtreecommitdiff
path: root/weed/worker/tasks/task.go
diff options
context:
space:
mode:
authorChris Lu <chrislusf@users.noreply.github.com>2025-08-01 11:18:32 -0700
committerGitHub <noreply@github.com>2025-08-01 11:18:32 -0700
commit0975968e71b05368d5f28f788cf863c2042c2696 (patch)
tree5162a5fe3d9c88fb43f49f57326a4fd5b8cde74c /weed/worker/tasks/task.go
parent1cba609bfa2306cc2885df212febd5ff954aa693 (diff)
downloadseaweedfs-0975968e71b05368d5f28f788cf863c2042c2696.tar.xz
seaweedfs-0975968e71b05368d5f28f788cf863c2042c2696.zip
admin: Refactor task destination planning (#7063)
* refactor planning into task detection * refactoring worker tasks * refactor * compiles, but only balance task is registered * compiles, but has nil exception * avoid nil logger * add back ec task * setting ec log directory * implement balance and vacuum tasks * EC tasks will no longer fail with "file not found" errors * Use ReceiveFile API to send locally generated shards * distributing shard files and ecx,ecj,vif files * generate .ecx files correctly * do not mount all possible EC shards (0-13) on every destination * use constants * delete all replicas * rename files * pass in volume size to tasks
Diffstat (limited to 'weed/worker/tasks/task.go')
-rw-r--r--weed/worker/tasks/task.go53
1 files changed, 0 insertions, 53 deletions
diff --git a/weed/worker/tasks/task.go b/weed/worker/tasks/task.go
index 15369c137..9813ae97f 100644
--- a/weed/worker/tasks/task.go
+++ b/weed/worker/tasks/task.go
@@ -318,59 +318,6 @@ func (t *BaseTask) ExecuteTask(ctx context.Context, params types.TaskParams, exe
return nil
}
-// TaskRegistry manages task factories
-type TaskRegistry struct {
- factories map[types.TaskType]types.TaskFactory
- mutex sync.RWMutex
-}
-
-// NewTaskRegistry creates a new task registry
-func NewTaskRegistry() *TaskRegistry {
- return &TaskRegistry{
- factories: make(map[types.TaskType]types.TaskFactory),
- }
-}
-
-// Register registers a task factory
-func (r *TaskRegistry) Register(taskType types.TaskType, factory types.TaskFactory) {
- r.mutex.Lock()
- defer r.mutex.Unlock()
- r.factories[taskType] = factory
-}
-
-// CreateTask creates a task instance
-func (r *TaskRegistry) CreateTask(taskType types.TaskType, params types.TaskParams) (types.TaskInterface, error) {
- r.mutex.RLock()
- factory, exists := r.factories[taskType]
- r.mutex.RUnlock()
-
- if !exists {
- return nil, &UnsupportedTaskTypeError{TaskType: taskType}
- }
-
- return factory.Create(params)
-}
-
-// GetSupportedTypes returns all supported task types
-func (r *TaskRegistry) GetSupportedTypes() []types.TaskType {
- r.mutex.RLock()
- defer r.mutex.RUnlock()
-
- types := make([]types.TaskType, 0, len(r.factories))
- for taskType := range r.factories {
- types = append(types, taskType)
- }
- return types
-}
-
-// GetFactory returns the factory for a task type
-func (r *TaskRegistry) GetFactory(taskType types.TaskType) (types.TaskFactory, bool) {
- r.mutex.RLock()
- defer r.mutex.RUnlock()
- factory, exists := r.factories[taskType]
- return factory, exists
-}
-
// UnsupportedTaskTypeError represents an error for unsupported task types
type UnsupportedTaskTypeError struct {
TaskType types.TaskType