task_config_interface.go 747 B

12345678910111213141516171819202122232425
  1. package handlers
  2. import (
  3. "github.com/seaweedfs/seaweedfs/weed/admin/config"
  4. "github.com/seaweedfs/seaweedfs/weed/pb/worker_pb"
  5. )
  6. // TaskConfig defines the interface that all task configuration types must implement
  7. type TaskConfig interface {
  8. config.ConfigWithDefaults // Extends ConfigWithDefaults for type-safe schema operations
  9. // Common methods from BaseConfig
  10. IsEnabled() bool
  11. SetEnabled(enabled bool)
  12. // Protobuf serialization methods - no more map[string]interface{}!
  13. ToTaskPolicy() *worker_pb.TaskPolicy
  14. FromTaskPolicy(policy *worker_pb.TaskPolicy) error
  15. }
  16. // TaskConfigProvider defines the interface for creating specific task config types
  17. type TaskConfigProvider interface {
  18. NewConfig() TaskConfig
  19. GetTaskType() string
  20. }