limitreader

package
v2.0.2-alpha.3 Latest Latest
Warning

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

Go to latest
Published: Dec 9, 2021 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type LimitReader

type LimitReader struct {
	Src     io.Reader
	Limiter *ratelimiter.RateLimiter
	// contains filtered or unexported fields
}

LimitReader reads stream with RateLimiter.

func NewLimitReader

func NewLimitReader(src io.Reader, rate int64) *LimitReader

NewLimitReader creates a LimitReader. src: reader rate: bytes/second

func NewLimitReaderWithLimiter

func NewLimitReaderWithLimiter(rl *ratelimiter.RateLimiter, src io.Reader) *LimitReader

NewLimitReaderWithLimiter creates LimitReader with a rateLimiter. src: reader rate: bytes/second

func NewLimitReaderWithLimiterAndDigest

func NewLimitReaderWithLimiterAndDigest(src io.Reader, rl *ratelimiter.RateLimiter, digest hash.Hash, digestType digest.Algorithm) *LimitReader

NewLimitReaderWithLimiterAndDigest creates LimitReader with rateLimiter and digest. src: reader rate: bytes/second

func (*LimitReader) Digest

func (lr *LimitReader) Digest() string

Digest calculates the digest of all contents read, return value is like <algo>:<hex_value>

func (*LimitReader) Read

func (lr *LimitReader) Read(p []byte) (n int, err error)

Jump to

Keyboard shortcuts

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