Class FileCheckpointStore

java.lang.Object
com.eqixiac.equinix.design.plan.FileCheckpointStore
All Implemented Interfaces:
CheckpointStore

public final class FileCheckpointStore extends Object implements CheckpointStore
A CheckpointStore that keeps one JSON file per deployment in a directory (<deployment>.checkpoint.json, the name reduced to file-safe characters). Each save writes a temporary file and renames it over the old one, so a crash mid-write leaves the previous checkpoint intact.
  • Constructor Details

    • FileCheckpointStore

      public FileCheckpointStore(Path directory)
      Creates a store in a directory (created on first save).
      Parameters:
      directory - the directory
  • Method Details

    • fileFor

      public Path fileFor(String deploymentName)
      The file a deployment's checkpoint is kept in.
      Parameters:
      deploymentName - the deployment name
      Returns:
      the path
    • load

      public Optional<Checkpoint> load(String deploymentName)
      Description copied from interface: CheckpointStore
      The checkpoint for a deployment, if one was saved. Checkpoints are keyed by deployment name, not plan id, so an edited plan (a new plan id) still sees what earlier runs created.
      Specified by:
      load in interface CheckpointStore
      Parameters:
      deploymentName - the plan's deployment name
      Returns:
      the checkpoint, or empty
    • save

      public void save(Checkpoint checkpoint)
      Description copied from interface: CheckpointStore
      Saves (replaces) the checkpoint of its deployment.
      Specified by:
      save in interface CheckpointStore
      Parameters:
      checkpoint - the checkpoint
    • delete

      public void delete(String deploymentName)
      Description copied from interface: CheckpointStore
      Removes a deployment's checkpoint.
      Specified by:
      delete in interface CheckpointStore
      Parameters:
      deploymentName - the deployment name