runner

package
v0.0.0-...-20989ac Latest Latest
Warning

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

Go to latest
Published: Aug 15, 2022 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ContextKey

type ContextKey string

ContextKey is a type that represents a key in a Golang context

const (
	// ExperimentEngineKey represents the key for the experiment engine name, stored in the context
	ExperimentEngineKey ContextKey = "experimentEngineKey"
)

type ExperimentRunner

type ExperimentRunner interface {
	GetTreatmentForRequest(
		header http.Header,
		payload []byte,
		options GetTreatmentOptions,
	) (*Treatment, error)
}

ExperimentRunner is the generic interface for generating experiment configs for a given request

func NewInterceptRunner

func NewInterceptRunner(
	name string,
	runner ExperimentRunner,
	interceptors ...Interceptor,
) ExperimentRunner

type GetTreatmentOptions

type GetTreatmentOptions struct {
	TuringRequestID string
}

type Interceptor

type Interceptor interface {
	BeforeDispatch(ctx context.Context) context.Context
	AfterCompletion(ctx context.Context, err error)
}

Interceptor interface is used to define concrete interceptors whose methods will be run before and after a single fetch treatment call

type Treatment

type Treatment struct {
	ExperimentName string
	Name           string
	Config         json.RawMessage
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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