bbr

package
v3.0.0-alpha-29 Latest Latest
Warning

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

Go to latest
Published: May 16, 2023 License: MIT Imports: 6 Imported by: 2

Documentation

Overview

package bbr implements the BBR congestion control algorithm, as described in:

https://queue.acm.org/detail.cfm?id=3022184

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Limiter

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

A Limiter implements flowcontrol.FlowLimiter using the BBR algorithm.

func NewLimiter

func NewLimiter(clk clock.Clock) *Limiter

NewLimiter returns a new BBR-based flow limiter. The clock is used to measure message resposne times. If nil is passed (typical, except for testing & debugging), the system clock will be used.

func (*Limiter) Release

func (l *Limiter) Release()

func (*Limiter) StartMessage

func (l *Limiter) StartMessage(ctx context.Context, size uint64) (gotResponse func(), err error)

type Snapshot

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

A Snapshot captures the internal state of a limiter at the time it was called, along with the current time. This is useful for debugging.

func SnapshotLimiter

func SnapshotLimiter(l *Limiter) Snapshot

Take a snapshot of the limiter.

func (Snapshot) Json

func (s Snapshot) Json() any

Returns a value that can be formatted as json using the encoding/json package, which captures the data in the snapshot. The exact format of this is unspecified, as it exposes implementation details of the Limiter type.

type SnapshottingLimiter

type SnapshottingLimiter struct {
	Limiter        *Limiter       // The limiter to wrap
	RecordSnapshot func(Snapshot) // The callback to pass snapshots to
}

A SnapshottingLimiter is a wrapper around Limiter which takes snapshots on each operation and passes them to a callback.

func (SnapshottingLimiter) Release

func (l SnapshottingLimiter) Release()

func (SnapshottingLimiter) StartMessage

func (l SnapshottingLimiter) StartMessage(ctx context.Context, size uint64) (gotResponse func(), err error)

Jump to

Keyboard shortcuts

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