config

package
v3.1.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 26, 2020 License: Apache-2.0 Imports: 27 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsDefaultScheduler

func IsDefaultScheduler(typ string) bool

IsDefaultScheduler checks whether the scheduler is enable by default.

func IsDeprecated

func IsDeprecated(config string) bool

IsDeprecated returns if a config is deprecated.

func ParseUrls

func ParseUrls(s string) ([]url.URL, error)

ParseUrls parse a string into multiple urls. Export for api.

func ValidateLabelString

func ValidateLabelString(s string) error

ValidateLabelString checks the legality of the label string. The valid label consists of alphanumeric characters, '-', '_', '.' or '/', and must start and end with an alphanumeric character.

func ValidateLabels

func ValidateLabels(labels []*metapb.StoreLabel) error

ValidateLabels checks the legality of the labels.

Types

type Config

type Config struct {
	Version bool `json:"-"`

	ConfigCheck bool `json:"-"`

	ClientUrls          string `toml:"client-urls" json:"client-urls"`
	PeerUrls            string `toml:"peer-urls" json:"peer-urls"`
	AdvertiseClientUrls string `toml:"advertise-client-urls" json:"advertise-client-urls"`
	AdvertisePeerUrls   string `toml:"advertise-peer-urls" json:"advertise-peer-urls"`

	Name              string `toml:"name" json:"name"`
	DataDir           string `toml:"data-dir" json:"data-dir"`
	ForceNewCluster   bool   `json:"force-new-cluster"`
	EnableGRPCGateway bool   `json:"enable-grpc-gateway"`

	InitialCluster      string `toml:"initial-cluster" json:"initial-cluster"`
	InitialClusterState string `toml:"initial-cluster-state" json:"initial-cluster-state"`

	// Join to an existing pd cluster, a string of endpoints.
	Join string `toml:"join" json:"join"`

	// LeaderLease time, if leader doesn't update its TTL
	// in etcd after lease time, etcd will expire the leader key
	// and other servers can campaign the leader again.
	// Etcd only supports seconds TTL, so here is second too.
	LeaderLease int64 `toml:"lease" json:"lease"`

	// Log related config.
	Log log.Config `toml:"log" json:"log"`

	// Backward compatibility.
	LogFileDeprecated  string `toml:"log-file" json:"log-file"`
	LogLevelDeprecated string `toml:"log-level" json:"log-level"`

	// TsoSaveInterval is the interval to save timestamp.
	TsoSaveInterval typeutil.Duration `toml:"tso-save-interval" json:"tso-save-interval"`

	Metric metricutil.MetricConfig `toml:"metric" json:"metric"`

	Schedule ScheduleConfig `toml:"schedule" json:"schedule"`

	Replication ReplicationConfig `toml:"replication" json:"replication"`

	PDServerCfg PDServerConfig `toml:"pd-server" json:"pd-server"`

	ClusterVersion semver.Version `toml:"cluster-version" json:"cluster-version"`

	// QuotaBackendBytes Raise alarms when backend size exceeds the given quota. 0 means use the default quota.
	// the default size is 2GB, the maximum is 8GB.
	QuotaBackendBytes typeutil.ByteSize `toml:"quota-backend-bytes" json:"quota-backend-bytes"`
	// AutoCompactionMode is either 'periodic' or 'revision'. The default value is 'periodic'.
	AutoCompactionMode string `toml:"auto-compaction-mode" json:"auto-compaction-mode"`
	// AutoCompactionRetention is either duration string with time unit
	// (e.g. '5m' for 5-minute), or revision unit (e.g. '5000').
	// If no time unit is provided and compaction mode is 'periodic',
	// the unit defaults to hour. For example, '5' translates into 5-hour.
	// The default retention is 1 hour.
	// Before etcd v3.3.x, the type of retention is int. We add 'v2' suffix to make it backward compatible.
	AutoCompactionRetention string `toml:"auto-compaction-retention" json:"auto-compaction-retention-v2"`

	// TickInterval is the interval for etcd Raft tick.
	TickInterval typeutil.Duration `toml:"tick-interval"`
	// ElectionInterval is the interval for etcd Raft election.
	ElectionInterval typeutil.Duration `toml:"election-interval"`
	// Prevote is true to enable Raft Pre-Vote.
	// If enabled, Raft runs an additional election phase
	// to check whether it would get enough votes to win
	// an election, thus minimizing disruptions.
	PreVote bool `toml:"enable-prevote"`

	Security grpcutil.SecurityConfig `toml:"security" json:"security"`

	LabelProperty LabelPropertyConfig `toml:"label-property" json:"label-property"`

	// For all warnings during parsing.
	WarningMsgs []string

	DisableStrictReconfigCheck bool

	HeartbeatStreamBindInterval typeutil.Duration

	LeaderPriorityCheckInterval typeutil.Duration

	EnableDynamicConfig bool

	EnableDashboard bool
	// contains filtered or unexported fields
}

