Documentation
¶
Overview ¶
Package flags is the PostgreSQL repository of the flags context: flags, their configuration in each environment, and segments.
Index ¶
- type Store
- func (s *Store) Configuration(ctx context.Context, flag flags.FlagID, environment string) (flags.EnvironmentConfiguration, error)
- func (s *Store) Configurations(ctx context.Context, flag flags.FlagID) ([]flags.EnvironmentConfiguration, error)
- func (s *Store) CountFlags(ctx context.Context, project workspace.ProjectID) (int, error)
- func (s *Store) CountSegments(ctx context.Context, project workspace.ProjectID) (int, error)
- func (s *Store) CreateConfigurations(ctx context.Context, cs []flags.Configuration) error
- func (s *Store) CreateFlag(ctx context.Context, f flags.Flag) error
- func (s *Store) CreateSegment(ctx context.Context, seg flags.Segment) error
- func (s *Store) DeclarationReferences(ctx context.Context, project workspace.ProjectID, key string) ([]flags.Reference, error)
- func (s *Store) DeclarationUsageCounts(ctx context.Context, project workspace.ProjectID) (map[string]int, error)
- func (s *Store) DeleteFlag(ctx context.Context, flag flags.FlagID) error
- func (s *Store) DeleteSegment(ctx context.Context, segment flags.SegmentID) error
- func (s *Store) Dependents(ctx context.Context, project workspace.ProjectID, flag string) ([]flags.Dependent, error)
- func (s *Store) EnvironmentConfigurations(ctx context.Context, environment workspace.EnvironmentID) ([]flags.Configuration, error)
- func (s *Store) ExperimentFlag(ctx context.Context, project workspace.ProjectID, key string) (experiments.FlagFacts, error)
- func (s *Store) FlagByKey(ctx context.Context, project workspace.ProjectID, key string) (flags.Flag, error)
- func (s *Store) FlagExperiments(ctx context.Context, flag flags.FlagID) ([]flags.ExperimentRef, error)
- func (s *Store) Flags(ctx context.Context, q appflags.FlagQuery, ...) error
- func (s *Store) HoldingConfigurations(ctx context.Context, project workspace.ProjectID, key string) ([]flags.Reference, error)
- func (s *Store) HoldingEnvironments(ctx context.Context, project workspace.ProjectID, key string) ([]workspace.EnvironmentID, error)
- func (s *Store) LockProject(ctx context.Context, project workspace.ProjectID) error
- func (s *Store) ProjectConfigurations(ctx context.Context, project workspace.ProjectID) (map[flags.FlagID][]flags.EnvironmentConfiguration, error)
- func (s *Store) ProjectExperiments(ctx context.Context, project workspace.ProjectID) ([]flags.ExperimentRef, error)
- func (s *Store) ProjectFlags(ctx context.Context, project workspace.ProjectID) ([]flags.Flag, error)
- func (s *Store) Requirements(ctx context.Context, environment workspace.EnvironmentID) (flags.Requirements, error)
- func (s *Store) RolloutSalts(ctx context.Context, project workspace.ProjectID) ([]string, error)
- func (s *Store) SegmentByKey(ctx context.Context, project workspace.ProjectID, key string) (flags.Segment, error)
- func (s *Store) SegmentReferrers(ctx context.Context, project workspace.ProjectID, key string) ([]flags.FlagID, error)
- func (s *Store) SegmentUsageCounts(ctx context.Context, project workspace.ProjectID) (map[string]int, error)
- func (s *Store) SegmentUsages(ctx context.Context, project workspace.ProjectID, key string) ([]flags.Reference, error)
- func (s *Store) Segments(ctx context.Context, project workspace.ProjectID) ([]flags.Segment, error)
- func (s *Store) UnarchivedFlags(ctx context.Context, project workspace.ProjectID, after string, limit int) ([]appflags.FlagView, error)
- func (s *Store) UpdateConfiguration(ctx context.Context, c flags.Configuration) error
- func (s *Store) UpdateFlag(ctx context.Context, f flags.Flag) error
- func (s *Store) UpdateSegment(ctx context.Context, seg flags.Segment) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Store ¶
type Store struct {
// contains filtered or unexported fields
}
Store is the repository of flags, configurations and segments.
func (*Store) Configuration ¶
func (s *Store) Configuration(ctx context.Context, flag flags.FlagID, environment string) (flags.EnvironmentConfiguration, error)
Configuration returns flag's configuration in the environment keyed environment, or appflags.ErrNotFound when its project has no such environment.
func (*Store) Configurations ¶
func (s *Store) Configurations(ctx context.Context, flag flags.FlagID) ([]flags.EnvironmentConfiguration, error)
Configurations returns flag's configuration in every environment, by the environments' order.
func (*Store) CountFlags ¶ added in v0.5.0
CountFlags returns how many flags project holds, archived ones included.
func (*Store) CountSegments ¶ added in v0.5.0
CountSegments returns how many segments project holds.
func (*Store) CreateConfigurations ¶
CreateConfigurations stores cs.
func (*Store) CreateFlag ¶
CreateFlag stores f.
func (*Store) CreateSegment ¶
CreateSegment stores s.
func (*Store) DeclarationReferences ¶
func (s *Store) DeclarationReferences(ctx context.Context, project workspace.ProjectID, key string) ([]flags.Reference, error)
DeclarationReferences returns what in project names the unit type or attribute keyed key: the segments whose conditions name it, by key, then one reference per flag and environment whose configuration names it in a rule's condition, a rollout or an override, archived flags included, by flag key and then environment order, then the draft and running experiments assigning units of it, by key: an experiment starts, and goes on assigning, only under a unit type the ruleset declares. A unit type and an attribute never share a key, so the key alone says which is meant, and a unit type is named as an attribute too, holding the unit's ID. Containment of the key finds every kind through the GIN indexes on segments' conditions and configurations' documents.
func (*Store) DeclarationUsageCounts ¶
func (s *Store) DeclarationUsageCounts(ctx context.Context, project workspace.ProjectID) (map[string]int, error)
DeclarationUsageCounts returns, by the key of each unit type or attribute of project something names, how many flags, segments and experiments name it: an experiment once, while it is a draft or running, the same as the delete guard holds a unit type; a flag, archived ones included, once whatever its environments and however many rules, rollouts and overrides name it there, as DeclarationReferences finds them; a segment once however many of its conditions do. One query answers every declaration of the project.
func (*Store) DeleteFlag ¶
DeleteFlag deletes the flag with its configurations.
func (*Store) DeleteSegment ¶
DeleteSegment deletes the segment.
func (*Store) Dependents ¶
func (s *Store) Dependents(ctx context.Context, project workspace.ProjectID, flag string) ([]flags.Dependent, error)
Dependents returns every flag of project whose configuration in an environment requires a variation of the flag keyed flag, archived flags included, once per variation, by flag key, then environment order, then variation. Containment of the flag key finds both kinds of requirement through the configurations' GIN index.
func (*Store) EnvironmentConfigurations ¶
func (s *Store) EnvironmentConfigurations(ctx context.Context, environment workspace.EnvironmentID) ([]flags.Configuration, error)
EnvironmentConfigurations returns the configuration of every flag of environment's project there, archived flags included.
func (*Store) ExperimentFlag ¶ added in v0.2.0
func (s *Store) ExperimentFlag(ctx context.Context, project workspace.ProjectID, key string) (experiments.FlagFacts, error)
ExperimentFlag returns the facts about project's flag with key that an experiment is judged against, or appexperiments.ErrNotFound.
func (*Store) FlagByKey ¶
func (s *Store) FlagByKey(ctx context.Context, project workspace.ProjectID, key string) (flags.Flag, error)
FlagByKey returns project's flag with key, or appflags.ErrNotFound.
func (*Store) FlagExperiments ¶ added in v0.2.0
func (s *Store) FlagExperiments(ctx context.Context, flag flags.FlagID) ([]flags.ExperimentRef, error)
FlagExperiments returns the experiments of flag, whatever their status, by key in byte order.
func (*Store) Flags ¶
func (s *Store) Flags(ctx context.Context, q appflags.FlagQuery, each func(appflags.QueriedFlag) bool) error
Flags calls each with the flags q lists, in q's order, each with its state in every environment and, when q compares two environments, its configurations in both, until each answers false or the flags run out, all in one query. A comparison reads only the flags whose two documents differ: equal documents carry the same ruleset, and what else differs is judged by the caller.
func (*Store) HoldingConfigurations ¶ added in v0.4.0
func (s *Store) HoldingConfigurations(ctx context.Context, project workspace.ProjectID, key string) ([]flags.Reference, error)
HoldingConfigurations returns the configurations of project, one per flag and environment, that have a rule serving the experiment keyed key, as references ordered by flag key, then by the environments' order.
func (*Store) HoldingEnvironments ¶ added in v0.2.0
func (s *Store) HoldingEnvironments(ctx context.Context, project workspace.ProjectID, key string) ([]workspace.EnvironmentID, error)
HoldingEnvironments returns the environments of project whose configuration of some flag has a rule serving the experiment keyed key, each once.
func (*Store) LockProject ¶
LockProject locks project's row for the unit of work, or answers appflags.ErrNotFound when there is none.
func (*Store) ProjectConfigurations ¶ added in v0.3.0
func (s *Store) ProjectConfigurations(ctx context.Context, project workspace.ProjectID) (map[flags.FlagID][]flags.EnvironmentConfiguration, error)
ProjectConfigurations returns the configuration of every flag of project in every environment, by flag, each flag's by the environments' order, all in one query.
func (*Store) ProjectExperiments ¶ added in v0.2.0
func (s *Store) ProjectExperiments(ctx context.Context, project workspace.ProjectID) ([]flags.ExperimentRef, error)
ProjectExperiments returns every experiment of project, whatever its status, by key in byte order.
func (*Store) ProjectFlags ¶
func (s *Store) ProjectFlags(ctx context.Context, project workspace.ProjectID) ([]flags.Flag, error)
ProjectFlags returns every flag of project, archived ones included.
func (*Store) Requirements ¶
func (s *Store) Requirements(ctx context.Context, environment workspace.EnvironmentID) (flags.Requirements, error)
Requirements returns, by flag key, the keys of the flags each flag's configuration in environment requires, through its prerequisites and its rules' prerequisite conditions, archived flags included, each in byte order and once.
func (*Store) RolloutSalts ¶ added in v0.2.0
RolloutSalts returns the salt of every rollout in every flag configuration of project, archived flags included: an archived flag can be restored, and its rollouts with it.
func (*Store) SegmentByKey ¶
func (s *Store) SegmentByKey(ctx context.Context, project workspace.ProjectID, key string) (flags.Segment, error)
SegmentByKey returns project's segment with key, or appflags.ErrNotFound.
func (*Store) SegmentReferrers ¶ added in v0.2.0
func (s *Store) SegmentReferrers(ctx context.Context, project workspace.ProjectID, key string) ([]flags.FlagID, error)
SegmentReferrers returns the flags of project whose rules have a condition naming the segment key in some environment, archived flags included, by identifier, each once.
func (*Store) SegmentUsageCounts ¶
func (s *Store) SegmentUsageCounts(ctx context.Context, project workspace.ProjectID) (map[string]int, error)
SegmentUsageCounts returns, by the key of each segment of project a rule names, how many flags' rules name it, archived flags included, each flag once whatever its environments, as SegmentUsages finds them. One query answers every segment of the project.
func (*Store) SegmentUsages ¶
func (s *Store) SegmentUsages(ctx context.Context, project workspace.ProjectID, key string) ([]flags.Reference, error)
SegmentUsages returns one reference per flag and environment of project whose rules have a condition naming the segment key, archived flags included, by flag key and then environment order. Only a segment condition names a segment, so containment of the key alone finds both kinds, through the configurations' GIN index.
func (*Store) UnarchivedFlags ¶ added in v0.2.0
func (s *Store) UnarchivedFlags(ctx context.Context, project workspace.ProjectID, after string, limit int) ([]appflags.FlagView, error)
UnarchivedFlags returns up to limit of project's flags that are not archived, each with its configuration in every environment by the environments' order, by key in byte order, those whose key is greater than after when it is not "": two queries whatever the limit.
func (*Store) UpdateConfiguration ¶
UpdateConfiguration stores c's changes.
func (*Store) UpdateFlag ¶
UpdateFlag stores f's definition.