Documentation
¶
Overview ¶
Package overloader is a plugin to protect yrpc from overload.
Index ¶
- type HandlerLimit
- type LimitConfig
- type Overloader
- func (o *Overloader) LimitConfig() LimitConfig
- func (o *Overloader) Name() string
- func (o *Overloader) PostAccept(_ yrpc.PreSession) *yrpc.Status
- func (o *Overloader) PostDial(sess yrpc.PreSession, isRedial bool) *yrpc.Status
- func (o *Overloader) PostDisconnect(_ yrpc.BaseSession) *yrpc.Status
- func (o *Overloader) PostReadCallHeader(ctx yrpc.ReadCtx) *yrpc.Status
- func (o *Overloader) PostReadPushHeader(ctx yrpc.ReadCtx) *yrpc.Status
- func (o *Overloader) Update(newLimitConfig LimitConfig)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type HandlerLimit ¶
HandlerLimit handler QPS overload limitation condition
type LimitConfig ¶
type LimitConfig struct {
MaxConn int32
QPSInterval time.Duration
MaxTotalQPS int32
MaxHandlerQPS []HandlerLimit
}
LimitConfig overload limitation condition
type Overloader ¶
type Overloader struct {
// contains filtered or unexported fields
}
Overloader plug-in to protect yrpc from overload
func New ¶
func New(initLimitConfig LimitConfig) *Overloader
New creates a plug-in to protect yrpc from overload.
func (*Overloader) LimitConfig ¶
func (o *Overloader) LimitConfig() LimitConfig
LimitConfig returns the overload limitation condition.
func (*Overloader) PostAccept ¶
func (o *Overloader) PostAccept(_ yrpc.PreSession) *yrpc.Status
PostAccept checks connection overload. If overload, print error log and close the connection.
func (*Overloader) PostDial ¶
func (o *Overloader) PostDial(sess yrpc.PreSession, isRedial bool) *yrpc.Status
PostDial checks connection overload. If overload, print error log and close the connection.
func (*Overloader) PostDisconnect ¶
func (o *Overloader) PostDisconnect(_ yrpc.BaseSession) *yrpc.Status
PostDisconnect releases connection count.
func (*Overloader) PostReadCallHeader ¶
func (o *Overloader) PostReadCallHeader(ctx yrpc.ReadCtx) *yrpc.Status
PostReadCallHeader checks PULL QPS overload. If overload, print error log and reply error.
func (*Overloader) PostReadPushHeader ¶
func (o *Overloader) PostReadPushHeader(ctx yrpc.ReadCtx) *yrpc.Status
PostReadPushHeader checks PUSH QPS overload. If overload, print warning log.
func (*Overloader) Update ¶
func (o *Overloader) Update(newLimitConfig LimitConfig)
Update updates the overload limitation condition.