pglimiter

package
v1.16.0 Latest Latest
Warning

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

Go to latest
Published: Oct 10, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

Package pglimiter is the sliding-window rate limiter over ratelimit.Limit buckets in PostgreSQL (rate_limits), shared by every replica: AuthKit's limiter of record, and the Redis limiter's while Redis fails.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Limiter

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

Limiter spends budgets in rate_limits, one row per bucket and key.

func New

func New(q *db.Queries, limits map[string]ratelimit.Limit) (*Limiter, error)

New is the limiter over q, which resolves AuthKit's schema.

func (*Limiter) Allow

func (l *Limiter) Allow(ctx context.Context, bucket, key string) (ratelimit.Result, error)

Allow decides in one statement on the database clock. The row is keyed by a digest of key, so no address or identifier is stored.

Jump to

Keyboard shortcuts

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