throttler

package
v1.9.0-rc.2 Latest Latest
Warning

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

Go to latest
Published: May 19, 2023 License: AGPL-3.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Factory

type Factory struct {
	Stats stats.Stats
	// contains filtered or unexported fields
}

func New

func New(stats stats.Stats) (*Factory, error)

New constructs a new Throttler Factory

func (*Factory) CheckLimitReached

func (f *Factory) CheckLimitReached(context context.Context, workspaceId string) (bool, error)

type Limiter

type Limiter interface {
	// Allow returns true if the limit is not exceeded, false otherwise.
	Allow(ctx context.Context, cost, rate, window int64, key string) (bool, func(context.Context) error, error)
}

type Throttler

type Throttler interface {
	CheckLimitReached(context context.Context, workspaceId string) (bool, error)
}

Jump to

Keyboard shortcuts

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