throughput

package
v1.0.9 Latest Latest
Warning

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

Go to latest
Published: Sep 5, 2025 License: GPL-3.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Tier0 = iota
	Tier1
	Tier2
	Tier3

	Tier0RPS uint64 = 10
	Tier1RPS uint64 = 50
	Tier2RPS uint64 = 250
	Tier3RPS uint64 = 1250

	Tier0RPM uint64 = 1000000
	Tier1RPM uint64 = 5000000
	Tier2RPM uint64 = 25000000
	Tier3RPM uint64 = 125000000
)
View Source
const Days30 = time.Hour * 24 * 30

Variables

This section is empty.

Functions

func GetRPM

func GetRPM(tier int) uint64

func GetRPS

func GetRPS(tier int) uint64

Types

type MemoryStorage

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

func NewMemoryStorage

func NewMemoryStorage() *MemoryStorage

func (*MemoryStorage) Add

func (s *MemoryStorage) Add(key string, tier int)

func (*MemoryStorage) Incr

func (s *MemoryStorage) Incr(key string)

func (*MemoryStorage) RPM

func (s *MemoryStorage) RPM(key string) uint64

func (*MemoryStorage) RPS

func (s *MemoryStorage) RPS(key string) uint64

func (*MemoryStorage) Reset

func (s *MemoryStorage) Reset()

func (*MemoryStorage) Tier

func (s *MemoryStorage) Tier(key string) int

type Storage

type Storage interface {
	RPS(key string) uint64
	RPM(key string) uint64
	Add(key string, tier int)
	Incr(key string)
	Tier(key string) int
	Reset()
}

type Throughput

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

func New

func New(ctx context.Context, storage Storage) *Throughput

func (*Throughput) Loop

func (t *Throughput) Loop()

func (*Throughput) Middleware

func (t *Throughput) Middleware(parameter string) func(next fiber.Handler) fiber.Handler

func (*Throughput) Validate

func (t *Throughput) Validate(name string) bool

Jump to

Keyboard shortcuts

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