limits

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Nov 12, 2020 License: Apache-2.0 Imports: 6 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type LookbackLimit

type LookbackLimit interface {
	// Inc increments the recent value for the limit.
	Inc(new int) error
}

LookbackLimit provides an interface for a specific query limit.

type LookbackLimitOptions

type LookbackLimitOptions struct {
	// Limit past which errors will be returned.
	Limit int64
	// Lookback is the period over which the limit is enforced.
	Lookback time.Duration
}

LookbackLimitOptions holds options for a lookback limit to be enforced.

func DefaultLookbackLimitOptions

func DefaultLookbackLimitOptions() LookbackLimitOptions

DefaultLookbackLimitOptions returns a new query limits manager.

type QueryLimits

type QueryLimits interface {
	// DocsLimit limits queries by a global concurrent count of index docs matched.
	DocsLimit() LookbackLimit
	// BytesReadLimit limits queries by a global concurrent count of bytes read from disk.
	BytesReadLimit() LookbackLimit

	// AnyExceeded returns an error if any of the query limits are exceeded.
	AnyExceeded() error
	// Start begins background resetting of the query limits.
	Start()
	// Stop end background resetting of the query limits.
	Stop()
}

QueryLimits provides an interface for managing query limits.

func NewQueryLimits

func NewQueryLimits(
	docsLimitOpts LookbackLimitOptions,
	bytesReadLimitOpts LookbackLimitOptions,
	instrumentOpts instrument.Options,
) (QueryLimits, error)

NewQueryLimits returns a new query limits manager.

func NoOpQueryLimits

func NoOpQueryLimits() QueryLimits

NoOpQueryLimits returns inactive query limits.

Jump to

Keyboard shortcuts

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