Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( ErrExceeded = &Error{xerrors.New("bandwidth exceeded"), false, true} ErrDeadline = &Error{xerrors.New("deadline reached"), true, false} )
Errors
Functions ¶
This section is empty.
Types ¶
type Error ¶
type Error struct {
// contains filtered or unexported fields
}
An Error represents a readwrite error.
type Reader ¶
type Reader struct {
// contains filtered or unexported fields
}
Reader is a wrapper for io.Reader with throttling implemented
func NewReader ¶
NewReader makes the Reader instance r in an underlaing io.Reader limiter is a limiter instance to be used to contron Reader bandwidth fragile flags controls will the reader return an error on bandwidth exceeded, or will it retry until deadline.
func (*Reader) SetDeadline ¶
SetDeadline sets a deadline for the next Read.
type Writer ¶
type Writer struct {
// contains filtered or unexported fields
}
Writer is a wrapper for io.Writer with throttling implemented
func NewWriter ¶
NewWriter makes the Writer instance w in an underlaing io.Writer limiter is a limiter instance to be used to contron Writer bandwidth fragile flags controlss will the writer return an error on bandwidth exceeded, or will it retry until deadline.
func (*Writer) SetDeadline ¶
SetDeadline sets a deadline for the next Write.