limiter

package
v0.0.0-...-41c7550 Latest Latest
Warning

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

Go to latest
Published: Mar 14, 2024 License: LGPL-3.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	MessageLimit uint64
	BytesLimit   uint64
	Burst        uint64
}

Config stores the config for a Limiter

type Limiter

type Limiter struct {
	Config
	// contains filtered or unexported fields
}

Limiter is a component that blocks the pipeline to ensure a maximum number of messages are being processed in a time. You may spawn ONLY ONE worker

func (*Limiter) OnMessage

func (l *Limiter) OnMessage(m *utils.Message, done utils.Done)

OnMessage will block the pipeline when the message rate is too high

func (*Limiter) Spawn

func (l *Limiter) Spawn(id int) utils.Composer

Spawn initializes the limiter

func (*Limiter) Workers

func (l *Limiter) Workers() int

Workers returns 1 because it should be only one instance of this component

Jump to

Keyboard shortcuts

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