heartbeat

package
v0.14.46 Latest Latest
Warning

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

Go to latest
Published: Feb 14, 2024 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrNoAvailableServers is returned when there are no available servers
	ErrNoAvailableServers = errors.New("no available M-Lab servers")
)

Functions

func NewHeartbeatStatusTracker

func NewHeartbeatStatusTracker(client MemorystoreClient[v2.HeartbeatMessage]) *heartbeatStatusTracker

NewHeartbeatStatusTracker returns a new StatusTracker implementation that uses a Memorystore client to cache (and later import) instance data from the Heartbeat Service. StopImport() must be called to release resources.

Types

type Locator

type Locator struct {
	StatusTracker
}

Locator manages requests to "locate" mlab-ns servers.

func NewServerLocator

func NewServerLocator(tracker StatusTracker) *Locator

NewServerLocator creates a new Locator instance.

func (*Locator) Nearest

func (l *Locator) Nearest(service string, lat, lon float64, opts *NearestOptions) (*TargetInfo, error)

Nearest discovers the nearest machines for the target service, using an exponentially distributed function based on distance.

type MemorystoreClient

type MemorystoreClient[V any] interface {
	Put(key string, field string, value redis.Scanner, opts *memorystore.PutOptions) error
	GetAll() (map[string]V, error)
}

MemorystoreClient is a client for reading and writing data in Memorystore. The interface takes in a type argument which specifies the types of values that are stored and can be retrived.

type NearestOptions added in v0.13.4

type NearestOptions struct {
	Type    string   // Limit results to only machines of this type.
	Sites   []string // Limit results to only machines at these sites.
	Country string   // Bias results to prefer machines in this country.
	Strict  bool     // When used with Country, limit results to only machines in this country.
}

NearestOptions allows clients to pass parameters modifying how results are filtered.

type StatusTracker

type StatusTracker interface {
	RegisterInstance(rm v2.Registration) error
	UpdateHealth(hostname string, hm v2.Health) error
	UpdatePrometheus(hostnames, machines map[string]bool) error
	Instances() map[string]v2.HeartbeatMessage
	StopImport()
	Ready() bool
}

StatusTracker defines the interface for tracking the status of experiment instances.

type TargetInfo added in v0.14.12

type TargetInfo struct {
	Targets []v2.Target    // Targets to run a measurement on.
	URLs    []url.URL      // Service URL templates.
	Ranks   map[string]int // Map of machines to metro rankings.
}

TargetInfo returns the set of `v2.Target` to run the measurement on with the necessary information to create their URLs.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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