ratelimit

package
v0.0.0-...-d3967d6 Latest Latest
Warning

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

Go to latest
Published: Mar 9, 2020 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var RateLimitBuiltin = &ast.Builtin{
	Name: "rate_limit",
	Decl: types.NewFunction(types.Args(types.A), types.B),
}
View Source
var UpdateLimitsUsageBuiltin = &ast.Builtin{
	Name: "update_limits_usage",
	Decl: types.NewFunction(types.Args(), types.B),
}

Functions

func RateLimitBuiltinImpl

func RateLimitBuiltinImpl(limitValue ast.Value, bctx topdown.BuiltinContext) (ast.Value, error)

Returns true if limited, false otherwise. It does not update the counter used to rate-limit. Instead, when within limits, the increase value is stored in the context so it can be applied later. When rate-limited, it cleans the limits in the context, because in that case, we want to make sure that no updates are applied.

func UpdateLimitsUsageBuiltinImpl

func UpdateLimitsUsageBuiltinImpl(bctx topdown.BuiltinContext) (ast.Value, error)

Updates the counters used to rate-limit with the values stored in the context.

Types

This section is empty.

Jump to

Keyboard shortcuts

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