store

package
v0.11.2 Latest Latest
Warning

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

Go to latest
Published: Feb 21, 2025 License: Apache-2.0 Imports: 8 Imported by: 6

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type IStore added in v0.9.0

type IStore interface {
	GetAll(ctx context.Context) (map[string]model.Flag, model.Metadata, error)
	Get(ctx context.Context, key string) (model.Flag, model.Metadata, bool)
	SelectorForFlag(ctx context.Context, flag model.Flag) string
}

type SourceDetails added in v0.6.2

type SourceDetails struct {
	Source   string
	Selector string
}

type State added in v0.11.0

type State struct {
	Flags             map[string]model.Flag `json:"flags"`
	FlagSources       []string
	SourceDetails     map[string]SourceDetails  `json:"sourceMetadata,omitempty"`
	MetadataPerSource map[string]model.Metadata `json:"metadata,omitempty"`
	// contains filtered or unexported fields
}

func NewFlags

func NewFlags() *State

func (*State) Add added in v0.11.0

func (f *State) Add(logger *logger.Logger, source string, selector string, flags map[string]model.Flag,
) map[string]interface{}

Add new flags from source.

func (*State) Delete added in v0.11.0

func (f *State) Delete(key string)

func (*State) DeleteFlags added in v0.11.0

func (f *State) DeleteFlags(logger *logger.Logger, source string, flags map[string]model.Flag) map[string]interface{}

DeleteFlags matching flags from source.

func (*State) Get added in v0.11.0

func (f *State) Get(_ context.Context, key string) (model.Flag, model.Metadata, bool)

func (*State) GetAll added in v0.11.0

func (f *State) GetAll(_ context.Context) (map[string]model.Flag, model.Metadata, error)

GetAll returns a copy of the store's state (copy in order to be concurrency safe)

func (*State) Merge added in v0.11.0

func (f *State) Merge(
	logger *logger.Logger,
	source string,
	selector string,
	flags map[string]model.Flag,
	metadata model.Metadata,
) (map[string]interface{}, bool)

Merge provided flags from source with currently stored flags. nolint: funlen

func (*State) SelectorForFlag added in v0.11.0

func (f *State) SelectorForFlag(_ context.Context, flag model.Flag) string

func (*State) Set added in v0.11.0

func (f *State) Set(key string, flag model.Flag)

func (*State) String added in v0.11.0

func (f *State) String() (string, error)

func (*State) Update added in v0.11.0

func (f *State) Update(logger *logger.Logger, source string, selector string, flags map[string]model.Flag,
) map[string]interface{}

Update existing flags from source.

Jump to

Keyboard shortcuts

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