quota

package
v1.1.2 Latest Latest
Warning

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

Go to latest
Published: Sep 5, 2023 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const LimiterTypeInMemory = "inmemory"
View Source
const LimiterTypeNone = "none"
View Source
const LimiterTypeRedis = "redis"

Variables

This section is empty.

Functions

This section is empty.

Types

type BadConfigError

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

func (*BadConfigError) Error

func (e *BadConfigError) Error() string

type ConfigNotFoundError

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

func (*ConfigNotFoundError) Error

func (e *ConfigNotFoundError) Error() string

type NoEarsInstances

type NoEarsInstances struct {
}

func (*NoEarsInstances) Error

func (e *NoEarsInstances) Error() string

type QuotaLimiter

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

Quota limiter implements an additional Wait function

func NewQuotaLimiter

func NewQuotaLimiter(tid tenant.Id, backendLimiterType string, redisAddr string, initialRqs int, tenantRqs int) *QuotaLimiter

func (*QuotaLimiter) AdaptiveLimit

func (r *QuotaLimiter) AdaptiveLimit() int

func (*QuotaLimiter) Limit

func (r *QuotaLimiter) Limit() int

func (*QuotaLimiter) SetLimit

func (r *QuotaLimiter) SetLimit(newLimit int) error

func (*QuotaLimiter) Take

func (r *QuotaLimiter) Take(ctx context.Context, unit int) error

func (*QuotaLimiter) Wait

func (r *QuotaLimiter) Wait(ctx context.Context) error

type QuotaManager

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

func NewQuotaManager

func NewQuotaManager(logger *zerolog.Logger, tenantStorer tenant.TenantStorer, syncer syncer.DeltaSyncer, config config.Config) (*QuotaManager, error)

func (*QuotaManager) PublishQuota

func (m *QuotaManager) PublishQuota(ctx context.Context, tid tenant.Id) error

PublishQuota publishes tenant quota to ratelimiters in all nodes so they can sync to the new quota

func (*QuotaManager) Start

func (m *QuotaManager) Start()

func (*QuotaManager) Stop

func (m *QuotaManager) Stop()

func (*QuotaManager) SyncItem

func (m *QuotaManager) SyncItem(ctx context.Context, tid tenant.Id, itemId string, add bool) error

func (*QuotaManager) TenantLimit

func (m *QuotaManager) TenantLimit(ctx context.Context, tid tenant.Id) int

func (*QuotaManager) Wait

func (m *QuotaManager) Wait(ctx context.Context, tid tenant.Id) error

Wait until rate limiter allows it to go through or context cancellation

Jump to

Keyboard shortcuts

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