优化结构

This commit is contained in:
Yvan
2026-08-24 13:25:16 +08:00
parent 7a9a738c6a
commit 0b6b8ddf1a
72 changed files with 2475 additions and 1443 deletions
-17
View File
@@ -6,23 +6,6 @@ type TaskMethodFunc = platformtask.MethodFunc
type TaskMethod = platformtask.Method
type TaskMethodRegistry interface {
Register(platformtask.Method)
Lookup(string) (TaskMethodFunc, bool)
List() []TaskMethod
}
var defaultTaskMethods = platformtask.NewRegistry()
// RegisterTaskMethod remains as a compatibility helper for tests and callers
// that have not moved to constructor injection yet.
func RegisterTaskMethod(name, description string, fn TaskMethodFunc) {
defaultTaskMethods.Register(platformtask.Method{Name: name, Description: description, Run: fn})
}
func TaskMethodByName(name string) (TaskMethodFunc, bool) {
return defaultTaskMethods.Lookup(name)
}
func RegisteredTaskMethods() []TaskMethod { return defaultTaskMethods.List() }
func DefaultTaskMethodRegistry() TaskMethodRegistry { return defaultTaskMethods }