limiter

package
v0.8.0 Latest Latest
Warning

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

Go to latest
Published: Nov 26, 2017 License: BSD-2-Clause Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func LimitBackend

func LimitBackend(be restic.Backend, l Limiter) restic.Backend

LimitBackend wraps a Backend and applies rate limiting to Load() and Save() calls on the backend.

Types

type Limiter

type Limiter interface {
	// Upstream returns a rate limited reader that is intended to be used in
	// uploads.
	Upstream(r io.Reader) io.Reader

	// Downstream returns a rate limited reader that is intended to be used
	// for downloads.
	Downstream(r io.Reader) io.Reader
}

Limiter defines an interface that implementors can use to rate limit I/O according to some policy defined and configured by the implementor.

func NewStaticLimiter

func NewStaticLimiter(uploadKb, downloadKb int) Limiter

NewStaticLimiter constructs a Limiter with a fixed (static) upload and download rate cap

Jump to

Keyboard shortcuts

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