storelimit

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: 2 Imported by: 0

Documentation

Index

Constants

View Source
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

View Source
var RegionInfluence = map[Type]int64{
	RegionAdd:    1000,
	RegionRemove: 1000,
}

RegionInfluence represents the influence of a operator step, which is used by store limit.

View Source
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.

View Source
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

const (
	Auto Mode = iota
	Manual
)

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.

func (Mode) String

func (m Mode) String() string

String returns the representation of the store limit mode

type Scene

type Scene struct {
	Idle   int
	Low    int
	Normal int
	High   int
}

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

func DefaultScene(limitType Type) *Scene

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) Mode

func (l *StoreLimit) Mode() Mode

Mode returns the store limit mode

func (*StoreLimit) Rate

func (l *StoreLimit) Rate() float64

Rate returns the fill rate of the bucket, in tokens per second.

func (*StoreLimit) Take

func (l *StoreLimit) Take(count int64) time.Duration

Take takes count tokens from the bucket without blocking.

type Type

type Type int

Type indicates the type of store limit

const (
	// RegionAdd indicates the type of store limit that limits the adding region rate
	RegionAdd Type = iota
	// RegionRemove indicates the type of store limit that limits the removing region rate
	RegionRemove
)

func (Type) String

func (t Type) String() string

String returns the representation of the Type

Jump to

Keyboard shortcuts

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