Skip to content
Snippets Groups Projects
Commit a723f53d authored by pengganyu's avatar pengganyu
Browse files

Add feature: rename func name : GetParamInt0 -> GetParamIntValue

parent b3cf2d51
Branches
Tags
No related merge requests found
...@@ -56,7 +56,7 @@ func (invoker *forkingClusterInvoker) Invoke(ctx context.Context, invocation pro ...@@ -56,7 +56,7 @@ func (invoker *forkingClusterInvoker) Invoke(ctx context.Context, invocation pro
} }
var selected []protocol.Invoker var selected []protocol.Invoker
forks := invoker.GetUrl().GetParamByInt0(constant.FORKS_KEY, constant.DEFAULT_FORKS) forks := invoker.GetUrl().GetParamByIntValue(constant.FORKS_KEY, constant.DEFAULT_FORKS)
timeouts := invoker.GetUrl().GetParamInt(constant.TIMEOUT_KEY, constant.DEFAULT_TIMEOUT) timeouts := invoker.GetUrl().GetParamInt(constant.TIMEOUT_KEY, constant.DEFAULT_TIMEOUT)
if forks < 0 || forks > len(invokers) { if forks < 0 || forks > len(invokers) {
selected = invokers selected = invokers
......
...@@ -105,7 +105,7 @@ func newConsistentHashSelector(invokers []protocol.Invoker, methodName string, ...@@ -105,7 +105,7 @@ func newConsistentHashSelector(invokers []protocol.Invoker, methodName string,
selector.virtualInvokers = make(map[uint32]protocol.Invoker) selector.virtualInvokers = make(map[uint32]protocol.Invoker)
selector.hashCode = hashCode selector.hashCode = hashCode
url := invokers[0].GetUrl() url := invokers[0].GetUrl()
selector.replicaNum = url.GetMethodParamInt0(methodName, HashNodes, 160) selector.replicaNum = url.GetMethodParamIntValue(methodName, HashNodes, 160)
indices := re.Split(url.GetMethodParam(methodName, HashArguments, "0"), -1) indices := re.Split(url.GetMethodParam(methodName, HashArguments, "0"), -1)
for _, index := range indices { for _, index := range indices {
i, err := strconv.Atoi(index) i, err := strconv.Atoi(index)
......
...@@ -502,8 +502,8 @@ func (c URL) GetParamInt32(key string, d int32) int32 { ...@@ -502,8 +502,8 @@ func (c URL) GetParamInt32(key string, d int32) int32 {
return int32(r) return int32(r)
} }
// GetParamByInt0 gets int value by @key // GetParamByIntValue gets int value by @key
func (c URL) GetParamByInt0(key string, d int) int { func (c URL) GetParamByIntValue(key string, d int) int {
r, err := strconv.ParseInt(c.GetParam(key, ""), 10, 0) r, err := strconv.ParseInt(c.GetParam(key, ""), 10, 0)
if r == 0 || err != nil { if r == 0 || err != nil {
return d return d
...@@ -520,8 +520,8 @@ func (c URL) GetMethodParamInt(method string, key string, d int64) int64 { ...@@ -520,8 +520,8 @@ func (c URL) GetMethodParamInt(method string, key string, d int64) int64 {
return r return r
} }
// GetMethodParamInt0 gets int method param // GetMethodParamIntValue gets int method param
func (c URL) GetMethodParamInt0(method string, key string, d int) int { func (c URL) GetMethodParamIntValue(method string, key string, d int) int {
r, err := strconv.ParseInt(c.GetParam("methods."+method+"."+key, ""), 10, 0) r, err := strconv.ParseInt(c.GetParam("methods."+method+"."+key, ""), 10, 0)
if r == 0 || err != nil { if r == 0 || err != nil {
return d return d
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment