pub enum ParameterScope {
Environment,
Cluster,
Replica,
}Expand description
The scope at which a synced parameter’s value may be overridden.
Every synced parameter declares its scope class as part of its definition.
The declaration is the single source of truth for which contexts the
LaunchDarkly sync loop evaluates and where the resolved value may be
overridden. See doc/developer/design/20260609_scoped_feature_flags.md.
Environment is the safe declaration, and the right one when in doubt. It
preserves the unscoped behavior of a single value everywhere. A finer scope
enables divergence, so declaring one asserts that divergence is both safe
and useful for this config. Getting that wrong introduces a way to break an
environment that did not previously exist, while erring toward
Environment only forgoes a capability. Prefer forgoing the capability.
Where a config is realized is therefore a necessary condition for a finer
scope, not a sufficient one. A config qualifies for Replica only if it is
realized per replica, and should be declared Replica only if it also
tunes that replica process’s own resource usage (memory, CPU, I/O,
concurrency, timing) and cannot change what a dataflow produces, what reaches
durable state, or anything externally visible. lgalloc, the memory limiter,
the spill and pager knobs, and the timely zero-copy settings are the shape to
match.
In particular, declare Environment for a flag selecting a different
implementation or code path whose output-equivalence is an assumption rather
than a guarantee. Where the assumption holds, Environment costs nothing.
Where it does not, a per-replica rollout turns one bug into query results
that differ by which replica served them.
Which contexts a config can be realized in:
- A config realized inside a
clusterdprocess is aReplicacandidate. That covers the compute and storage worker config sets andmz_metrics, which the per-replica dyncfg push reaches.environmentdmay read such a config too, for its own process. That read legitimately sees the environment-wide value. - A config that
environmentdresolves for one specific replica, whether it ships the value there or acts on it itself, is also a candidate. The read site has to resolve that replica’s override, either withConfig::get_with_overridesor from a per-replica config set. Without that, the override never takes effect and the declaration is a silent no-op. - A config realized in
environmentdwith no single replica in scope isEnvironment. So is everybalancerdconfig.balancerdsyncs LaunchDarkly itself, against abalancercontext keyed by cloud provider, region and build version, and has no environment, cluster or replica beneath it to target. - A config consumed at plan time, once per cluster, is
Cluster.
NOTE: a config whose value must agree across the replicas of one cluster
(because they render the same dataflow and their outputs are compared) is
Environment even when it is read on clusterd. Per-replica divergence in
how a dataflow is rendered is fine, in what it produces is not.
NOTE: persist configs are Environment as a class, even though the persist
client runs on clusterd and the per-replica push reaches its config set.
The same client code also runs in environmentd, and every copy of it acts
on shared durable state. A replica-scoped persist config could never reach
the environmentd client, so a rollout targeting replicas would leave a
shard’s other writer on the old value indefinitely. Environment is the
only scope covering every persist client in an environment.
Variants§
Environment
Environment-wide only; no cluster/replica overrides. The default, so all existing synced parameters are unchanged.
NOTE: this names the coarsest targeting granularity, not the
environmentd process. A config a process other than environmentd
resolves for itself, with nothing finer beneath it, is Environment.
Cluster
Cluster-coherent: env-wide base plus per-cluster overrides. Evaluated
with the cluster context (replica-free) and resolved at plan time via
OptimizerFeatureOverrides. e.g. optimizer features.
Replica
Replica-local: env-wide base plus per-replica / per-size-family
overrides. Evaluated with the replica context and resolved at the
controller’s per-replica dyncfg push. e.g. lgalloc, persist pager, LZ4.
Implementations§
Source§impl ParameterScope
impl ParameterScope
Sourcepub const DEFAULT: ParameterScope = ParameterScope::Environment
pub const DEFAULT: ParameterScope = ParameterScope::Environment
The scope applied to a parameter that does not declare one: environment-
wide, i.e. no cluster/replica overrides. A const so it can be used in
the const contexts (system-var constructors, the feature_flags!
macro) where Default::default is unavailable.
Trait Implementations§
Source§impl Clone for ParameterScope
impl Clone for ParameterScope
Source§fn clone(&self) -> ParameterScope
fn clone(&self) -> ParameterScope
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreimpl Copy for ParameterScope
Source§impl Debug for ParameterScope
impl Debug for ParameterScope
Source§impl Default for ParameterScope
impl Default for ParameterScope
impl Eq for ParameterScope
Source§impl PartialEq for ParameterScope
impl PartialEq for ParameterScope
impl StructuralPartialEq for ParameterScope
Auto Trait Implementations§
impl Freeze for ParameterScope
impl RefUnwindSafe for ParameterScope
impl Send for ParameterScope
impl Sync for ParameterScope
impl Unpin for ParameterScope
impl UnsafeUnpin for ParameterScope
impl UnwindSafe for ParameterScope
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.