feat: remove deprecated field in manager and scheduler (#2345)

Signed-off-by: Gaius <gaius.qi@gmail.com>
This commit is contained in:
Gaius 2023-05-11 20:03:12 +08:00
parent 600ccdbd57
commit b97c0cb0ae
No known key found for this signature in database
GPG Key ID: 8B4E5D1290FA2FFB
2 changed files with 0 additions and 40 deletions

View File

@ -249,9 +249,6 @@ type MetricsConfig struct {
} }
type GRPCConfig struct { type GRPCConfig struct {
// DEPRECATED: Please use the `listenIP` field instead.
Listen string `mapstructure:"listen" yaml:"listen"`
// AdvertiseIP is advertise ip. // AdvertiseIP is advertise ip.
AdvertiseIP net.IP `yaml:"advertiseIP" mapstructure:"advertiseIP"` AdvertiseIP net.IP `yaml:"advertiseIP" mapstructure:"advertiseIP"`
@ -601,11 +598,6 @@ func (cfg *Config) Convert() error {
cfg.Database.Redis.Addrs = []string{fmt.Sprintf("%s:%d", cfg.Database.Redis.Host, cfg.Database.Redis.Port)} cfg.Database.Redis.Addrs = []string{fmt.Sprintf("%s:%d", cfg.Database.Redis.Host, cfg.Database.Redis.Port)}
} }
// TODO Compatible with deprecated fields listen.
if cfg.Server.GRPC.Listen != "" && cfg.Server.GRPC.ListenIP == nil {
cfg.Server.GRPC.ListenIP = net.ParseIP(cfg.Server.GRPC.Listen)
}
if cfg.Server.GRPC.AdvertiseIP == nil { if cfg.Server.GRPC.AdvertiseIP == nil {
if cfg.Network.EnableIPv6 { if cfg.Network.EnableIPv6 {
cfg.Server.GRPC.AdvertiseIP = ip.IPv6 cfg.Server.GRPC.AdvertiseIP = ip.IPv6

View File

@ -78,12 +78,6 @@ type Config struct {
} }
type ServerConfig struct { type ServerConfig struct {
// DEPRECATED: Please use the `advertiseIP` field instead.
IP string `yaml:"ip" mapstructure:"ip"`
// DEPRECATED: Please use the `listenIP` field instead.
Listen string `yaml:"listen" mapstructure:"listen"`
// AdvertiseIP is advertise ip. // AdvertiseIP is advertise ip.
AdvertiseIP net.IP `yaml:"advertiseIP" mapstructure:"advertiseIP"` AdvertiseIP net.IP `yaml:"advertiseIP" mapstructure:"advertiseIP"`
@ -124,12 +118,6 @@ type SchedulerConfig struct {
// Algorithm is scheduling algorithm used by the scheduler. // Algorithm is scheduling algorithm used by the scheduler.
Algorithm string `yaml:"algorithm" mapstructure:"algorithm"` Algorithm string `yaml:"algorithm" mapstructure:"algorithm"`
// DEPRECATED: Please use the `backToSourceCount` field instead.
BackSourceCount int `yaml:"backSourceCount" mapstructure:"backSourceCount"`
// DEPRECATED: Please use the `retryBackToSourceLimit` field instead.
RetryBackSourceLimit int `yaml:"retryBackSourceLimit" mapstructure:"retryBackSourceLimit"`
// BackToSourceCount is single task allows the peer to back-to-source count. // BackToSourceCount is single task allows the peer to back-to-source count.
BackToSourceCount int `yaml:"backToSourceCount" mapstructure:"backToSourceCount"` BackToSourceCount int `yaml:"backToSourceCount" mapstructure:"backToSourceCount"`
@ -613,16 +601,6 @@ func (cfg *Config) Validate() error {
} }
func (cfg *Config) Convert() error { func (cfg *Config) Convert() error {
// TODO Compatible with deprecated fields backSourceCount.
if cfg.Scheduler.BackSourceCount != 0 {
cfg.Scheduler.BackToSourceCount = cfg.Scheduler.BackSourceCount
}
// TODO Compatible with deprecated fields retryBackSourceLimit.
if cfg.Scheduler.RetryBackSourceLimit != 0 {
cfg.Scheduler.RetryBackToSourceLimit = cfg.Scheduler.RetryBackSourceLimit
}
// TODO Compatible with deprecated fields address of redis of job. // TODO Compatible with deprecated fields address of redis of job.
if len(cfg.Database.Redis.Addrs) == 0 && len(cfg.Job.Redis.Addrs) != 0 { if len(cfg.Database.Redis.Addrs) == 0 && len(cfg.Job.Redis.Addrs) != 0 {
cfg.Database.Redis.Addrs = cfg.Job.Redis.Addrs cfg.Database.Redis.Addrs = cfg.Job.Redis.Addrs
@ -658,16 +636,6 @@ func (cfg *Config) Convert() error {
cfg.Database.Redis.BackendDB = cfg.Job.Redis.BackendDB cfg.Database.Redis.BackendDB = cfg.Job.Redis.BackendDB
} }
// TODO Compatible with deprecated fields ip.
if cfg.Server.IP != "" && cfg.Server.AdvertiseIP == nil {
cfg.Server.AdvertiseIP = net.ParseIP(cfg.Server.IP)
}
// TODO Compatible with deprecated fields listen.
if cfg.Server.Listen != "" && cfg.Server.ListenIP == nil {
cfg.Server.ListenIP = net.ParseIP(cfg.Server.Listen)
}
if cfg.Server.AdvertiseIP == nil { if cfg.Server.AdvertiseIP == nil {
if cfg.Network.EnableIPv6 { if cfg.Network.EnableIPv6 {
cfg.Server.AdvertiseIP = ip.IPv6 cfg.Server.AdvertiseIP = ip.IPv6