experiment

package
v0.0.0-...-eb3fb91 Latest Latest
Warning

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

Go to latest
Published: Dec 17, 2024 License: MIT Imports: 5 Imported by: 3

Documentation

Overview

Package experiment implements feature flag propagation.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Get

func Get(ctx context.Context) []string

Get returns the registered feature flags.

func Has

func Has(ctx context.Context, exp string) bool

Has checks if the experiment registered to the comma separated list.

func With

func With(ctx context.Context, exp string) context.Context

With registers the feature flag of an ongoing experiment.

Types

type Handler

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

Handler implements drpc handler interface to extract experiment feature flag.

func NewHandler

func NewHandler(handler drpc.Handler) *Handler

NewHandler returns a new instance of Handler.

func (*Handler) HandleRPC

func (handler *Handler) HandleRPC(stream drpc.Stream, rpc string) (err error)

HandleRPC copies experiment feature flag from drpcmeta to context.

type Wrapper

type Wrapper struct {
	rpcpool.Conn
}

Wrapper wraps a Conn with experimental feature flag information.

func NewConnWrapper

func NewConnWrapper(conn rpcpool.Conn) *Wrapper

NewConnWrapper creates a new instance of the wrapper.

func (*Wrapper) Invoke

func (c *Wrapper) Invoke(ctx context.Context, rpc string, enc drpc.Encoding, in drpc.Message, out drpc.Message) (err error)

Invoke implements drpc.Conn's Invoke method with feature flag information injected into the context.

func (*Wrapper) NewStream

func (c *Wrapper) NewStream(ctx context.Context, rpc string, enc drpc.Encoding) (_ drpc.Stream, err error)

NewStream implements drpc.Conn's NewStream method with experiment feature flag injected into the context.

Jump to

Keyboard shortcuts

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