Config is the pd server configuration.

func NewConfig

func NewConfig() *Config

NewConfig creates a new config.

func (*Config) Adjust

func (c *Config) Adjust(meta *toml.MetaData) error

Adjust is used to adjust the PD configurations.

func (*Config) Clone

func (c *Config) Clone() *Config

Clone returns a cloned configuration.

func (*Config) GenEmbedEtcdConfig

func (c *Config) GenEmbedEtcdConfig() (*embed.Config, error)

GenEmbedEtcdConfig generates a configuration for embedded etcd.

func (*Config) GetZapLogProperties

func (c *Config) GetZapLogProperties() *log.ZapProperties

GetZapLogProperties gets properties of the zap logger.

func (*Config) GetZapLogger

func (c *Config) GetZapLogger() *zap.Logger

GetZapLogger gets the created zap logger.

func (*Config) Parse

func (c *Config) Parse(arguments []string) error

Parse parses flag definitions from the argument list.

func (*Config) SetupLogger

func (c *Config) SetupLogger() error

SetupLogger setup the logger.

func (*Config) String

func (c *Config) String() string

func (*Config) Validate

func (c *Config) Validate() error

Validate is used to validate if some configurations are right.

type LabelPropertyConfig

type LabelPropertyConfig map[string][]StoreLabel

LabelPropertyConfig is the config section to set properties to store labels.

func (LabelPropertyConfig) Clone

Clone returns a cloned label property configuration.

type PDServerConfig

type PDServerConfig struct {
	// UseRegionStorage enables the independent region storage.
	UseRegionStorage bool `toml:"use-region-storage" json:"use-region-storage,string"`
	// MaxResetTSGap is the max gap to reset the tso.
	MaxResetTSGap time.Duration `toml:"max-reset-ts-gap" json:"max-reset-ts-gap"`
	// KeyType is option to specify the type of keys.
	// There are some types supported: ["table", "raw", "txn"], default: "table"
	KeyType string `toml:"key-type" json:"key-type"`
	// RuntimeServices is the running the running extension services.
	RuntimeServices typeutil.StringSlice `toml:"runtime-services" json:"runtime-services"`
	// MetricStorage is the cluster metric storage.
	// Currently we use prometheus as metric storage, we may use PD/TiKV as metric storage later.
	MetricStorage string `toml:"metric-storage" json:"metric-storage"`
}

PDServerConfig is the configuration for pd server.

type Replication

type Replication struct {
	// contains filtered or unexported fields
}

Replication provides some help to do replication.

func (*Replication) GetLocationLabels

func (r *Replication) GetLocationLabels() []string

GetLocationLabels returns the location labels for each region.

func (*Replication) GetMaxReplicas

func (r *Replication) GetMaxReplicas() int

GetMaxReplicas returns the number of replicas for each region.

func (*Replication) GetStrictlyMatchLabel

func (r *Replication) GetStrictlyMatchLabel() bool

GetStrictlyMatchLabel returns whether check label strict.

func (*Replication) IsPlacementRulesEnabled

func (r *Replication) IsPlacementRulesEnabled() bool

IsPlacementRulesEnabled returns whether the feature is enabled.

func (*Replication) Load

func (r *Replication) Load() *ReplicationConfig

Load returns replication configurations.

func (*Replication) SetMaxReplicas

func (r *Replication) SetMaxReplicas(replicas int)

SetMaxReplicas set the replicas for each region.

func (*Replication) Store

func (r *Replication) Store(cfg *ReplicationConfig)

Store sets replication configurations.

type ReplicationConfig

