class CacheStorageWriter {

  void writeMetadata(ImageReference imageReference, ImageMetadataTemplate metadata)
      throws IOException {
    verifyImageMetadata(metadata);
    Path imageDirectory = cacheStorageFiles.getImageDirectory(imageReference);
    Files.createDirectories(imageDirectory);

    try (LockFile ignored = LockFile.lock(imageDirectory.resolve("lock"))) {
      writeJsonTemplate(metadata, imageDirectory.resolve("manifests_configs.json"));
    }
  }

    CacheStorageWriter(CacheStorageFiles cacheStorageFiles);

}