Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Break down flow.ControlBehavior to flow.TokenCalculateStrategy and flow.ControlBehavior #223

Merged
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
inprove naming
louyuting committed Sep 8, 2020
commit 397dc4397aa0837fa8197edacbff90fdc28102f8
8 changes: 4 additions & 4 deletions core/flow/rule.go
Original file line number Diff line number Diff line change
@@ -30,16 +30,16 @@ func (s MetricType) String() string {
type RelationStrategy int32

const (
// DirectResource means flow control by current resource directly.
DirectResource RelationStrategy = iota
// CurrentResource means flow control by current resource directly.
CurrentResource RelationStrategy = iota
// AssociatedResource means flow control by the associated resource rather than current resource.
AssociatedResource
)

func (s RelationStrategy) String() string {
switch s {
case DirectResource:
return "DirectResource"
case CurrentResource:
return "CurrentResource"
case AssociatedResource:
return "AssociatedResource"
default:
4 changes: 2 additions & 2 deletions ext/datasource/helper_test.go
Original file line number Diff line number Diff line change
@@ -50,7 +50,7 @@ func TestFlowRulesJsonConverter(t *testing.T) {
Resource: "abc",
MetricType: flow.Concurrency,
Count: 100,
RelationStrategy: flow.DirectResource,
RelationStrategy: flow.CurrentResource,
ControlStrategy: flow.ControlStrategy{
TokenCalculateStrategy: flow.Direct,
ControlBehavior: flow.Reject,
@@ -80,7 +80,7 @@ func TestFlowRulesJsonConverter(t *testing.T) {
Resource: "abc",
MetricType: flow.QPS,
Count: 300,
RelationStrategy: flow.DirectResource,
RelationStrategy: flow.CurrentResource,
ControlStrategy: flow.ControlStrategy{
TokenCalculateStrategy: flow.Direct,
ControlBehavior: flow.Throttling,