type ReplicationConfig struct {
	// MaxReplicas is the number of replicas for each region.
	MaxReplicas uint64 `toml:"max-replicas" json:"max-replicas"`

	// The label keys specified the location of a store.
	// The placement priorities is implied by the order of label keys.
	// For example, ["zone", "rack"] means that we should place replicas to
	// different zones first, then to different racks if we don't have enough zones.
	LocationLabels typeutil.StringSlice `toml:"location-labels" json:"location-labels"`
	// StrictlyMatchLabel strictly checks if the label of TiKV is matched with LocationLabels.
	StrictlyMatchLabel bool `toml:"strictly-match-label" json:"strictly-match-label,string"`

	// When PlacementRules feature is enabled. MaxReplicas and LocationLabels are not uesd any more.
	EnablePlacementRules bool `toml:"enable-placement-rules" json:"enable-placement-rules,string"`
}

ReplicationConfig is the replication configuration.

func (*ReplicationConfig) Validate

func (c *ReplicationConfig) Validate() error

Validate is used to validate if some replication configurations are right.

type ScheduleConfig

type ScheduleConfig struct {
	// If the snapshot count of one store is greater than this value,
	// it will never be used as a source or target store.
	MaxSnapshotCount    uint64 `toml:"max-snapshot-count" json:"max-snapshot-count"`
	MaxPendingPeerCount uint64 `toml:"max-pending-peer-count" json:"max-pending-peer-count"`
	// If both the size of region is smaller than MaxMergeRegionSize
	// and the number of rows in region is smaller than MaxMergeRegionKeys,
	// it will try to merge with adjacent regions.
	MaxMergeRegionSize uint64 `toml:"max-merge-region-size" json:"max-merge-region-size"`
	MaxMergeRegionKeys uint64 `toml:"max-merge-region-keys" json:"max-merge-region-keys"`
	// SplitMergeInterval is the minimum interval time to permit merge after split.
	SplitMergeInterval typeutil.Duration `toml:"split-merge-interval" json:"split-merge-interval"`
	// EnableOneWayMerge is the option to enable one way merge. This means a Region can only be merged into the next region of it.
	EnableOneWayMerge bool `toml:"enable-one-way-merge" json:"enable-one-way-merge,string"`
	// EnableCrossTableMerge is the option to enable cross table merge. This means two Regions can be merged with different table IDs.
	// This option only works when key type is "table".
	EnableCrossTableMerge bool `toml:"enable-cross-table-merge" json:"enable-cross-table-merge,string"`
	// PatrolRegionInterval is the interval for scanning region during patrol.
	PatrolRegionInterval typeutil.Duration `toml:"patrol-region-interval" json:"patrol-region-interval"`
	// MaxStoreDownTime is the max duration after which
	// a store will be considered to be down if it hasn't reported heartbeats.
	MaxStoreDownTime typeutil.Duration `toml:"max-store-down-time" json:"max-store-down-time"`
	// LeaderScheduleLimit is the max coexist leader schedules.
	LeaderScheduleLimit uint64 `toml:"leader-schedule-limit" json:"leader-schedule-limit"`
	// LeaderSchedulePolicy is the option to balance leader, there are some policies supported: ["count", "size"], default: "count"
	LeaderSchedulePolicy string `toml:"leader-schedule-policy" json:"leader-schedule-policy"`
	// RegionScheduleLimit is the max coexist region schedules.
	RegionScheduleLimit uint64 `toml:"region-schedule-limit" json:"region-schedule-limit"`
	// ReplicaScheduleLimit is the max coexist replica schedules.
	ReplicaScheduleLimit uint64 `toml:"replica-schedule-limit" json:"replica-schedule-limit"`
	// MergeScheduleLimit is the max coexist merge schedules.
	MergeScheduleLimit uint64 `toml:"merge-schedule-limit" json:"merge-schedule-limit"`
	// HotRegionScheduleLimit is the max coexist hot region schedules.
	HotRegionScheduleLimit uint64 `toml:"hot-region-schedule-limit" json:"hot-region-schedule-limit"`
	// HotRegionCacheHitThreshold is the cache hits threshold of the hot region.
	// If the number of times a region hits the hot cache is greater than this
	// threshold, it is considered a hot region.
	HotRegionCacheHitsThreshold uint64 `toml:"hot-region-cache-hits-threshold" json:"hot-region-cache-hits-threshold"`
	// StoreBalanceRate is the maximum of balance rate for each store.
	StoreBalanceRate float64 `toml:"store-balance-rate" json:"store-balance-rate"`
	// TolerantSizeRatio is the ratio of buffer size for balance scheduler.
	TolerantSizeRatio float64 `toml:"tolerant-size-ratio" json:"tolerant-size-ratio"`
	//
	//      high space stage         transition stage           low space stage
	//   |--------------------|-----------------------------|-------------------------|
	//   ^                    ^                             ^                         ^
	//   0       HighSpaceRatio * capacity       LowSpaceRatio * capacity          capacity
	//
	// LowSpaceRatio is the lowest usage ratio of store which regraded as low space.
	// When in low space, store region score increases to very large and varies inversely with available size.
	LowSpaceRatio float64 `toml:"low-space-ratio" json:"low-space-ratio"`
	// HighSpaceRatio is the highest usage ratio of store which regraded as high space.
	// High space means there is a lot of spare capacity, and store region score varies directly with used size.
	HighSpaceRatio float64 `toml:"high-space-ratio" json:"high-space-ratio"`
	// SchedulerMaxWaitingOperator is the max coexist operators for each scheduler.
	SchedulerMaxWaitingOperator uint64 `toml:"scheduler-max-waiting-operator" json:"scheduler-max-waiting-operator"`
	// WARN: DisableLearner is deprecated.
	// DisableLearner is the option to disable using AddLearnerNode instead of AddNode.
	DisableLearner bool `toml:"disable-raft-learner" json:"disable-raft-learner,string,omitempty"`
	// DisableRemoveDownReplica is the option to prevent replica checker from
	// removing down replicas.
	// WARN: DisableRemoveDownReplica is deprecated.
	DisableRemoveDownReplica bool `toml:"disable-remove-down-replica" json:"disable-remove-down-replica,string,omitempty"`
	// DisableReplaceOfflineReplica is the option to prevent replica checker from
	// replacing offline replicas.
	// WARN: DisableReplaceOfflineReplica is deprecated.
	DisableReplaceOfflineReplica bool `toml:"disable-replace-offline-replica" json:"disable-replace-offline-replica,string,omitempty"`
	// DisableMakeUpReplica is the option to prevent replica checker from making up
	// replicas when replica count is less than expected.
	// WARN: DisableMakeUpReplica is deprecated.
	DisableMakeUpReplica bool `toml:"disable-make-up-replica" json:"disable-make-up-replica,string,omitempty"`
	// DisableRemoveExtraReplica is the option to prevent replica checker from
	// removing extra replicas.
	// WARN: DisableRemoveExtraReplica is deprecated.
	DisableRemoveExtraReplica bool `toml:"disable-remove-extra-replica" json:"disable-remove-extra-replica,string,omitempty"`
	// DisableLocationReplacement is the option to prevent replica checker from
	// moving replica to a better location.
	// WARN: DisableLocationReplacement is deprecated.
	DisableLocationReplacement bool `toml:"disable-location-replacement" json:"disable-location-replacement,string,omitempty"`

	// EnableRemoveDownReplica is the option to enable replica checker to remove down replica.
	EnableRemoveDownReplica bool `toml:"enable-remove-down-replica" json:"enable-remove-down-replica,string"`
	// EnableReplaceOfflineReplica is the option to enable replica checker to replace offline replica.
	EnableReplaceOfflineReplica bool `toml:"enable-replace-offline-replica" json:"enable-replace-offline-replica,string"`
	// EnableMakeUpReplica is the option to enable replica checker to make up replica.
	EnableMakeUpReplica bool `toml:"enable-make-up-replica" json:"enable-make-up-replica,string"`
	// EnableRemoveExtraReplica is the option to enable replica checker to remove extra replica.
	EnableRemoveExtraReplica bool `toml:"enable-remove-extra-replica" json:"enable-remove-extra-replica,string"`
	// EnableLocationReplacement is the option to enable replica checker to move replica to a better location.
	EnableLocationReplacement bool `toml:"enable-location-replacement" json:"enable-location-replacement,string"`
	// EnableDebugMetrics is the option to enable debug metrics.
	EnableDebugMetrics bool `toml:"enable-debug-metrics" json:"enable-debug-metrics,string"`

	// Schedulers support for loading customized schedulers
	Schedulers SchedulerConfigs `toml:"schedulers" json:"schedulers-v2"` // json v2 is for the sake of compatible upgrade

	// Only used to display
	SchedulersPayload map[string]string `toml:"schedulers-payload" json:"schedulers-payload,omitempty"`

	// StoreLimitMode can be auto or manual, when set to auto,
	// PD tries to change the store limit values according to
	// the load state of the cluster dynamically. User can
	// overwrite the auto-tuned value by pd-ctl, when the value
	// is overwritten, the value is fixed until it is deleted.
	// Default: manual
	StoreLimitMode string `toml:"store-limit-mode" json:"store-limit-mode"`
}

