feature_flags

package
v0.0.4 Latest Latest
Warning

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

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

Documentation

Overview

Copyright 2020 New Relic Corporation. All rights reserved. SPDX-License-Identifier: Apache-2.0

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrFeatureFlagAlreadyExists = errors.New("feature flag already exists")
)

Functions

This section is empty.

Types

type FeatureFlags

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

func NewManager

func NewManager(initialFeatureFlags map[string]bool) *FeatureFlags

func (*FeatureFlags) GetFeatureFlag

func (f *FeatureFlags) GetFeatureFlag(name string) (enabled, exists bool)

GetFeatureFlag returns if a FF is enabled and exists

func (*FeatureFlags) SetFeatureFlag

func (f *FeatureFlags) SetFeatureFlag(name string, enabled bool) error

SetFeatureFlag adds a new FF to the config. FFs can be defined in the agent's config file or they may come from the Command Channel. As the command channel runs asynchronously, we need to lock the feature flags.

type Manager

type Manager interface {
	Setter
	Retriever
}

Manager allows you to add or get feature flags.

type Retriever

type Retriever interface {
	GetFeatureFlag(name string) (enabled, exists bool)
}

type Setter

type Setter interface {
	// SetFeatureFlag enables or disables FF on the config if not already set.
	SetFeatureFlag(name string, enabled bool) error
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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