Documentation ¶
Index ¶
Constants ¶
const ( // StatusStoreScoreDisallowed represents the plan is no need to be scheduled due to the score does meet the requirement. StatusStoreScoreDisallowed = iota + 100 // StatusStoreAlreadyHasPeer represents the store is excluded due to the existed region peer. StatusStoreAlreadyHasPeer // StatusStoreNotMatchRule represents the placement rule cannot satisfy the requirement. StatusStoreNotMatchRule )
normal status in most of situations.
const ( // StatusStoreSnapshotThrottled represents the store cannot be selected due to the snapshot limitation. StatusStoreSnapshotThrottled = iota + 200 // StatusStorePendingPeerThrottled represents the store cannot be selected due to the pending peer limitation. StatusStorePendingPeerThrottled // StatusStoreAddLimitThrottled represents the store cannot be selected due to the add peer limitation. StatusStoreAddLimitThrottled // StatusStoreRemoveLimitThrottled represents the store cannot be selected due to the remove peer limitation. StatusStoreRemoveLimitThrottled )
soft limitation
const ( // StatusStoreRejectLeader represents the store is restricted by the special configuration. e.g. reject label setting, evict leader/slow store scheduler. StatusStoreRejectLeader = iota + 300 // StatusNotMatchIsolation represents the isolation cannot satisfy the requirement. StatusStoreNotMatchIsolation )
config limitation
const ( // StatusStoreBusy represents the store cannot be selected due to it is busy. StatusStoreBusy = iota + 400 // StatusStoreRemoved represents the store cannot be selected due to it has been removed. StatusStoreRemoved // StatusStoreRemoving represents the data on the store is moving out. StatusStoreRemoving // StatusStoreDown represents the the store is in down state. StatusStoreDown // StatusStoreDisconnected represents the the store is in disconnected state. StatusStoreDisconnected )
hard limitation
const ( // StatusStoreLowSpace represents the store cannot be selected because it runs out of space. StatusStoreLowSpace = iota + 500 // StatusStoreNotExisted represents the store cannot be found in PD. StatusStoreNotExisted )
const ( // StatusRegionHot represents the region cannot be selected due to the heavy load. StatusRegionHot = iota + 1000 // StatusRegionUnhealthy represents the region cannot be selected due to the region health. StatusRegionUnhealthy // StatusRegionEmpty represents the region cannot be selected due to the region is empty. StatusRegionEmpty // StatusRegionNotReplicated represents the region does not have enough replicas. StatusRegionNotReplicated // StatusRegionNotMatchRule represents the region does not match rule constraint. StatusRegionNotMatchRule // StatusRegionNoLeader represents the region has no leader. StatusRegionNoLeader // StatusNoTargetRegion represents nts the target region of merge operation cannot be found. StatusNoTargetRegion // StatusRegionLabelReject represents the plan conflicts with region label. StatusRegionLabelReject // StatusRegionSendSnapshotThrottled represents the plan conflicts with send snapshot. StatusRegionSendSnapshotThrottled )
TODO: define region status priority
const ( // StatusCreateOperatorFailed represents the plan can not create operators. StatusCreateOperatorFailed = iota + 2000 )
Variables ¶
This section is empty.
Functions ¶
func StatusText ¶
func StatusText(code StatusCode) string
StatusText turns the status code into string.
Types ¶
type Collector ¶
type Collector struct {
// contains filtered or unexported fields
}
Collector is a plan collector
type Option ¶
type Option func(plan Plan)
Option is to do some action for plan
func SetResource ¶
func SetResource(resource interface{}) Option
SetResource is used to generate Resource for plan
func SetResourceWithStep ¶
SetResourceWithStep is used to generate Resource for plan
type Plan ¶
type Plan interface { GetStep() int GetStatus() *Status GetResource(int) uint64 Clone(ops ...Option) Plan // generate plan for clone option SetResource(interface{}) // SetResourceWithStep is used to set resource for specific step. // The meaning of step is different for different plans. // Such as balancePlan, pickSource = 0, pickRegion = 1, pickTarget = 2 SetResourceWithStep(resource interface{}, step int) SetStatus(*Status) }
Plan is the basic unit for both scheduling and diagnosis. TODO: for each scheduler/checker, we can have an individual definition but need to implement the common interfaces.
type Status ¶
type Status struct { StatusCode StatusCode // TODO: Try to indicate the user to do some actions through this field. DetailedReason string }
Status describes a plan's result.
func NewStatus ¶
func NewStatus(statusCode StatusCode, reason ...string) *Status
NewStatus create a new plan status.
type StatusCode ¶
type StatusCode int
StatusCode is used to classify the plan result. And the sequence of status code represents the priority, the status code number is higher, the priority is higher.
const ( // StatusOK represents the plan can be scheduled successfully. StatusOK StatusCode = iota )