Files
orchard/pkg/resource/v1/cluster_settings.go
T
Nikolay Edigaryev 9cdfd75f79 Badger store: avoid code duplication by using generic methods (#369)
* Badger store: avoid code duplication by using generic methods

* No need to return PT, can return just *T
2025-11-17 18:34:59 +04:00

29 lines
817 B
Go

package v1
import "fmt"
type SchedulerProfile string
const (
SchedulerProfileOptimizeUtilization SchedulerProfile = "optimize-utilization"
SchedulerProfileDistributeLoad SchedulerProfile = "distribute-load"
)
type ClusterSettings struct {
HostDirPolicies []HostDirPolicy `json:"hostDirPolicies,omitempty"`
SchedulerProfile SchedulerProfile `json:"schedulerProfile,omitempty"`
}
func (clusterSettings *ClusterSettings) SetVersion(_ uint64) {}
func NewSchedulerProfile(value string) (SchedulerProfile, error) {
switch value {
case string(SchedulerProfileOptimizeUtilization):
return SchedulerProfileOptimizeUtilization, nil
case string(SchedulerProfileDistributeLoad):
return SchedulerProfileDistributeLoad, nil
default:
return "", fmt.Errorf("unsupported scheduler profile: %q", value)
}
}