srate

package
v0.6.4 Latest Latest
Warning

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

Go to latest
Published: Dec 1, 2021 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultConfig = Config{
	MaxConcurrency: 1,
	StartupDelay:   5,
}

Functions

func ShardMaxConcurrencyKey

func ShardMaxConcurrencyKey(shardID int, maxConcurrency int) int

Types

type Config

type Config struct {
	Logger         log.Logger
	MaxConcurrency int
	StartupDelay   int
}

func (*Config) Apply

func (c *Config) Apply(opts []ConfigOpt)

type ConfigOpt

type ConfigOpt func(config *Config)

func WithLogger

func WithLogger(logger log.Logger) ConfigOpt

func WithMaxConcurrency

func WithMaxConcurrency(maxConcurrency int) ConfigOpt

func WithStartupDelay

func WithStartupDelay(startupDelay int) ConfigOpt

type Limiter

type Limiter interface {
	Logger() log.Logger
	Close(ctx context.Context) error
	Config() Config
	WaitBucket(ctx context.Context, shardID int) error
	UnlockBucket(shardID int)
}

func NewLimiter

func NewLimiter(config *Config) Limiter

Jump to

Keyboard shortcuts

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