kratos: Index | Files

package bbr

import ""


Package Files


type BBR Uses

type BBR struct {
    // contains filtered or unexported fields

BBR implements bbr-like limiter. It is inspired by sentinel.

func (*BBR) Allow Uses

func (l *BBR) Allow(ctx context.Context, opts ...limit.AllowOption) (func(info limit.DoneInfo), error)

Allow checks all inbound traffic. Once overload is detected, it raises ecode.LimitExceed error.

func (*BBR) Stat Uses

func (l *BBR) Stat() Stat

Stat tasks a snapshot of the bbr limiter.

type Config Uses

type Config struct {
    Enabled      bool
    Window       time.Duration
    WinBucket    int
    Rule         string
    Debug        bool
    CPUThreshold int64

Config contains configs of bbr limiter.

type Group Uses

type Group struct {
    // contains filtered or unexported fields

Group represents a class of BBRLimiter and forms a namespace in which units of BBRLimiter.

func NewGroup Uses

func NewGroup(conf *Config) *Group

NewGroup new a limiter group container, if conf nil use default conf.

func (*Group) Get Uses

func (g *Group) Get(key string) limit.Limiter

Get get a limiter by a specified key, if limiter not exists then make a new one.

type Stat Uses

type Stat struct {
    Cpu         int64
    InFlight    int64
    MaxInFlight int64
    MinRt       int64
    MaxPass     int64

Stats contains the metrics's snapshot of bbr.

Package bbr imports 10 packages (graph) and is imported by 4 packages. Updated 2020-03-29. Refresh now. Tools for package owners.