Documentation ¶
Overview ¶
Package ratelimit exposes rate limited io implementations.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type RateLimitedReadAtSeeker ¶
type RateLimitedReadAtSeeker struct {
// contains filtered or unexported fields
}
RateLimitedReadAtSeeker will use its limiter as a rate limit on the number of bytes read.
func NewRateLimitedReadAtSeeker ¶
func NewRateLimitedReadAtSeeker(ctx context.Context, r ioiface.ReadAtSeeker, limiter *rate.Limiter, ) *RateLimitedReadAtSeeker
NewRateLimitedReadAtSeeker creates a new RateLimitedReadAtSeeker which respects "limiter" in terms of the number of bytes read.
func (*RateLimitedReadAtSeeker) Read ¶
func (r *RateLimitedReadAtSeeker) Read(p []byte) (int, error)
Read will read into p whilst respecting the rate limit.
type RateLimitedReadCloser ¶
type RateLimitedReadCloser struct {
// contains filtered or unexported fields
}
RateLimitedReadCloser will use its limiter as a rate limit on the number of bytes read.
func NewRateLimitedReadCloser ¶
func NewRateLimitedReadCloser(ctx context.Context, r io.ReadCloser, limiter *rate.Limiter) *RateLimitedReadCloser
NewRateLimitedReadCloser creates a new RateLimitedReadCloser which respects "limiter" in terms of the number of bytes read.
func (*RateLimitedReadCloser) Close ¶
func (r *RateLimitedReadCloser) Close() error
Close will close the reader
type RateLimitedReadSeeker ¶
type RateLimitedReadSeeker struct {
// contains filtered or unexported fields
}
RateLimitedReadSeeker will use its limiter as a rate limit on the number of bytes read.
func NewRateLimitedReadSeeker ¶
func NewRateLimitedReadSeeker(ctx context.Context, r io.ReadSeeker, limiter *rate.Limiter) *RateLimitedReadSeeker
NewRateLimitedReadSeeker creates a RateLimitedReadSeeker which respects "limiter" in terms of the number of bytes read.
type RateLimitedReader ¶
type RateLimitedReader struct {
// contains filtered or unexported fields
}
RateLimitedReader will use its limiter as a rate limit on the number of bytes read.
func NewRateLimitedReader ¶
func NewRateLimitedReader(ctx context.Context, r io.Reader, limiter *rate.Limiter) *RateLimitedReader
NewRateLimitedReader creates a new RateLimitedReader which respects "limiter" in terms of the number of bytes read.
type RateLimitedReaderAt ¶
type RateLimitedReaderAt struct {
// contains filtered or unexported fields
}
RateLimitedReaderAt will use its limiter as a rate limit on the number of bytes read.
func NewRateLimitedReaderAt ¶
func NewRateLimitedReaderAt(ctx context.Context, r io.ReaderAt, limiter *rate.Limiter) *RateLimitedReaderAt
NewRateLimitedReaderAt creates a new RateLimitedReaderAt which respects "limiter" in terms of the number of bytes read.
type RateLimitedWriteAtSeeker ¶
type RateLimitedWriteAtSeeker struct {
// contains filtered or unexported fields
}
RateLimitedWriteAtSeeker will use its limiter as a rate limit on the number of bytes written.
func NewRateLimitedWriteAtSeeker ¶
func NewRateLimitedWriteAtSeeker(ctx context.Context, w ioiface.WriteAtSeeker, limiter *rate.Limiter, ) *RateLimitedWriteAtSeeker
NewRateLimitedWriteAtSeeker creates a new RateLimitedWriteAtSeeker which respects "limiter" in terms of the number of bytes written.
func (*RateLimitedWriteAtSeeker) Seek ¶
func (w *RateLimitedWriteAtSeeker) Seek(offset int64, whence int) (int64, error)
Seek sets the offset for the next write.
type RateLimitedWriter ¶
type RateLimitedWriter struct {
// contains filtered or unexported fields
}
RateLimitedWriter will use its limiter as a rate limit on the number of bytes written.
func NewRateLimitedWriter ¶
func NewRateLimitedWriter(ctx context.Context, w io.Writer, limiter *rate.Limiter) *RateLimitedWriter
NewRateLimitedWriter creates a new RateLimitedWriter which respects "limiter" in terms of the number of bytes written.
type RateLimitedWriterAt ¶
type RateLimitedWriterAt struct {
// contains filtered or unexported fields
}
RateLimitedWriterAt will use its limiter as a rate limit on the number of bytes written.
func NewRateLimitedWriterAt ¶
func NewRateLimitedWriterAt(ctx context.Context, w io.WriterAt, limiter *rate.Limiter) *RateLimitedWriterAt
NewRateLimitedWriterAt creates a new RateLimitedWriterAt which respects "limiter" in terms of the number of bytes written.