← All Exercises

Verify a Backup Manifest Before Restore

basicjavascript~20min

Background

Restore drills fail on artifacts nobody verified. Checking the manifest first turns a recovery gamble into a precondition.

Problem

Compare a backup artifact with its manifest and report checksum, size and minimum-object mismatches so a restore is not attempted on an incomplete dump.

Input

JSON object: { backup: { checksum, sizeBytes, objectCount }, manifest: { checksum, sizeBytes, minimumObjects } }

Output

JSON object: { verified: boolean, mismatches: string[] }

Sample tests

Sample 1

Input: {"backup":{"checksum":"sha256:abc","sizeBytes":1024,"objectCount":40},"manifest":{"checksum":"sha256:abc","sizeBytes":1024,"minimumObjects":10}}
Expected: {"verified":true,"mismatches":[]}

Sample 2

Input: {"backup":{"checksum":"sha256:def","sizeBytes":900,"objectCount":4},"manifest":{"checksum":"sha256:abc","sizeBytes":1024,"minimumObjects":10}}
Expected: {"verified":false,"mismatches":["checksum","object-count","size"]}

Your solution

Learning objective

Gate restores on verified backup artifacts.