ScheduleConfig is the schedule configuration.

func (*ScheduleConfig) Clone

func (c *ScheduleConfig) Clone() *ScheduleConfig

Clone returns a cloned scheduling configuration.

func (*ScheduleConfig) Deprecated

func (c *ScheduleConfig) Deprecated() error

Deprecated is used to find if there is an option has been deprecated.

func (*ScheduleConfig) MigrateDeprecatedFlags

func (c *ScheduleConfig) MigrateDeprecatedFlags()

MigrateDeprecatedFlags updates new flags according to deprecated flags.

func (*ScheduleConfig) Validate

func (c *ScheduleConfig) Validate() error

Validate is used to validate if some scheduling configurations are right.

type ScheduleOption

type ScheduleOption struct {
	// contains filtered or unexported fields
}

ScheduleOption is a wrapper to access the configuration safely.

func NewScheduleOption

func NewScheduleOption(cfg *Config) *ScheduleOption

NewScheduleOption creates a new ScheduleOption.

func (*ScheduleOption) AddSchedulerCfg

func (o *ScheduleOption) AddSchedulerCfg(tp string, args []string)

AddSchedulerCfg adds the scheduler configurations.

func (*ScheduleOption) CASClusterVersion

func (o *ScheduleOption) CASClusterVersion(old, new *semver.Version) bool

