rpctimeout

package
v0.9.1 Latest Latest
Warning

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

Go to latest
Published: Mar 18, 2024 License: Apache-2.0 Imports: 7 Imported by: 8

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 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

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 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

func SetBusinessTimeoutThreshold(t time.Duration)

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

func (*Container) Timeouts added in v0.7.0

func (c *Container) Timeouts(ri rpcinfo.RPCInfo) rpcinfo.Timeouts

Timeouts return the rpc timeout config by the method name of rpc info.

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

Jump to

Keyboard shortcuts

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