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
This commit is contained in:
Nikolay Edigaryev
2025-11-17 18:34:59 +04:00
committed by GitHub
parent dbb180befb
commit 9cdfd75f79
12 changed files with 146 additions and 287 deletions
+2
View File
@@ -14,6 +14,8 @@ type ClusterSettings struct {
SchedulerProfile SchedulerProfile `json:"schedulerProfile,omitempty"`
}
func (clusterSettings *ClusterSettings) SetVersion(_ uint64) {}
func NewSchedulerProfile(value string) (SchedulerProfile, error) {
switch value {
case string(SchedulerProfileOptimizeUtilization):
+2
View File
@@ -6,3 +6,5 @@ type ServiceAccount struct {
Meta
}
func (serviceAccount *ServiceAccount) SetVersion(_ uint64) {}
+4
View File
@@ -97,6 +97,10 @@ type VM struct {
Meta
}
func (vm *VM) SetVersion(version uint64) {
vm.Version = version
}
type VMSpec struct {
NetSoftnetDeprecated bool `json:"net-softnet,omitempty"`
NetSoftnet bool `json:"netSoftnet,omitempty"`
+2
View File
@@ -30,3 +30,5 @@ type Worker struct {
func (worker Worker) Offline(workerOfflineTimeout time.Duration) bool {
return time.Since(worker.LastSeen) > workerOfflineTimeout
}
func (worker *Worker) SetVersion(_ uint64) {}