throttling

package
v1.4.10-rc.1 Latest Latest
Warning

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

Go to latest
Published: Jul 2, 2021 License: BSD-3-Clause Imports: 13 Imported by: 27

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DialThrottler

type DialThrottler interface {
	// Block until the event associated with this Acquire can happen.
	// If [ctx] is canceled, gives up and returns an error.
	Acquire(ctx context.Context) error
}

func NewDialThrottler

func NewDialThrottler(throttleLimit int) DialThrottler

func NewNoDialThrottler

func NewNoDialThrottler() DialThrottler

type MsgThrottler

type MsgThrottler interface {
	// Blocks until node [nodeID] can put a message of
	// size [msgSize] onto the incoming message buffer.
	Acquire(msgSize uint64, nodeID ids.ShortID)

	// Mark that a message from [nodeID] of size [msgSize]
	// has been removed from the incoming message buffer.
	Release(msgSize uint64, nodeID ids.ShortID)
}

MsgThrottler rate-limits incoming messages from the network.

func NewNoThrottler

func NewNoThrottler() MsgThrottler

func NewSybilMsgThrottler

func NewSybilMsgThrottler(
	log logging.Logger,
	metricsRegisterer prometheus.Registerer,
	vdrs validators.Set,
	config MsgThrottlerConfig,
) (MsgThrottler, error)

Returns a new MsgThrottler. If this function returns an error, the returned MsgThrottler may still be used. However, some of its metrics may not be registered.

type MsgThrottlerConfig

type MsgThrottlerConfig struct {
	VdrAllocSize        uint64
	AtLargeAllocSize    uint64
	NodeMaxAtLargeBytes uint64
}

See sybilMsgThrottler

Jump to

Keyboard shortcuts

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