registry

package
v0.27.0 Latest Latest
Warning

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

Go to latest
Published: Dec 13, 2023 License: GPL-3.0 Imports: 43 Imported by: 0

Documentation

Overview

Package registry contains a registry of all the available experiments.

Index

Constants

View Source
const OONI_FORCE_ENABLE_EXPERIMENT = "OONI_FORCE_ENABLE_EXPERIMENT"

OONI_FORCE_ENABLE_EXPERIMENT is the name of the environment variable you should set to "1" to bypass the algorithm preventing disabled by default experiments to be instantiated.

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.

View Source
var ErrRequiresForceEnable = errors.New("experiment not enabled by check-in API")

ErrRequiresForceEnable is returned for experiments that are not enabled by default and are also not enabled by the most recent check-in API call.

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, kvStore model.KeyValueStore, logger model.Logger) (*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