Class DesignDecisionRecorder

java.lang.Object
com.eqixiac.equinix.design.record.DesignDecisionRecorder

public final class DesignDecisionRecorder extends Object
Produces a DesignDecisionRecord: runs the engines for a spec (Metro Optimizer, then resilience analysis, then the growth and value models where the spec gives enough input, then a deployment plan) and records their results section by section.
DesignDecisionRecord adr = DesignDecisionRecorder.forSpec(fabric, spec)
    .optimization(alreadyComputed)          // optional: reuse a result for this spec
    .record();

Read-only: it never creates, changes or deletes anything. With forSpec(FabricGateway, DesignSpec) the catalogue is read once and shared by every engine, and one rate card (RateCard.standardChain(fabric) unless rateCard(RateCard) is given) prices the optimisation, the term view, the value view and the plan, so a price is looked up once. forContext(CatalogDesignContext) runs over facts already held, with no network unless the rate card reaches it.

A supplied result computed for another spec (a different fingerprint()) is rejected. A section whose engine fails, or whose inputs are absent, is recorded as failed or skipped with the reason; the record is always produced.

  • Field Details

  • Method Details

    • forSpec

      public static DesignDecisionRecorder forSpec(FabricGateway fabric, DesignSpec spec)
      Records a spec against live Fabric data (read-only: catalogue reads and price searches).
      Parameters:
      fabric - the Fabric API
      spec - the design
      Returns:
      a recorder to configure and record()
    • forContext

      public static DesignDecisionRecorder forContext(CatalogDesignContext context)
      Records over facts already gathered (offline what-ifs, tests, a cached catalogue). Prices come from the context's cost model, or from rateCard(RateCard); the term, value and plan views need a rate card.
      Parameters:
      context - the facts; its spec is the design
      Returns:
      a recorder to configure and record()
    • rateCard

      public DesignDecisionRecorder rateCard(RateCard card)
      Parameters:
      card - the rate card every engine prices with; default RateCard.standardChain(fabric) for forSpec(FabricGateway, DesignSpec), none for forContext(CatalogDesignContext) (the context's cost model prices the optimisation)
      Returns:
      this recorder
    • currencyConverter

      public DesignDecisionRecorder currencyConverter(CurrencyConverter converter)
      Parameters:
      converter - exchange rates ranked below rates pinned in the spec and above the default sources
      Returns:
      this recorder
    • defaultRates

      public DesignDecisionRecorder defaultRates(CurrencyConverter defaults)
      Parameters:
      defaults - replaces the default rate sources (live ECB rates, then the bundled table), for example CurrencyConverters.bundledOnly() offline
      Returns:
      this recorder
    • optimization

      public DesignDecisionRecorder optimization(OptimizationResult result)
      Uses an optimisation already computed for this spec instead of running the optimiser.
      Parameters:
      result - the result
      Returns:
      this recorder
      Throws:
      IllegalArgumentException - when the result was computed for another spec
    • resilience

      public DesignDecisionRecorder resilience(ResilienceReport report)
      Uses a resilience analysis already computed for this spec.
      Parameters:
      report - the report
      Returns:
      this recorder
      Throws:
      IllegalArgumentException - when the report was computed for another spec
    • plan

      public DesignDecisionRecorder plan(DeploymentPlan deploymentPlan)
      Uses a deployment plan instead of building one. A plan that carries no spec fingerprint is accepted, and the record says so.
      Parameters:
      deploymentPlan - the plan
      Returns:
      this recorder
      Throws:
      IllegalArgumentException - when the plan was built for another spec
    • estate

      public DesignDecisionRecorder estate(EstateReport report)
      Adds an analysis of the existing estate: its findings join the record's risks and its headline joins the context. An estate report is not derived from a spec, so it carries no fingerprint to check.
      Parameters:
      report - the estate report
      Returns:
      this recorder
    • peering

      Adds a peering analysis: its presence is drawn into the resilience graph and its summary joins the context. A result that carries no spec fingerprint is accepted, and the record says so.
      Parameters:
      result - the peering analysis
      Returns:
      this recorder
      Throws:
      IllegalArgumentException - when the analysis was run for another spec
    • resilienceOptions

      public DesignDecisionRecorder resilienceOptions(ResilienceOptions options)
      Parameters:
      options - graph and simulation options for the resilience analysis
      Returns:
      this recorder
    • buildPlan

      public DesignDecisionRecorder buildPlan(boolean build)
      Parameters:
      build - whether to build a deployment plan from the recommendation when none is supplied (default true; the plan is built offline, without deployment inputs or live validation)
      Returns:
      this recorder
    • status

      public DesignDecisionRecorder status(String recordStatus)
      Parameters:
      recordStatus - the decision status written in the record (default "Proposed")
      Returns:
      this recorder
    • title

      public DesignDecisionRecorder title(String recordTitle)
      Parameters:
      recordTitle - the record title (default Metro design for <spec name>)
      Returns:
      this recorder
    • clock

      public DesignDecisionRecorder clock(Clock recordClock)
      Parameters:
      recordClock - the clock for generatedAt (fix it for reproducible documents)
      Returns:
      this recorder
    • record

      public DesignDecisionRecord record()
      Runs the engines and assembles the record.
      Returns:
      the record; never null
      Throws:
      IllegalArgumentException - when the spec has errors (DesignSpec.validate())