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) 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) FlagByKey(ctx context.Context, project workspace.ProjectID, key string) (flags.Flag, error)
- func (s *Store) Flags(ctx context.Context, q appflags.FlagQuery, ...) error
- func (s *Store) LockProject(ctx context.Context, project workspace.ProjectID) 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) SegmentByKey(ctx context.Context, project workspace.ProjectID, key string) (flags.Segment, 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) 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) 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. 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 and segments name it: 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) 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) 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) LockProject ¶
LockProject locks project's row for the unit of work, or answers appflags.ErrNotFound when there is none.
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) 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) 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) UpdateConfiguration ¶
UpdateConfiguration stores c's changes.
func (*Store) UpdateFlag ¶
UpdateFlag stores f's definition.