AgentXM.Examples.TinyFlags.BooleanFlag (AgentXM Example TinyFlags v0.1.0)

Copy Markdown View Source

A feature flag whose treatment is true or false.

Construct one with new/1. Without :default the default is false. Without :rollout the default value is returned for every caller. With :rollout, the value flips to not default for the percentage of callers selected by deterministic bucketing on the caller id.

Summary

Types

An integer rollout percentage in the closed range 0..100.

t()

Functions

Construct a boolean flag.

Like new/1 but raises ArgumentError on invalid input.

Types

rollout()

@type rollout() :: 0..100 | nil

An integer rollout percentage in the closed range 0..100.

t()

@type t() :: %AgentXM.Examples.TinyFlags.BooleanFlag{
  default: boolean(),
  rollout: rollout()
}

Functions

new(opts \\ [])

@spec new(keyword()) :: {:ok, t()} | {:error, term()}

Construct a boolean flag.

Options:

  • :default — default value (defaults to false).
  • :rollout — integer percentage in 0..100. When set, the value flips to not default for that share of callers.

new!(opts \\ [])

@spec new!(keyword()) :: t()

Like new/1 but raises ArgumentError on invalid input.