-
Notifications
You must be signed in to change notification settings - Fork 28
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
factor, config: add configs for factors (#552)
- Loading branch information
Showing
15 changed files
with
261 additions
and
38 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
// Copyright 2024 PingCAP, Inc. | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
package config | ||
|
||
type Balance struct { | ||
Label LabelBalance `yaml:"label,omitempty" toml:"label,omitempty" json:"label,omitempty"` | ||
Error ErrorBalance `yaml:"error,omitempty" toml:"error,omitempty" json:"error,omitempty"` | ||
Memory MemoryBalance `yaml:"memory,omitempty" toml:"memory,omitempty" json:"memory,omitempty"` | ||
CPU CPUBalance `yaml:"cpu,omitempty" toml:"cpu,omitempty" json:"cpu,omitempty"` | ||
Location LocationBalance `yaml:"location,omitempty" toml:"location,omitempty" json:"location,omitempty"` | ||
} | ||
|
||
type LabelBalance struct { | ||
Enable bool `yaml:"enable,omitempty" toml:"enable,omitempty" json:"enable,omitempty"` | ||
LabelName string `yaml:"label-name,omitempty" toml:"label-name,omitempty" json:"label-name,omitempty"` | ||
} | ||
|
||
type ErrorBalance struct { | ||
Enable bool `yaml:"enable,omitempty" toml:"enable,omitempty" json:"enable,omitempty"` | ||
} | ||
|
||
type MemoryBalance struct { | ||
Enable bool `yaml:"enable,omitempty" toml:"enable,omitempty" json:"enable,omitempty"` | ||
} | ||
|
||
type CPUBalance struct { | ||
Enable bool `yaml:"enable,omitempty" toml:"enable,omitempty" json:"enable,omitempty"` | ||
} | ||
|
||
type LocationBalance struct { | ||
Enable bool `yaml:"enable,omitempty" toml:"enable,omitempty" json:"enable,omitempty"` | ||
LocationFirst bool `yaml:"location-first,omitempty" toml:"location-first,omitempty" json:"location-first,omitempty"` | ||
} | ||
|
||
func DefaultBalance() Balance { | ||
return Balance{ | ||
Label: LabelBalance{Enable: false}, | ||
Error: ErrorBalance{Enable: true}, | ||
Memory: MemoryBalance{Enable: true}, | ||
CPU: CPUBalance{Enable: true}, | ||
Location: LocationBalance{Enable: true, LocationFirst: true}, | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.