codel

package
v1.1.9 Latest Latest
Warning

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

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

Documentation

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

func SetInternal

func SetInternal(internal int64) options.Option

SetInternal 设置滑动窗口最小时间宽度

func SetTarget

func SetTarget(target int64) options.Option

SetTarget 设置对列延时

Types

type Queue

type Queue struct {
	// contains filtered or unexported fields
}

Queue CoDel buffer 缓冲队列

func Default

func Default() *Queue

Default 默认配置CoDel Queue

func NewQueue added in v1.1.5

func NewQueue(options ...options.Option) *Queue

NewQueue 实例化 CoDel Queue

func (*Queue) Pop

func (q *Queue) Pop()

Pop 弹出 CoDel Queue 的请求

Example
// 出队,没有请求则会阻塞
queue.Pop()
Output:

func (*Queue) Push

func (q *Queue) Push(ctx context.Context) (err error)

Push 请求进入CoDel Queue 如果返回错误为nil,则在完成请求处理后,调用方必须调用q.Done()

Example
// 入队
if err := queue.Push(context.TODO()); err != nil {
	if err == bbr.LimitExceed {
		// todo 处理过载保护错误
	} else {
		// todo 处理其他错误
	}
}
Output:

func (*Queue) Reload

func (q *Queue) Reload(c *config)

Reload 重新加载配置

func (*Queue) Stat

func (q *Queue) Stat() Stat

Stat 返回CoDel状态信息

Example
// start 体现 CoDel 状态信息
start := queue.Stat()

_ = start
Output:

type Stat

type Stat struct {
	Dropping bool
	Packets  int64
	FaTime   int64
	DropNext int64
}

Stat CoDel 状态信息

Jump to

Keyboard shortcuts

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