Documentation ¶
Index ¶
Constants ¶
const ( // SmallRegionThreshold is used to represent a region which can be regarded as a small region once the size is small than it. SmallRegionThreshold int64 = 20 )
Variables ¶
var RegionInfluence = map[Type]int64{
RegionAdd: 1000,
RegionRemove: 1000,
}
RegionInfluence represents the influence of a operator step, which is used by store limit.
var SmallRegionInfluence = map[Type]int64{
RegionAdd: 200,
RegionRemove: 200,
}
SmallRegionInfluence represents the influence of a operator step when the region size is smaller than smallRegionThreshold, which is used by store limit.
var TypeNameValue = map[string]Type{ "region-add": RegionAdd, "region-remove": RegionRemove, }
TypeNameValue indicates the name of store limit type and the enum value
Functions ¶
This section is empty.
Types ¶
type Mode ¶
type Mode int
Mode indicates the strategy to set store limit
There are two modes supported now, "auto" indicates the value is set by PD itself. "manual" means it is set by the user. An auto set value can be overwrite by a manual set value.
type Scene ¶
Scene defines the store limitation on difference scenes Idle/Low/Normal/High indicates the load of the cluster, it is defined in cluster.State. See the details there for how to calculate the load. The values here defines the store-limit for each load. For example: Idle = 60, means that change the store-limit to 60 when the cluster is idle.
func DefaultScene ¶
DefaultScene returns Scene object with default values
type StoreLimit ¶
type StoreLimit struct {
// contains filtered or unexported fields
}
StoreLimit limits the operators of a store
func NewStoreLimit ¶
func NewStoreLimit(rate float64, mode Mode, regionInfluence int64) *StoreLimit
NewStoreLimit returns a StoreLimit object
func (*StoreLimit) Available ¶
func (l *StoreLimit) Available() int64
Available returns the number of available tokens
func (*StoreLimit) Rate ¶
func (l *StoreLimit) Rate() float64
Rate returns the fill rate of the bucket, in tokens per second.