Class DesignStore

java.lang.Object
com.eqixiac.equinix.mcp.server.DesignStore

public final class DesignStore extends Object
The design tools' single in-memory store: deployment plans keyed by their plan_id and optimization results keyed by the fingerprint of the spec they were run for, so the tools can be chained (design_optimize then design_plan_deployment, design_get_plan, design_plan_drift, design_export_terraform) without repeating work.

Scope: single-process only. Ids resolve only inside this server process; when the MCP host restarts the server they are gone. A plan id is a content hash (DeploymentPlan.planId()), so storing the same plan again refreshes its entry rather than creating a second one.

Bounds and honesty: each kind keeps at most capacity() entries for ttl() (default 60 minutes). Storing beyond capacity evicts the oldest entry of that kind and putPlan(DeploymentPlan)/putOptimization(OptimizationResult) return what was evicted so the tool result can say so, as the broker's ProposalStore does. Expired and evicted ids are remembered for one further TTL window, so a later lookup answers DesignStore.Status.EXPIRED or DesignStore.Status.EVICTED instead of a bare DesignStore.Status.UNKNOWN.

Thread-safe; every method synchronizes on the store. The clock is injectable for tests.

  • Field Details

    • DEFAULT_TTL

      public static final Duration DEFAULT_TTL
      Default time-to-live of a stored plan or optimization result.
    • DEFAULT_CAPACITY

      public static final int DEFAULT_CAPACITY
      Default maximum number of stored entries per kind.
      See Also:
  • Constructor Details

    • DesignStore

      public DesignStore()
      Creates a store with the default TTL (60 minutes) and capacity (20 per kind).
    • DesignStore

      public DesignStore(Clock clock, Duration ttl, int capacity)
      Creates a store with an explicit clock, TTL and capacity.
      Parameters:
      clock - the time source used for expiry
      ttl - how long an entry stays resolvable
      capacity - the maximum number of entries per kind
  • Method Details