latency

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Oct 27, 2025 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Code generated by latencygen. DO NOT EDIT. source: cmd/latencygen/latencies/wonderproxy.csv

Index

Constants

View Source
const DefaultLocation = "default"
View Source
const SourceFile = "cmd/latencygen/latencies/wonderproxy.csv"

SourceFile is the CSV file used to generate this latency matrix.

Variables

This section is empty.

Functions

func Between

func Between(a, b string) time.Duration

Between returns the latency between locations a and b. If a or b are not valid locations, the function will panic.

func ValidLocation

func ValidLocation(location string) (string, error)

ValidLocation returns the location if it is valid, or an error otherwise.

Types

type Matrix

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

Matrix represents a latency matrix and locations.

func MatrixFrom

func MatrixFrom(locations []string) Matrix

MatrixFrom returns the latencies between the given locations. If a location is not valid, the function will panic.

func (Matrix) Delay

func (lm Matrix) Delay(a, b hotstuff.ID)

Delay sleeps for the duration of the latency between nodes a and b.

func (Matrix) Enabled

func (lm Matrix) Enabled() bool

Enabled returns true if a latency matrix was provided.

func (Matrix) Latency

func (lm Matrix) Latency(a, b hotstuff.ID) time.Duration

Latency returns the latency between nodes a and b. If a or b are not valid nodes, the function will panic.

func (Matrix) Location

func (lm Matrix) Location(id hotstuff.ID) string

Location returns the location of the node with the given ID. If the ID is 0 or the latency matrix is not enabled, the function will return the default location. If the ID is out of range, the function will panic.

Jump to

Keyboard shortcuts

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