Documentation ¶
Overview ¶
Package isolation provides implementation of concurrency limiting (semaphore isolation).
Index ¶
Constants ¶
const (
RuleCheckSlotOrder = 3000
)
Variables ¶
var (
DefaultSlot = &Slot{}
)
Functions ¶
func ClearRulesOfResource ¶
ClearRulesOfResource clears resource level rules in isolation module.
func IsValidRule ¶
IsValidRule checks whether the given Rule is valid.
func LoadRules ¶
LoadRules loads the given isolation rules to the rule manager, while all previous rules will be replaced. the first returned value indicates whether do real load operation, if the rules is the same with previous rules, return false
func LoadRulesOfResource ¶
LoadRulesOfResource loads the given resource's isolation rules to the rule manager, while all previous resource's rules will be replaced. the first returned value indicates whether do real load operation, if the rules is the same with previous resource's rules, return false
Types ¶
type MetricType ¶
type MetricType int32
MetricType represents the target metric type.
const ( // Concurrency represents concurrency (in-flight requests). Concurrency MetricType = iota )
func (MetricType) String ¶
func (s MetricType) String() string
type Rule ¶
type Rule struct { // ID represents the unique ID of the rule (optional). ID string `json:"id,omitempty"` // Resource represents the target resource definition. Resource string `json:"resource"` // MetricType indicates the metric type for checking logic. // Currently Concurrency is supported for concurrency limiting. MetricType MetricType `json:"metricType"` Threshold uint32 `json:"threshold"` }
Rule describes the isolation policy (e.g. semaphore isolation).
func GetRules ¶
func GetRules() []Rule
GetRules returns all the rules based on copy. It doesn't take effect for isolation module if user changes the rule.
func GetRulesOfResource ¶
GetRulesOfResource returns specific resource's rules based on copy. It doesn't take effect for isolation module if user changes the rule.