Documentation ¶
Overview ¶
Package bwio provides wrappers for io.Reader, io.Writer, io.Copy and io.CopyBuffer that limit the throughput to a given bandwidth. The limiter uses an internal time bucket and hibernates each io operation for short time periods, whenever the configured bandwidth has been exceeded.
`bandwidth` is defined as bytes per second.
The limiter tries to detect longer stalls and resets the bucket such that stalls do not cause subsequent high bursts. Usually you should choose small buffer sizes for low bandwidths and vice versa. The limiter tries to compensate for high buffer size / bandwidth ratio when detecting stalls, but this is not well tested.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Reader ¶
type Reader struct {
// contains filtered or unexported fields
}
Reader wraps another reader and maintains a given bandwidth.