throttle

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Mar 7, 2023 License: Apache-2.0, MIT Imports: 1 Imported by: 11

Documentation

Overview

Package throttle includes throttlers for composing in various contexts, such as inside Mounts for costly operations, and within the DAG store itself.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Throttler

type Throttler interface {
	// Do performs the supplied action under the guard of the throttler.
	//
	// The supplied context is obeyed when parking to claim a throttler spot, and is
	// passed to the action. Errors from the action are propagated to the caller,
	// as are context deadline errors.
	//
	// Do blocks until the action has executed.
	Do(context.Context, func(ctx context.Context) error) error
}

Throttler is a component to perform throttling of concurrent requests.

func Fixed

func Fixed(maxConcurrency int) Throttler

Fixed creates a new throttler that allows the specified fixed concurrency at most.

func Noop

func Noop() Throttler

Noop returns a noop throttler.

Jump to

Keyboard shortcuts

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