ratelimit

package
v1.3.8 Latest Latest
Warning

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

Go to latest
Published: May 1, 2024 License: BSD-3-Clause Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Bandwidth

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

Bandwidth lossy bandwidth limiter

func NewBandwidth

func NewBandwidth(totalBytes int64) *Bandwidth

NewBandwidth create new bandwidth limiter

func (*Bandwidth) Ack

func (this *Bandwidth) Ack(ctx context.Context, newBytes int)

Ack acquire next chance to send data

type Counter

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

func NewCounter

func NewCounter(count int) *Counter

func (*Counter) Ack

func (this *Counter) Ack() bool

func (*Counter) Close

func (this *Counter) Close()

func (*Counter) Count

func (this *Counter) Count() int

func (*Counter) Len

func (this *Counter) Len() int

Len 已占用数量

func (*Counter) Release

func (this *Counter) Release()

Jump to

Keyboard shortcuts

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