Documentation
¶
Overview ¶
Package flags is the domain of what a project serves: flags with their definition and variations, their configuration in each environment, and the segments their rules target. Every rule spanning several of them, such as a variation not being removed while a configuration serves it, is a pure function over what the handler loaded under its project's row lock, so it holds for as long as that lock.
Index ¶
- Constants
- Variables
- func ErrInUse(refs []Reference) error
- func KillReason(reason *string) (string, error)
- type Changed
- type Condition
- type Configuration
- func (c Configuration) Apply(f Flag, proposed ConfigurationInput, r Referents, m Mint, w Write) (Configuration, Changed, error)
- func (c Configuration) ApplyDecision(experiment, winner string, w Write) (Configuration, Changed)
- func (c Configuration) Copy(f Flag, source Configuration, overrides bool, r Referents, w Write) (Configuration, Changed, error)
- func (c Configuration) Import(f Flag, in ConfigurationInput, r Referents, m Mint, w Write) (Configuration, Changed, error)
- func (c Configuration) Input() ConfigurationInput
- func (c Configuration) Kill(w Write) (Configuration, Changed)
- func (c Configuration) Proposable(in ConfigurationInput) ConfigurationInput
- func (c Configuration) Propose(f Flag, in ConfigurationInput, held []RuleInput, r Referents, m Mint) (Configuration, error)
- func (c Configuration) RegenerateSalt(rule RuleID, m Mint, w Write) (Configuration, Changed, error)
- func (c Configuration) RemoveOverride(unitType, unitID string, w Write) (Configuration, Changed, error)
- func (c Configuration) Replace(f Flag, in ConfigurationInput, r Referents, m Mint, w Write) (Configuration, Changed, error)
- func (c Configuration) Revert(f Flag, recorded Configuration, r Referents, w Write) (Configuration, Changed, error)
- func (c Configuration) SameRuleset(d Configuration) bool
- func (c Configuration) SetOverride(f Flag, o OverrideInput, d Declarations, w Write) (Configuration, Changed, error)
- type ConfigurationInput
- type Declarations
- type Dependent
- type EnvironmentConfiguration
- type ExperimentRef
- type ExperimentWeight
- type Flag
- type FlagChange
- type FlagID
- type FlagInput
- type Lifetime
- type Mint
- type OverdueExperiment
- type Override
- type OverrideInput
- type Owner
- type Prerequisite
- type Reference
- func DependentReferences(dependents []Dependent) []Reference
- func ExperimentArchiveReferences(experiments []ExperimentRef) []Reference
- func ExperimentVariationReferences(experiments []ExperimentRef, removed []string) []Reference
- func VariationReferences(f Flag, removed []string, configs []EnvironmentConfiguration, ...) []Reference
- type Referents
- type Requirements
- type Rule
- type RuleID
- type RuleInput
- type Segment
- type SegmentChange
- type SegmentID
- type SegmentInput
- type Serve
- type ServeInput
- type StaleFacts
- type StaleReason
- type Staleness
- type Type
- type Variation
- type VariationInput
- type Write
Constants ¶
const ( ConditionAttribute = eval.ConditionAttribute ConditionInSegment = eval.ConditionInSegment ConditionNotInSegment = eval.ConditionNotInSegment ConditionPrerequisite = eval.ConditionPrerequisite )
The condition kinds.
const ( ServeVariation = eval.ServeVariation ServeRollout = eval.ServeRollout ServeExperiment = eval.ServeExperiment )
The serve kinds.
const ( ExperimentDraft = "draft" ExperimentRunning = "running" )
The statuses of an experiment a rule or a flag is judged by.
const MaxUnitIDBytes = 256
MaxUnitIDBytes bounds a unit ID, in an override as in a context evaluated: SDKs hash it on every evaluation of a rollout.
const NotEvaluatedWindow = 30 * 24 * time.Hour
NotEvaluatedWindow is how long a flag no SDK evaluates stays fresh: a month covers the release cycles of the applications reading it, so code still deployed evaluates it within one.
Variables ¶
var ErrNoRule = apperrors.NotFound("not_found", "the configuration has no rule with this identifier")
ErrNoRule answers a rule the configuration does not have.
var StaleReasons = []StaleReason{ StaleLifetimeExceeded, StaleNotEvaluated, StaleOwnerInactive, StaleFinishedRollout, StaleExperimentOverdue, }
StaleReasons are every reason, in the order a flag's reasons are listed.
Functions ¶
func ErrInUse ¶
ErrInUse refuses a write that would leave refs naming nothing, listing them so the caller knows what to change first. A reference naming no one environment carries environment null, so a client tells "every environment" from an environment's key.
func KillReason ¶
KillReason returns the reason of a kill switch trimmed, "" for none, or invalid_configuration when it is over 2,000 characters.
Types ¶
type Changed ¶
type Changed struct {
// Any is false for a change to the values the entity already has,
// which is stored and recorded nowhere.
Any bool
// Ruleset reports a change to what a ruleset carries of the flag: its
// variations' keys, values and order, or automatic exposure.
Ruleset bool
// RemovedVariations are the keys of the variations the change removes,
// which nothing may still serve.
RemovedVariations []string
// Switched reports a change to a configuration whose only change to
// what a ruleset carries is switching the flag on or off.
Switched bool
}
Changed is what a change did.
type Condition ¶
type Condition struct {
Kind string
Attribute string
Op string
// Value is the condition's value as encoding/json decodes it: a string,
// a float64, a bool or a []any; nil when absent.
Value any
Segment string
Flag string
Variation string
}
Condition is one comparison inside a rule or a segment: an attribute, an operator and a value; membership in a segment; or a prerequisite. It is what a ruleset carries, so SDKs evaluate exactly what was validated.
type Configuration ¶
type Configuration struct {
Flag FlagID
Environment workspace.EnvironmentID
// On is false while the flag serves its off variation to everyone.
On bool
// OffVariation is the key of the variation served while the flag is
// off, and when a prerequisite fails.
OffVariation string
// Fallthrough is the key of the variation served when no rule matches.
Fallthrough string
// Prerequisites are the variations other flags must serve for this one
// to be evaluated at all.
Prerequisites []Prerequisite
Overrides []Override
// Rules are checked in order; the first whose conditions all hold
// serves.
Rules []Rule
UpdatedAt time.Time
// UpdatedBy is the member whose write made the configuration what it
// is; nil for a project token.
UpdatedBy *access.MemberID
// Version counts the configuration's accepted changes, from 1.
Version int64
}
Configuration is what one flag serves in one environment. Every flag has one in every environment of its project, each changing on its own.
func InitialConfiguration ¶
func InitialConfiguration(f Flag, environment workspace.EnvironmentID, by *access.MemberID, now time.Time) Configuration
InitialConfiguration returns the configuration f arrives with in environment, written by by at now: switched off, so creating a flag or an environment never changes what any application is served. A boolean flag serves false when off and true when on with no rule matching; another type its first variation either way.
func (Configuration) Apply ¶ added in v0.2.0
func (c Configuration) Apply(f Flag, proposed ConfigurationInput, r Referents, m Mint, w Write) (Configuration, Changed, error)
Apply returns the configuration of f replaced by proposed, the document a proposal holds, written by w, checked against r as a replace is, since what it names may be gone since it was proposed. The rules proposed keep the identifiers and salts the proposal was given, the new ones included: they are what was reviewed, so the units the reviewers saw fall in a rollout are the ones that do. m draws only for what proposed leaves without, which a proposal never does.
func (Configuration) ApplyDecision ¶ added in v0.2.0
func (c Configuration) ApplyDecision(experiment, winner string, w Write) (Configuration, Changed)
ApplyDecision returns the configuration whose rules serving the experiment keyed experiment were decided by its stop, by w, and what changed: each such rule serves winner instead, keeping its identifier, description, conditions and place, or is deleted when winner is "", so the flag goes on to its other rules. Every other rule stays as it is, and a configuration with no rule serving the experiment changes nothing.
func (Configuration) Copy ¶
func (c Configuration) Copy(f Flag, source Configuration, overrides bool, r Referents, w Write) (Configuration, Changed, error)
Copy returns the configuration of f made by w what source, f's configuration in another environment, serves: its rules with their identifiers and salts, so the same units fall in every rollout in both environments, its prerequisites and its off and fallthrough variations. It stays on or off as it is, so a copy never switches a flag on by accident, and keeps its overrides unless overrides asks for source's, notes and authors with them. It is checked against r, the requirements of c's environment, as a replace is, after being refused experiment_rules_changed when it would change which rules serve which experiment. A configuration is not copied from its own environment, which would change nothing on purpose.
func (Configuration) Import ¶ added in v0.3.0
func (c Configuration) Import(f Flag, in ConfigurationInput, r Referents, m Mint, w Write) (Configuration, Changed, error)
Import returns the configuration of f made by w what a project document says it is, whole, checked against r as a replace is. Unlike a replace it keeps what the document says of rule identifiers and rollout salts, which is what keeps a unit in its bucket in a copy of the project; a rule or a rollout the document gives none is given one by m. The document names no author of an override: one left as it was keeps its author, any other is the writer's.
func (Configuration) Input ¶ added in v0.2.0
func (c Configuration) Input() ConfigurationInput
Input returns c as a write gives it whole, every rule with its identifier, every rollout with its salt and every experiment serve with its experiment.
func (Configuration) Kill ¶
func (c Configuration) Kill(w Write) (Configuration, Changed)
Kill returns the configuration switched off by w, serving its off variation to everyone, and what changed: switching off a configuration that is off changes nothing.
func (Configuration) Proposable ¶ added in v0.2.0
func (c Configuration) Proposable(in ConfigurationInput) ConfigurationInput
Proposable returns in with what only c may hold left out: a rule identifier c has no rule with, and a salt that is not the salt of c's rule the rule names. A proposal is written against the configuration of its time and kept while others are written, and it may come from elsewhere (another environment, an earlier proposal of whose new rules the server named provisionally): what it names of a configuration that is not c's is not c's to keep. The rule becomes a new one and the rollout is given a salt of its own, instead of the proposal being refused for naming what c never had.
func (Configuration) Propose ¶ added in v0.2.0
func (c Configuration) Propose(f Flag, in ConfigurationInput, held []RuleInput, r Referents, m Mint) (Configuration, error)
Propose returns what replacing c with in would leave, checked as Replace checks it, once what neither c nor held may hold is left out of in, as Proposable leaves it out. held are the rules of the proposal in revises, nil for a new one: the server named its new rules and gave its new rollouts salts when it was made, and they are the proposal's until it is applied, so a rule keeps them while the proposal is edited. Otherwise sending back a proposal as it was answered would make every new rule new again, and a rollout grown in an edit would move units out.
func (Configuration) RegenerateSalt ¶
func (c Configuration) RegenerateSalt(rule RuleID, m Mint, w Write) (Configuration, Changed, error)
RegenerateSalt returns the configuration whose rule keyed rule serves its rollout with a new salt from m, set by w, and what changed: units are bucketed afresh, so some in the rollout fall out and others come in. not_found for a rule it does not have, not_a_rollout for a rule serving no rollout.
func (Configuration) RemoveOverride ¶
func (c Configuration) RemoveOverride(unitType, unitID string, w Write) (Configuration, Changed, error)
RemoveOverride returns the configuration without the override of the unit of unitType with unitID, removed by w, and what changed; not_found when it has none.
func (Configuration) Replace ¶
func (c Configuration) Replace(f Flag, in ConfigurationInput, r Referents, m Mint, w Write) (Configuration, Changed, error)
Replace returns the configuration of f replaced by in, checked against r, its version incremented when anything changed, and what changed; or invalid_configuration with every field to fix. A rule keeps its identifier and, while it stays a rollout, its salt; an override left as it was keeps its author.
func (Configuration) Revert ¶
func (c Configuration) Revert(f Flag, recorded Configuration, r Referents, w Write) (Configuration, Changed, error)
Revert returns the configuration of f made recorded again by w, the document an earlier version of it was, whole: rule identifiers and salts, so the same units fall in every rollout again, and override notes and authors as they were. It is refused experiment_rules_changed when it would change which rules serve which experiment, then checked against r as a replace is, since a variation, segment, declaration or flag it names may be gone since.
func (Configuration) SameRuleset ¶
func (c Configuration) SameRuleset(d Configuration) bool
SameRuleset reports whether c and d carry the same ruleset: on or off, the off and fallthrough variations, the prerequisites, the overrides by unit type, unit ID and variation, and the rules with their identifiers, conditions and serves, salts included, each in order. Rule descriptions and override notes and authors stay on the server, and the version and who made it describe the write rather than what SDKs receive, so none of them counts. Whether a write changed what an environment's SDKs receive, and whether two environments differ for a flag, are judged by it alike.
func (Configuration) SetOverride ¶
func (c Configuration) SetOverride(f Flag, o OverrideInput, d Declarations, w Write) (Configuration, Changed, error)
SetOverride returns the configuration of f with o set by w, checked against d, and what changed; or invalid_configuration with every field to fix. An override of the same unit is replaced in place, variation and note together, and is then w's; another is added, up to 200.
type ConfigurationInput ¶
type ConfigurationInput struct {
On bool
OffVariation, Fallthrough string
Prerequisites []Prerequisite
Overrides []OverrideInput
Rules []RuleInput
}
ConfigurationInput is a configuration as a write gives it whole.
type Declarations ¶
type Declarations struct {
// contains filtered or unexported fields
}
Declarations are what a project's conditions may name: its attributes by type, and its unit types, each working as a string attribute holding that unit's ID.
func NewDeclarations ¶
func NewDeclarations(units []workspace.UnitType, attributes []workspace.Attribute) Declarations
NewDeclarations returns the declarations of a project with units and attributes.
type Dependent ¶
type Dependent struct {
// Flag is the key of the requiring flag.
Flag string
// Environment is the key of the environment it requires it in.
Environment string
// Variation is the key of the variation it requires.
Variation string
}
Dependent is a flag whose configuration in one environment requires a variation of another flag, as a prerequisite or in a rule's condition.
type EnvironmentConfiguration ¶
type EnvironmentConfiguration struct {
Environment string
Configuration Configuration
}
EnvironmentConfiguration is a flag's configuration with the key of its environment, by which a reference names it.
type ExperimentRef ¶ added in v0.2.0
type ExperimentRef struct {
Key string
// Flag is the flag the experiment compares variations of.
Flag FlagID
// Status is draft, running, stopped or archived.
Status string
// UnitType is the unit type whose units the experiment splits.
UnitType string
// InclusionSalt and VariationSalt are the experiment's public salts.
InclusionSalt, VariationSalt string
// TrafficAllocation is the share of units included, in basis points.
TrafficAllocation int
// Weights are the variations the experiment lists with their shares in
// basis points, in the order that fixes the cumulative bucket ranges.
Weights []ExperimentWeight
}
ExperimentRef is an experiment as a rule may name it, and as a flag's archival and variations are judged against it.
type ExperimentWeight ¶ added in v0.2.0
ExperimentWeight is one variation's share of an experiment's allocated traffic, in basis points.
type Flag ¶
type Flag struct {
ID FlagID
Project workspace.ProjectID
// Key names the flag in code and never changes; unique, case
// sensitively, in its project.
Key string
// Type never changes either: code reads the flag's value as it.
Type Type
Name string
Description string
Owner access.MemberID
Tags []string
Lifetime Lifetime
// ExpectedRemovalAt is set for a temporary flag only.
ExpectedRemovalAt *time.Time
// AutomaticExposure makes SDKs record an exposure after every evaluation
// whose result carries an experiment.
AutomaticExposure bool
Variations []Variation
// ArchivedAt is set while the flag is archived: hidden from SDKs and
// kept until deleted.
ArchivedAt *time.Time
// CreatedBy is the member who created the flag; nil for a project token.
CreatedBy *access.MemberID
CreatedAt time.Time
UpdatedAt time.Time
// Version counts the definition's accepted changes, from 1.
Version int64
}
Flag is a flag's definition: what it is in every environment at once.
func (Flag) Archive ¶
Archive returns the flag archived at now, hidden from SDKs in every environment, and whether it changed: archiving an archived flag does not.
func (Flag) CanConfigure ¶
CanConfigure refuses to write a configuration of f while it is archived.
func (Flag) Change ¶
Change returns the flag with ch applied at now, its version incremented when anything changed, and what changed. The owner is judged only when the change names a new one: ownership is never checked afterwards, so a member losing their grants never blocks a change to their flags.
type FlagChange ¶
type FlagChange struct {
// Key and Type are refused whatever their value: code reading the flag
// relies on both.
Key *string
Type *Type
Name *string
Description *string
Owner *Owner
Tags *[]string
Lifetime *Lifetime
ExpectedRemovalAt *time.Time
AutomaticExposure *bool
Variations *[]VariationInput
}
FlagChange is a change to a flag's definition; a nil field is left as it is.
type FlagInput ¶
type FlagInput struct {
ID FlagID
Project workspace.ProjectID
Key string
Type Type
Name string
Description string
Owner Owner
Tags []string
// Lifetime is temporary when empty.
Lifetime Lifetime
ExpectedRemovalAt *time.Time
AutomaticExposure bool
Variations *[]VariationInput
CreatedBy *access.MemberID
Now time.Time
}
FlagInput is what a flag is created with. A nil Variations gives a boolean flag its two; every other type needs them listed.
type Mint ¶
Mint draws what a write gives what it creates: a new rule's identifier, and a new rollout's salt. The handler supplies both, since drawing either is not a rule of the domain.
type OverdueExperiment ¶ added in v0.2.0
type OverdueExperiment struct {
Key string
// ExpectedEndAt is a calendar day, in UTC at midnight.
ExpectedEndAt time.Time
}
OverdueExperiment is a running experiment on a flag, past its expected end.
type Override ¶
type Override struct {
UnitType, UnitID, Variation string
// Note says why, "" for nothing. It and AddedBy stay on the server: no
// ruleset carries either.
Note string
// AddedBy is the member who last wrote the override; nil for a project
// token.
AddedBy *access.MemberID
}
Override pins a variation for one unit.
type OverrideInput ¶
OverrideInput is an override as a write gives it: a note that may be absent, and no author, who is the writer.
type Owner ¶
Owner is the member a write names as a flag's owner, and whether they may own one: an active member holding a grant in the project, or an instance admin. The handler finds that out; the flag only refuses one who may not.
type Prerequisite ¶
type Prerequisite struct {
Flag, Variation string
}
Prerequisite requires the flag keyed Flag to serve its variation keyed Variation to the same context.
type Reference ¶
type Reference struct {
// Kind is the kind of what names it, such as flag or segment.
Kind string
// Key is its key.
Key string
// Environment is the key of the environment it names it in, "" when it
// names it in every environment, as a segment does.
Environment string
}
Reference is something that names an entity a write would remove or hide, such as a flag's configuration in one environment serving a variation.
func DependentReferences ¶
DependentReferences returns the flags in dependents, one reference per flag and environment in the order of dependents: what archiving the flag they require would leave requiring a flag no SDK receives.
func ExperimentArchiveReferences ¶ added in v0.2.0
func ExperimentArchiveReferences(experiments []ExperimentRef) []Reference
ExperimentArchiveReferences returns the draft and running experiments in experiments: archiving their flag would leave them comparing variations of a flag no SDK receives.
func ExperimentVariationReferences ¶ added in v0.2.0
func ExperimentVariationReferences(experiments []ExperimentRef, removed []string) []Reference
ExperimentVariationReferences returns the experiments in experiments that list one of the variations in removed, whatever their status: an experiment's weights and the exposures counted for them mean nothing without the variation.
func VariationReferences ¶
func VariationReferences(f Flag, removed []string, configs []EnvironmentConfiguration, dependents []Dependent) []Reference
VariationReferences returns what still names one of the variations of f in removed: f's configurations in configs naming it, one reference per environment in the order of configs, then the flags in dependents requiring it, one per flag and environment in the order of dependents.
type Referents ¶
type Referents struct {
Flags []Flag
Segments []string
Declarations Declarations
Requirements Requirements
// Experiments are the project's experiments, whatever their status.
Experiments []ExperimentRef
}
Referents are what a configuration may name, as the handler loaded them under its project's row lock: every flag of the project, archived ones and the configured one included, the keys of its segments, its declarations, and the requirements between flags in the configuration's environment.
type Requirements ¶
Requirements are, by flag key, the keys of the flags each flag's configuration in one environment requires, through its prerequisites and its rules' prerequisite conditions, archived flags included: an archived flag can be restored, and its chains with it.
type Rule ¶
type Rule struct {
ID RuleID
// Description stays on the server: no ruleset carries it.
Description string
Conditions []Condition
Serve Serve
}
Rule is one ordered set of conditions, all of which a context meets for the rule to serve it.
type RuleInput ¶
type RuleInput struct {
ID *RuleID
Description string
Conditions []Condition
Serve ServeInput
}
RuleInput is a rule as a write gives it: with the identifier of the rule of the current configuration it is, nil for a new rule.
type Segment ¶
type Segment struct {
ID SegmentID
Project workspace.ProjectID
// Key names the segment in rules and never changes.
Key string
Name string
Description string
// Private keeps the segment's conditions on the server: only
// server-side evaluation may use it.
Private bool
Conditions []Condition
CreatedAt time.Time
UpdatedAt time.Time
// Version counts the segment's accepted changes, from 1.
Version int64
}
Segment is a reusable, named set of attribute conditions, all of which a context meets to be in it.
func NewSegment ¶
func NewSegment(in SegmentInput) (Segment, error)
NewSegment returns the segment in, at version 1, or invalid_segment with every field to fix.
func (Segment) Change ¶
func (s Segment) Change(ch SegmentChange, d Declarations, now time.Time) (Segment, Changed, error)
Change returns the segment with ch applied at now, its conditions checked against d, its version incremented when anything changed, and what changed: a change to its conditions or to private changes what every ruleset carries of it.
type SegmentChange ¶
type SegmentChange struct {
// Key is refused whatever its value: rules name the segment by it.
Key *string
Name *string
Description *string
Private *bool
Conditions *[]Condition
}
SegmentChange is a change to a segment; a nil field is left as it is.
type SegmentInput ¶
type SegmentInput struct {
ID SegmentID
Project workspace.ProjectID
Key string
Name, Description string
Private bool
Conditions []Condition
Declarations Declarations
Now time.Time
}
SegmentInput is what a segment is created with, and the declarations of its project its conditions are checked against.
type Serve ¶
type Serve struct {
Kind string
Variation string
// Experiment is the key of the experiment an experiment serve names.
Experiment string
// UnitType, Percentage and Salt are a rollout's: the unit type whose
// units are bucketed, the share served in basis points, and the salt
// mixed into each unit's bucket.
UnitType string
Percentage int
Salt string
}
Serve is what a rule serves: a variation, a rollout of one variation to a share of one unit type's units, the others continuing to the next rule, or an experiment of the flag.
type ServeInput ¶
ServeInput is a serve as a write gives it. Percentage is nil when absent; Salt is "" when absent, since only the server mints one.
type StaleFacts ¶ added in v0.2.0
type StaleFacts struct {
Flag Flag
// Configurations are the flag's configurations in every environment of
// its project.
Configurations []Configuration
// LastEvaluatedAt is the latest an SDK evaluated the flag in any
// environment, by its summaries and exposures; nil for never.
LastEvaluatedAt *time.Time
// LastSummaryDay is the latest UTC day the flag's project received an
// SDK's evaluation summary, nil for never.
LastSummaryDay *time.Time
// OwnerActive is whether the flag's owner may still own it.
OwnerActive bool
// OverdueExperiments are the running experiments on the flag past
// their expected end.
OverdueExperiments []OverdueExperiment
}
StaleFacts are what a flag is judged stale from.
type StaleReason ¶ added in v0.2.0
type StaleReason string
StaleReason is why a flag is stale.
const ( // StaleLifetimeExceeded is a temporary flag past its expected removal. StaleLifetimeExceeded StaleReason = "lifetime_exceeded" // StaleNotEvaluated is a flag no SDK evaluated within // NotEvaluatedWindow in any environment. StaleNotEvaluated StaleReason = "not_evaluated" // StaleOwnerInactive is a flag whose owner may no longer own it: // nobody is left to ask before deleting it. StaleOwnerInactive StaleReason = "owner_inactive" // StaleFinishedRollout is a flag serving the same variation to // everyone in every environment: its code can keep that one branch. StaleFinishedRollout StaleReason = "finished_rollout" // StaleExperimentOverdue is a flag a running experiment past its // expected end compares the variations of. StaleExperimentOverdue StaleReason = "experiment_overdue" )
The reasons a flag is stale.
type Staleness ¶ added in v0.2.0
type Staleness struct {
// Reasons are why the flag is stale, in StaleReasons' order; empty for
// a flag that is not.
Reasons []StaleReason
// Experiment is the overdue experiment named with
// StaleExperimentOverdue, nil without that reason.
Experiment *OverdueExperiment
}
Staleness is a flag judged stale or not.
func JudgeStale ¶ added in v0.2.0
func JudgeStale(f StaleFacts, now time.Time) Staleness
JudgeStale returns why the flag of f is stale at now. An archived flag never is: it is already out of every ruleset, on its way out.
type Type ¶
type Type string
Type is the kind of value a flag serves.
type Variation ¶
type Variation struct {
Key string
// Value is compact JSON of the flag's type.
Value json.RawMessage
Name string
Description string
}
Variation is one of the values a flag can serve.
type VariationInput ¶
type VariationInput struct {
Key string
Value json.RawMessage
Name, Description *string
}
VariationInput is a variation as a write gives it: a value as JSON, nil when absent, and a name and description that may be absent.