CASClusterVersion sets the cluster version.

func (*ScheduleOption) CheckLabelProperty

func (o *ScheduleOption) CheckLabelProperty(typ string, labels []*metapb.StoreLabel) bool

CheckLabelProperty checks the label property.

func (*ScheduleOption) DeleteLabelProperty

func (o *ScheduleOption) DeleteLabelProperty(typ, labelKey, labelValue string)

DeleteLabelProperty deletes the label property.

func (*ScheduleOption) GetHighSpaceRatio

func (o *ScheduleOption) GetHighSpaceRatio() float64

GetHighSpaceRatio returns the high space ratio.

func (*ScheduleOption) GetHotRegionCacheHitsThreshold

func (o *ScheduleOption) GetHotRegionCacheHitsThreshold() int

GetHotRegionCacheHitsThreshold is a threshold to decide if a region is hot.

func (*ScheduleOption) GetHotRegionScheduleLimit

func (o *ScheduleOption) GetHotRegionScheduleLimit() uint64

GetHotRegionScheduleLimit returns the limit for hot region schedule.

func (*ScheduleOption) GetKeyType

func (o *ScheduleOption) GetKeyType() core.KeyType

GetKeyType is to get key type.

func (*ScheduleOption) GetLeaderScheduleLimit

func (o *ScheduleOption) GetLeaderScheduleLimit() uint64

GetLeaderScheduleLimit returns the limit for leader schedule.

func (*ScheduleOption) GetLeaderSchedulePolicy

func (o *ScheduleOption) GetLeaderSchedulePolicy() core.SchedulePolicy

GetLeaderSchedulePolicy is to get leader schedule policy.

func (*ScheduleOption) GetLocationLabels

func (o *ScheduleOption) GetLocationLabels() []string

GetLocationLabels returns the location labels for each region.

func (*ScheduleOption) GetLogConfig

func (o *ScheduleOption) GetLogConfig() *log.Config

GetLogConfig returns log configuration.

func (*ScheduleOption) GetLowSpaceRatio

func (o *ScheduleOption) GetLowSpaceRatio() float64

GetLowSpaceRatio returns the low space ratio.

func (*ScheduleOption) GetMaxMergeRegionKeys

func (o *ScheduleOption) GetMaxMergeRegionKeys() uint64

