manager

package
v0.0.7 Latest Latest
Warning

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

Go to latest
Published: Sep 20, 2023 License: MIT Imports: 4 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Cache added in v0.0.2

type Cache interface {
	IncrementCounter(keyId string, rateLimitUnit key.TimeUnit, incr int64) error
}

type Encrypter

type Encrypter interface {
	Encrypt(secret string) string
}

type Manager

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

func NewManager

func NewManager(s Storage, e Encrypter) *Manager

func (*Manager) CreateKey

func (m *Manager) CreateKey(rk *key.RequestKey) (*key.ResponseKey, error)

func (*Manager) DeleteKey

func (m *Manager) DeleteKey(id string) error

func (*Manager) GetKeysByTag

func (m *Manager) GetKeysByTag(tag string) ([]*key.ResponseKey, error)

func (*Manager) UpdateKey

func (m *Manager) UpdateKey(id string, uk *key.UpdateKey) (*key.ResponseKey, error)

type RateLimitManager added in v0.0.2

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

func NewRateLimitManager added in v0.0.2

func NewRateLimitManager(c Cache) *RateLimitManager

func (*RateLimitManager) Increment added in v0.0.2

func (rlm *RateLimitManager) Increment(keyId string, timeUnit key.TimeUnit) error

type ReportingManager added in v0.0.7

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

func NewReportingManager added in v0.0.7

func NewReportingManager(cs costStorage, ks keyStorage) *ReportingManager

func (*ReportingManager) GetKeyReporting added in v0.0.7

func (rm *ReportingManager) GetKeyReporting(keyId string) (*key.KeyReporting, error)

type Storage

type Storage interface {
	GetKeysByTag(tag string) ([]*key.ResponseKey, error)
	UpdateKey(id string, key *key.UpdateKey) (*key.ResponseKey, error)
	CreateKey(key *key.RequestKey) (*key.ResponseKey, error)
	DeleteKey(id string) error
}

Jump to

Keyboard shortcuts

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