limits

package
v0.15.17-hotfix.3 Latest Latest
Warning

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

Go to latest
Published: Oct 27, 2020 License: Apache-2.0 Imports: 5 Imported by: 0

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