bandwidthlimiter

package
v0.0.0-...-bef5c4b Latest Latest
Warning

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

Go to latest
Published: Oct 30, 2026 License: Apache-2.0 Imports: 8 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrBufferSizeTooLarge = errors.New("buffer size cannot be greater than bucket size")

Functions

func BandwidthLimitingCopy

func BandwidthLimitingCopy(dst *BandwidthLimitingWriter, src io.Reader) (written int64, err error)

Types

type BandwidthLimitingWriter

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

func NewBandwidthLimitingWriter

func NewBandwidthLimitingWriter(w io.Writer, bucket *Bucket) (*BandwidthLimitingWriter, error)

func (*BandwidthLimitingWriter) ChunkedWrite

func (w *BandwidthLimitingWriter) ChunkedWrite(p []byte) (n int, err error)

func (*BandwidthLimitingWriter) Close

func (w *BandwidthLimitingWriter) Close() (err error)

func (*BandwidthLimitingWriter) GetMetrics

func (w *BandwidthLimitingWriter) GetMetrics() (metrics *interop.InvokeResponseMetrics)

func (*BandwidthLimitingWriter) Write

func (w *BandwidthLimitingWriter) Write(p []byte) (n int, err error)

type Bucket

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

func NewBucket

func NewBucket(capacity int64, initialTokenCount int64, refillNumber int64, refillInterval time.Duration) (*Bucket, error)

type ChunkIterator

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

func NewChunkIterator

func NewChunkIterator(buf []byte, chunkSize int) *ChunkIterator

func (*ChunkIterator) Next

func (i *ChunkIterator) Next() []byte

type Throttler

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

func NewThrottler

func NewThrottler(bucket *Bucket) (*Throttler, error)

Jump to

Keyboard shortcuts

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