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 // Unlimited is used to control the store limit. Here uses a big enough number to represent unlimited. Unlimited = float64(100000000) )
Variables ¶
var RegionInfluence = map[Type]int64{
AddPeer: 1000,
RemovePeer: 1000,
}
RegionInfluence represents the influence of a operator step, which is used by store limit.
var SmallRegionInfluence = map[Type]int64{
AddPeer: 200,
RemovePeer: 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{ "add-peer": AddPeer, "remove-peer": RemovePeer, }
TypeNameValue indicates the name of store limit type and the enum value
Functions ¶
This section is empty.
Types ¶
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(ratePerSec float64, 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.