registry

package
v3.17.0 Latest Latest
Warning

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

Go to latest
Published: Feb 20, 2023 License: GPL-3.0 Imports: 38 Imported by: 0

Documentation

Overview

Package registry contains a registry of all the available experiments.

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrConfigIsNotAStructPointer indicates we expected a pointer to struct.
	ErrConfigIsNotAStructPointer = errors.New("config is not a struct pointer")

	// ErrNoSuchField indicates there's no field with the given name.
	ErrNoSuchField = errors.New("no such field")

	// ErrCannotSetIntegerOption means SetOptionAny couldn't set an integer option.
	ErrCannotSetIntegerOption = errors.New("cannot set integer option")

	// ErrInvalidStringRepresentationOfBool indicates the string you passed
	// to SetOptionaAny is not a valid string representation of a bool.
	ErrInvalidStringRepresentationOfBool = errors.New("invalid string representation of bool")

	// ErrCannotSetBoolOption means SetOptionAny couldn't set a bool option.
	ErrCannotSetBoolOption = errors.New("cannot set bool option")

	// ErrCannotSetStringOption means SetOptionAny couldn't set a string option.
	ErrCannotSetStringOption = errors.New("cannot set string option")

	// ErrUnsupportedOptionType means we don't support the type passed to
	// the SetOptionAny method as an opaque any type.
	ErrUnsupportedOptionType = errors.New("unsupported option type")
)
View Source
var AllExperiments = map[string]*Factory{}

Where we register all the available experiments.

View Source
var ErrNoSuchExperiment = errors.New("no such experiment")

ErrNoSuchExperiment indicates a given experiment does not exist.

Functions

func CanonicalizeExperimentName

func CanonicalizeExperimentName(name string) string

CanonicalizeExperimentName allows code to provide experiment names in a more flexible way, where we have aliases.

Because we allow for uppercase experiment names for backwards compatibility with MK, we need to add some exceptions here when mapping (e.g., DNSCheck => dnscheck).

func ExperimentNames

func ExperimentNames() (names []string)

ExperimentNames returns the name of all experiments

Types

type Factory

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

Factory allows to construct an experiment measurer.

func NewFactory

func NewFactory(name string) (*Factory, error)

NewFactory creates a new Factory instance.

func (*Factory) InputPolicy

func (b *Factory) InputPolicy() model.InputPolicy

InputPolicy returns the experiment's InputPolicy.

func (*Factory) Interruptible

func (b *Factory) Interruptible() bool

Interruptible returns whether the experiment is interruptible.

func (*Factory) NewExperimentMeasurer

func (b *Factory) NewExperimentMeasurer() model.ExperimentMeasurer

NewExperimentMeasurer creates the experiment

func (*Factory) Options

func (b *Factory) Options() (map[string]model.ExperimentOptionInfo, error)

Options returns the options exposed by this experiment.

func (*Factory) SetOptionAny

func (b *Factory) SetOptionAny(key string, value any) error

SetOptionAny sets an option given any value.

func (*Factory) SetOptionsAny

func (b *Factory) SetOptionsAny(options map[string]any) error

SetOptionsAny calls SetOptionAny for each entry inside [options].

Jump to

Keyboard shortcuts

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