quotalimit

package
v1.10.0 Latest Latest
Warning

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

Go to latest
Published: Nov 25, 2026 License: MIT Imports: 1 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

Overview

Package quotalimit lets a service consult Service Quotas applied values without importing it.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Func

type Func func(account, region, serviceCode, quotaCode string) (limit float64, ok bool)

Func returns the applied limit of a quota for an account and Region; ok is false when none is known.

type Gate

type Gate struct {
	// contains filtered or unexported fields
}

Gate holds the optional lookup; the zero value is ready to use and enforces nothing.

func (*Gate) Lookup

func (g *Gate) Lookup(account, region, serviceCode, quotaCode string) Limit

Lookup resolves the limit. Call it before taking a service lock: the lookup takes Service Quotas' own lock.

func (*Gate) Set

func (g *Gate) Set(f Func)

Set installs the lookup; nil disables enforcement.

type Limit

type Limit struct {
	Value float64
	Set   bool
}

Limit is a resolved quota limit; the zero value enforces nothing.

func (Limit) Reached

func (l Limit) Reached(current int) bool

Reached reports whether creating one more resource beyond current would exceed the limit.

Jump to

Keyboard shortcuts

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