Documentation
¶
Overview ¶
Package rpctimeout implements logic for timeout controlling.
Index ¶
- Constants
- Variables
- func CopyDefaultRPCTimeout() iface.ConfigValueItem
- func DisableGlobalNeedFineGrainedErrCode()
- func EnableGlobalNeedFineGrainedErrCode()
- func LoadBusinessTimeoutThreshold() time.Duration
- func LoadGlobalNeedFineGrainedErrCode() bool
- func MiddlewareBuilder(moreTimeout time.Duration) endpoint.MiddlewareBuilder
- type RPCTimeout
Constants ¶
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.
const TypeRPCTimeout iface.ItemType = "rpc_timeout"
TypeRPCTimeout is used as itemKey in ConfigValueImpl
Variables ¶
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 ¶
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