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
- func SetBusinessTimeoutThreshold(t time.Duration)
- type Container
- 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 ¶ added in v0.6.0
func CopyDefaultRPCTimeout() iface.ConfigValueItem
CopyDefaultRPCTimeout returns a copy of defaultRPCTimeout, thus avoiding default values changed by business
func DisableGlobalNeedFineGrainedErrCode ¶ added in v0.5.2
func DisableGlobalNeedFineGrainedErrCode()
DisableGlobalNeedFineGrainedErrCode can be used to revert the flag, which is useful in tests.
func EnableGlobalNeedFineGrainedErrCode ¶ added in v0.5.2
func EnableGlobalNeedFineGrainedErrCode()
EnableGlobalNeedFineGrainedErrCode can be used to set global flag, which applies to all clients.
func LoadBusinessTimeoutThreshold ¶ added in v0.5.2
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 ¶ added in v0.5.2
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.
func SetBusinessTimeoutThreshold ¶ added in v0.7.1
SetBusinessTimeoutThreshold sets the threshold for business timeout.
Types ¶
type Container ¶ added in v0.7.0
type Container struct {
// contains filtered or unexported fields
}
Container is the implementation of rpcinfo.TimeoutProvider. Provide the ability to dynamically configure the rpctimeout config on the method hierarchy.
func NewContainer ¶ added in v0.7.0
func NewContainer() *Container
NewContainer build Container for timeout provider.
func (*Container) NotifyPolicyChange ¶ added in v0.7.0
func (c *Container) NotifyPolicyChange(configs map[string]*RPCTimeout)
NotifyPolicyChange to receive policy when it changes
type RPCTimeout ¶ added in v0.6.0
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 ¶ added in v0.6.0
func (r *RPCTimeout) ConnectTimeout() time.Duration
ConnectTimeout implements rpcinfo.Timeouts
func (*RPCTimeout) DeepCopy ¶ added in v0.6.0
func (r *RPCTimeout) DeepCopy() iface.ConfigValueItem
DeepCopy returns a copy of the current RPCTimeout
func (*RPCTimeout) EqualsTo ¶ added in v0.6.0
func (r *RPCTimeout) EqualsTo(other iface.ConfigValueItem) bool
EqualsTo returns true if the current RPCTimeout equals to the other RPCTimeout
func (*RPCTimeout) RPCTimeout ¶ added in v0.6.0
func (r *RPCTimeout) RPCTimeout() time.Duration
RPCTimeout implements rpcinfo.Timeouts
func (*RPCTimeout) ReadWriteTimeout ¶ added in v0.6.0
func (r *RPCTimeout) ReadWriteTimeout() time.Duration
ReadWriteTimeout implements rpcinfo.Timeouts