unthrottle

package
v0.0.0-...-c5f8e96 Latest Latest
Warning

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

Go to latest
Published: May 6, 2024 License: BSD-3-Clause Imports: 3 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DatastoreThrottle

type DatastoreThrottle struct{}

DatastoreThrottle is an implementation of Throttle which uses Datastore.

func NewDatastore

func NewDatastore(ctx context.Context) *DatastoreThrottle

NewDatastore returns an implementation of Throttle which uses Datastore.

func (*DatastoreThrottle) Get

func (t *DatastoreThrottle) Get(ctx context.Context, roller string) (bool, error)

Get implements the Throttle interface.

func (*DatastoreThrottle) Reset

func (t *DatastoreThrottle) Reset(ctx context.Context, roller string) error

Reset implements the Throttle interface.

func (*DatastoreThrottle) Unthrottle

func (t *DatastoreThrottle) Unthrottle(ctx context.Context, roller string) error

Unthrottle implements the Throttle interface.

type Throttle

type Throttle interface {
	// Unthrottle the given roller.
	Unthrottle(ctx context.Context, roller string) error
	// Reset the should-unthrottle status of the roller, allowing it to become
	// throttled again if necessary.
	Reset(ctx context.Context, roller string) error
	// Get determines whether the given roller should be unthrottled.
	Get(ctx context.Context, roller string) (bool, error)
}

Throttle tracks whether a given roller should be throttled. TODO(borenet): This should include throttle-enabling as well as disabling, and it should maintain history like modes and strategies.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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