Documentation
¶
Index ¶
- type FlagQueryResult
- type IStore
- type Selector
- type SelectorContextKey
- type Store
- func (s *Store) Get(_ context.Context, key string, selector *Selector) (model.Flag, model.Metadata, error)
- func (s *Store) GetAll(ctx context.Context, selector *Selector) ([]model.Flag, model.Metadata, error)
- func (s *Store) Update(source string, flags []model.Flag, metadata model.Metadata)
- func (s *Store) Watch(ctx context.Context, selector *Selector, watcher chan<- FlagQueryResult)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type FlagQueryResult ¶ added in v0.13.0
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
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) ToLogString ¶ added in v0.13.3
func (*Selector) ToMetadata ¶ added in v0.13.0
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
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.
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 NewStore ¶ added in v0.13.0
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) 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)