store

package
v0.13.3 Latest Latest
Warning

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

Go to latest
Published: Feb 9, 2026 License: Apache-2.0 Imports: 12 Imported by: 6

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type FlagQueryResult added in v0.13.0

type FlagQueryResult struct {
	Flags []model.Flag
}

type IStore added in v0.9.0

type IStore interface {
	Get(ctx context.Context, key string, selector *Selector) (model.Flag, model.Metadata, error)
	GetAll(ctx context.Context, selector *Selector) ([]model.Flag, model.Metadata, error)
	Watch(ctx context.Context, selector *Selector, watcher chan<- FlagQueryResult)
	Update(source string, flags []model.Flag, metadata model.Metadata)
}

type Selector added in v0.13.0

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

A Selector represents a set of constraints used to query the store.

func NewSelector added in v0.13.0

func NewSelector(selectorExpression string) Selector

NewSelector creates a new Selector from a selector expression string. #1708 Until we decide on the Selector syntax, only a single key=value pair is supported For example, to select flags from source "./mySource" or flagSetId "1234", use the expressions: "source=./mySource" or "flagSetId=1234"

func (*Selector) IsEmpty added in v0.13.0

func (s *Selector) IsEmpty() bool

func (*Selector) ToLogString added in v0.13.3

func (s *Selector) ToLogString() string

func (*Selector) ToMetadata added in v0.13.0

func (s *Selector) ToMetadata() model.Metadata

ToMetadata converts the selector's internal map to metadata for logging or tracing purposes. Only includes known indices to avoid leaking sensitive information, and is usually returned as the "top level" metadata

func (Selector) ToQuery added in v0.13.0

func (s Selector) ToQuery() (indexId string, constraints []interface{})

ToQuery converts the Selector map to an indexId and constraints for querying the Store. For a given index, a specific order and number of constraints are required. Both the indexId and constraints are generated based on the keys present in the selector's internal map.

func (Selector) WithIndex added in v0.13.0

func (s Selector) WithIndex(key string, value string) Selector

WithIndex creates a new Selector from the current Selector and adds the given key-value-pair

type SelectorContextKey added in v0.13.0

type SelectorContextKey struct{}

type Store added in v0.13.0

type Store struct {

	// deprecated: has no effect and will be removed soon.
	FlagSources []string
	// contains filtered or unexported fields
}

func NewFlags deprecated

func NewFlags() *Store

Deprecated: use NewStore instead - will be removed very soon.

func NewStore added in v0.13.0

func NewStore(logger *logger.Logger, sources []string) (*Store, error)

NewStore creates a new in-memory store with the given sources. The order of sources in the slice determines their priority, when queries result in duplicate flags (queries without source or flagSetId), the higher priority source "wins".

func (*Store) Get added in v0.13.0

func (s *Store) Get(_ context.Context, key string, selector *Selector) (model.Flag, model.Metadata, error)

func (*Store) GetAll added in v0.13.0

func (s *Store) GetAll(ctx context.Context, selector *Selector) ([]model.Flag, model.Metadata, error)

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

func (*Store) Update added in v0.13.0

func (s *Store) Update(
	source string,
	flags []model.Flag,
	metadata model.Metadata,
)

Update the flag state with the provided flags.

func (*Store) Watch added in v0.13.0

func (s *Store) Watch(ctx context.Context, selector *Selector, watcher chan<- FlagQueryResult)

Watch the result-set of a selector for changes, sending updates to the watcher channel.

Jump to

Keyboard shortcuts

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