rpctimeout

package
v0.6.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 31, 2023 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Overview

Package rpctimeout implements logic for timeout controlling.

Index

Constants

View Source
const TimeoutAdjustKey timeoutAdjustKeyType = 1

TimeoutAdjustKey is used to adjust the timeout of RPC timeout middleware. Deprecated: this value is kept for historical reason and compatibility. It should not be used anymore.

View Source
const TypeRPCTimeout iface.ItemType = "rpc_timeout"

TypeRPCTimeout is used as itemKey in ConfigValueImpl

Variables

View Source
var NewRPCTimeout = util.JsonInitializer(func() iface.ConfigValueItem {
	return &RPCTimeout{}
})

NewRPCTimeout is a function decoding json bytes to a RPCTimeout object

Functions

func CopyDefaultRPCTimeout

func CopyDefaultRPCTimeout() iface.ConfigValueItem

CopyDefaultRPCTimeout returns a copy of defaultRPCTimeout, thus avoiding default values changed by business

func DisableGlobalNeedFineGrainedErrCode

func DisableGlobalNeedFineGrainedErrCode()

DisableGlobalNeedFineGrainedErrCode can be used to revert the flag, which is useful in tests.

func EnableGlobalNeedFineGrainedErrCode

func EnableGlobalNeedFineGrainedErrCode()

EnableGlobalNeedFineGrainedErrCode can be used to set global flag, which applies to all clients.

func LoadBusinessTimeoutThreshold

func LoadBusinessTimeoutThreshold() time.Duration

LoadBusinessTimeoutThreshold is used the load the threshold, and keeps compatibility if in the future there's need for business code to modify the value.

func LoadGlobalNeedFineGrainedErrCode

func LoadGlobalNeedFineGrainedErrCode() bool

LoadGlobalNeedFineGrainedErrCode is used to load the flag, and return a bool value.

func MiddlewareBuilder

func MiddlewareBuilder(moreTimeout time.Duration) endpoint.MiddlewareBuilder

MiddlewareBuilder builds timeout middleware. Deprecated: this method is kept for historical reason and compatibility. It should not be used anymore.

Types

type RPCTimeout

type RPCTimeout struct {
	RPCTimeoutMS  int `json:"rpc_timeout_ms"`
	ConnTimeoutMS int `json:"conn_timeout_ms"`
}

RPCTimeout is used as itemValue in ConfigValueImpl

func (*RPCTimeout) ConnectTimeout

func (r *RPCTimeout) ConnectTimeout() time.Duration

ConnectTimeout implements rpcinfo.Timeouts

func (*RPCTimeout) DeepCopy

func (r *RPCTimeout) DeepCopy() iface.ConfigValueItem

DeepCopy returns a copy of the current RPCTimeout

func (*RPCTimeout) EqualsTo

func (r *RPCTimeout) EqualsTo(other iface.ConfigValueItem) bool

EqualsTo returns true if the current RPCTimeout equals to the other RPCTimeout

func (*RPCTimeout) RPCTimeout

func (r *RPCTimeout) RPCTimeout() time.Duration

RPCTimeout implements rpcinfo.Timeouts

func (*RPCTimeout) ReadWriteTimeout

func (r *RPCTimeout) ReadWriteTimeout() time.Duration

ReadWriteTimeout implements rpcinfo.Timeouts

Jump to

Keyboard shortcuts

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