Class MinSurvivalConstraint

java.lang.Object
com.eqixiac.equinix.design.resilience.MinSurvivalConstraint
All Implemented Interfaces:
Constraint

public final class MinSurvivalConstraint extends Object implements Constraint
"min_survival": a portfolio must keep at least a minimum share of its baseline service through its worst single-element failure (see N1Survival). Opt-in: with no threshold the constraint passes everything without simulating.

The threshold, a percentage 0..100, comes from (first that is set wins): the constructor; the spec's constraints.minSurvivalPct; the spec label "design.min_survival_pct" (for example labels: {"design.min_survival_pct": "75"}). The label is the older, schema-free way to opt in and keeps working; when both are set the constraints.minSurvivalPct field wins. A malformed label fails every portfolio with a reason rather than being ignored. The Metro Optimizer adds this constraint itself when the spec sets constraints.minSurvivalPct, so the field never needs the ResiliencePlugin.

  • Field Details

  • Constructor Details

    • MinSurvivalConstraint

      public MinSurvivalConstraint()
      Reads the threshold from the spec (constraints.minSurvivalPct, else the label "design.min_survival_pct"); inert without either.
    • MinSurvivalConstraint

      public MinSurvivalConstraint(Double thresholdPct, ResilienceOptions options)
      Parameters:
      thresholdPct - the least share of service that must survive, 0..100; null to read the spec (constraints.minSurvivalPct, else the label "design.min_survival_pct")
      options - graph and simulation options
  • Method Details

    • id

      public String id()
      Specified by:
      id in interface Constraint
      Returns:
      a stable id, lower_snake_case (for example max_latency)
    • check

      public ConstraintVerdict check(MetroPortfolio portfolio, DesignContext context)
      Description copied from interface: Constraint
      Checks a whole portfolio.
      Specified by:
      check in interface Constraint
      Parameters:
      portfolio - the candidate design
      context - the facts of this run
      Returns:
      the verdict with its reason