Versions in this module Expand all Collapse all v0 v0.0.0 Oct 23, 2026 Changes in this version + const DefaultOperationKey + const DefaultWarningInterval + const EventFailOpen + const EventRecovered + const MaxBatchRRsets + const PatchZoneOperation + const ReasonConnection + const ReasonScript + const ReasonTimeout + var ChangeKinds = []string + func Classify(err error) string + func ParseRedisURL(rawURL string) error + func RetryAfterSeconds(wait time.Duration) int64 + type Backend interface + Take func(context.Context, []Charge) (TakeResult, error) + type Bucket struct + Capacity int64 + RefillPerSecond float64 + type BucketName string + const BucketChanges + const BucketOperation + const BucketRequests + type BucketOverride struct + Capacity *int64 + RefillPerSecond *float64 + type Charge struct + Bucket Bucket + Cost int64 + Key string + Name BucketName + func Charges(policy Policy, request Request) []Charge + type Decision struct + ChangeCost int64 + Exceeded []Exceeded + Latency time.Duration + Outcome Outcome + RequestCost int64 + RetryAfter time.Duration + Short []BucketName + type Document struct + Defaults *Override + Identities map[string]Override + func (document Document) Resolve(operations map[string]struct{}) (*Table, []string, error) + type Exceeded struct + Bucket BucketName + Capacity int64 + Cost int64 + type Limiter struct + func NewLimiter(config LimiterConfig) (*Limiter, error) + func (limiter *Limiter) Admit(ctx context.Context, request Request) Decision + type LimiterConfig struct + Backend Backend + Now func() time.Time + Reporter *Reporter + Table *Table + Timeout time.Duration + type MemoryBackend struct + func NewMemoryBackend(now func() time.Time) *MemoryBackend + func (backend *MemoryBackend) Stored(key string) (float64, bool) + func (backend *MemoryBackend) Take(ctx context.Context, charges []Charge) (TakeResult, error) + type Outcome string + const OutcomeAdmitted + const OutcomeExceedsCapacity + const OutcomeThrottled + const OutcomeUnmetered + type Override struct + ChangeCosts costOverrides + Changes *BucketOverride + OperationCosts costOverrides + Operations map[string]BucketOverride + Requests *BucketOverride + type Policy struct + ChangeCosts map[string]int64 + Changes Bucket + DefaultOperation Bucket + OperationCosts map[string]int64 + Operations map[string]Bucket + Requests Bucket + func BuiltinPolicy() Policy + func (policy Policy) ChangeCost(operation string, changeKinds []string) int64 + func (policy Policy) MaxRequestChangeCost() int64 + func (policy Policy) OperationBucket(operation string) Bucket + type RedisBackend struct + func NewRedisBackend(client *RedisClient) (*RedisBackend, error) + func (backend *RedisBackend) Take(ctx context.Context, charges []Charge) (TakeResult, error) + type RedisClient struct + func NewRedisClient(rawURL string, timeout time.Duration) (*RedisClient, error) + func (client *RedisClient) Close() error + func (client *RedisClient) Timeout() time.Duration + type Reporter struct + func NewReporter(logger *slog.Logger, interval time.Duration, now func() time.Time) *Reporter + func (reporter *Reporter) Failure(err error) + func (reporter *Reporter) Success() + type Request struct + ChangeKinds []string + IdentityID string + Operation string + type Table struct + func NewBuiltinTable() *Table + func ParsePolicy(data []byte, operations map[string]struct{}) (*Table, []string, error) + func (table *Table) For(identityID string) Policy + type TakeResult struct + Admitted bool + Short []int + Wait time.Duration