GetMaxMergeRegionKeys returns the max number of keys.

func (*ScheduleOption) GetMaxMergeRegionSize

func (o *ScheduleOption) GetMaxMergeRegionSize() uint64

GetMaxMergeRegionSize returns the max region size.

func (*ScheduleOption) GetMaxPendingPeerCount

func (o *ScheduleOption) GetMaxPendingPeerCount() uint64

GetMaxPendingPeerCount returns the number of the max pending peers.

func (*ScheduleOption) GetMaxReplicas

func (o *ScheduleOption) GetMaxReplicas() int

GetMaxReplicas returns the number of replicas for each region.

func (*ScheduleOption) GetMaxSnapshotCount

func (o *ScheduleOption) GetMaxSnapshotCount() uint64

GetMaxSnapshotCount returns the number of the max snapshot which is allowed to send.

func (*ScheduleOption) GetMaxStoreDownTime

func (o *ScheduleOption) GetMaxStoreDownTime() time.Duration

GetMaxStoreDownTime returns the max down time of a store.

func (*ScheduleOption) GetMergeScheduleLimit

func (o *ScheduleOption) GetMergeScheduleLimit() uint64

GetMergeScheduleLimit returns the limit for merge schedule.

func (*ScheduleOption) GetPDServerConfig

func (o *ScheduleOption) GetPDServerConfig() *PDServerConfig

GetPDServerConfig returns pd server configurations.

func (*ScheduleOption) GetPatrolRegionInterval

func (o *ScheduleOption) GetPatrolRegionInterval() time.Duration

GetPatrolRegionInterval returns the interval of patroling region.

func (*ScheduleOption) GetRegionScheduleLimit

func (o *ScheduleOption) GetRegionScheduleLimit() uint64

GetRegionScheduleLimit returns the limit for region schedule.

func (*ScheduleOption) GetReplicaScheduleLimit

func (o *ScheduleOption) GetReplicaScheduleLimit() uint64

GetReplicaScheduleLimit returns the limit for replica schedule.

func (*ScheduleOption) GetReplication

func (o *ScheduleOption) GetReplication() *Replication

GetReplication returns replication configurations.

func (*ScheduleOption) GetSchedulerMaxWaitingOperator

func (o *ScheduleOption) GetSchedulerMaxWaitingOperator() uint64

GetSchedulerMaxWaitingOperator returns the number of the max waiting operators.

func (*ScheduleOption) GetSchedulers

func (o *ScheduleOption) GetSchedulers() SchedulerConfigs

GetSchedulers gets the scheduler configurations.

func (*ScheduleOption) GetSplitMergeInterval

func (o *ScheduleOption) GetSplitMergeInterval() time.Duration

GetSplitMergeInterval returns the interval between finishing split and starting to merge.

func (*ScheduleOption) GetStoreBalanceRate

func (o *ScheduleOption) GetStoreBalanceRate() float64

GetStoreBalanceRate returns the balance rate of a store.

func (*ScheduleOption) GetTolerantSizeRatio

func (o *ScheduleOption) GetTolerantSizeRatio() float64

GetTolerantSizeRatio gets the tolerant size ratio.

func (*ScheduleOption) IsCrossTableMergeEnabled

func (o *ScheduleOption) IsCrossTableMergeEnabled() bool

IsCrossTableMergeEnabled returns if across table merge is enabled.

func (*ScheduleOption) IsDebugMetricsEnabled

func (o *ScheduleOption) IsDebugMetricsEnabled() bool

IsDebugMetricsEnabled mocks method

func (*ScheduleOption) IsLocationReplacementEnabled

func (o *ScheduleOption) IsLocationReplacementEnabled() bool

IsLocationReplacementEnabled returns if location replace is enabled.

func (*ScheduleOption) IsMakeUpReplicaEnabled

func (o *ScheduleOption) IsMakeUpReplicaEnabled() bool

IsMakeUpReplicaEnabled returns if make up replica is enabled.

func (*ScheduleOption) IsOneWayMergeEnabled

func (o *ScheduleOption) IsOneWayMergeEnabled() bool

IsOneWayMergeEnabled returns if a region can only be merged into the next region of it.

func (*ScheduleOption) IsPlacementRulesEnabled

func (o *ScheduleOption) IsPlacementRulesEnabled() bool

