rate

package
v0.0.0-...-a47d1aa Latest Latest
Warning

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

Go to latest
Published: Mar 19, 2023 License: AGPL-3.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ClientName = "rate-client"
)
View Source
const (
	ServiceName = "rate"
)

Variables

View Source
var (
	ErrNotFound = errors.New("not found")
)

Functions

This section is empty.

Types

type Client

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

func NewClient

func NewClient(logger log.Logger) *Client

func (*Client) Allow

func (c *Client) Allow(ctx context.Context, addrs []string, namespace, resource string, tokens int64) (time.Duration, bool, error)

type Config

type Config struct {
	Quotas  quotaList   `yaml:"quotas"`
	Storage rate.Config `yaml:"storage"`
}

func (*Config) RegisterFlagsWithPrefix

func (c *Config) RegisterFlagsWithPrefix(f *flag.FlagSet, prefix string)

type Service

type Service struct {
	services.NamedService
	// contains filtered or unexported fields
}

func NewService

func NewService(cfg Config, clock clock.Clock, logger log.Logger) (*Service, error)

func (*Service) Allow

func (s *Service) Allow(ctx context.Context, namespace, resource string, tokens int64) (time.Duration, bool, error)

Jump to

Keyboard shortcuts

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