IsPlacementRulesEnabled returns if the placement rules is enabled.

func (*ScheduleOption) IsRemoveDownReplicaEnabled

func (o *ScheduleOption) IsRemoveDownReplicaEnabled() bool

IsRemoveDownReplicaEnabled returns if remove down replica is enabled.

func (*ScheduleOption) IsRemoveExtraReplicaEnabled

func (o *ScheduleOption) IsRemoveExtraReplicaEnabled() bool

IsRemoveExtraReplicaEnabled returns if remove extra replica is enabled.

func (*ScheduleOption) IsReplaceOfflineReplicaEnabled

func (o *ScheduleOption) IsReplaceOfflineReplicaEnabled() bool

IsReplaceOfflineReplicaEnabled returns if replace offline replica is enabled.

func (*ScheduleOption) Load

func (o *ScheduleOption) Load() *ScheduleConfig

Load returns scheduling configurations.

func (*ScheduleOption) LoadClusterVersion

func (o *ScheduleOption) LoadClusterVersion() *semver.Version

LoadClusterVersion returns the cluster version.

func (*ScheduleOption) LoadLabelPropertyConfig

func (o *ScheduleOption) LoadLabelPropertyConfig() LabelPropertyConfig

LoadLabelPropertyConfig returns the label property.

func (*ScheduleOption) LoadLogConfig

func (o *ScheduleOption) LoadLogConfig() *log.Config

LoadLogConfig returns log configuration.

func (*ScheduleOption) LoadPDServerConfig

func (o *ScheduleOption) LoadPDServerConfig() *PDServerConfig

LoadPDServerConfig returns PD server configuration.

func (*ScheduleOption) Persist

func (o *ScheduleOption) Persist(storage *core.Storage) error

Persist saves the configuration to the storage.

func (*ScheduleOption) Reload

func (o *ScheduleOption) Reload(storage *core.Storage) error

Reload reloads the configuration from the storage.

func (*ScheduleOption) RemoveSchedulerCfg

func (o *ScheduleOption) RemoveSchedulerCfg(ctx context.Context, name string) error

RemoveSchedulerCfg removes the scheduler configurations.

func (*ScheduleOption) SetClusterVersion

func (o *ScheduleOption) SetClusterVersion(v *semver.Version)

SetClusterVersion sets the cluster version.

func (*ScheduleOption) SetLabelProperty

func (o *ScheduleOption) SetLabelProperty(typ, labelKey, labelValue string)

SetLabelProperty sets the label property.

func (*ScheduleOption) SetLabelPropertyConfig

func (o *ScheduleOption) SetLabelPropertyConfig(cfg LabelPropertyConfig)

SetLabelPropertyConfig sets the label property configuration.

func (*ScheduleOption) SetLogConfig

func (o *ScheduleOption) SetLogConfig(cfg *log.Config)

SetLogConfig sets the log configuration.

func (*ScheduleOption) SetMaxReplicas

func (o *ScheduleOption) SetMaxReplicas(replicas int)

SetMaxReplicas sets the number of replicas for each region.

func (*ScheduleOption) SetPDServerConfig

func (o *ScheduleOption) SetPDServerConfig(cfg *PDServerConfig)

SetPDServerConfig sets the PD configuration.

func (*ScheduleOption) SetSplitMergeInterval

func (o *ScheduleOption) SetSplitMergeInterval(splitMergeInterval time.Duration)

SetSplitMergeInterval to set the interval between finishing split and starting to merge. It's only used to test.

func (*ScheduleOption) Store

func (o *ScheduleOption) Store(cfg *ScheduleConfig)

Store sets scheduling configurations.

type SchedulerConfig

type SchedulerConfig struct {
	Type        string   `toml:"type" json:"type"`
	Args        []string `toml:"args" json:"args"`
	Disable     bool     `toml:"disable" json:"disable"`
	ArgsPayload string   `toml:"args-payload" json:"args-payload"`
}

SchedulerConfig is customized scheduler configuration

type SchedulerConfigs

type SchedulerConfigs []SchedulerConfig

SchedulerConfigs is a slice of customized scheduler configuration.

type StoreLabel

type StoreLabel struct {
	Key   string `toml:"key" json:"key"`
	Value string `toml:"value" json:"value"`
}

StoreLabel is the config item of LabelPropertyConfig.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL