Scenario
You are building part of an Azure-like cloud control plane. Resources (VMs, networks, storage accounts, etc.) are stored as JSON documents and are updated frequently.
Task
Design a Resource Change Database / system that:
-
Captures every change to a resource (create/update/delete).
-
Emits a
notification/event
after a change occurs.
-
Downstream consumers can use the notification to
query the “diff”
(what changed between the old and new versions) and store that diff for later auditing/search.
Requirements
-
Correctness:
Diffs must correspond to the actual committed change.
-
Ordering:
For a given resource, changes should be processed in order.
-
Idempotency:
Duplicate notifications should not create duplicate diff records.
-
Query:
Support querying change history by resource ID and time range; optionally filter by fields changed.
-
Scale:
Assume high write volume (control-plane scale) and many resource types.
Clarifications you may decide
-
How diffs are represented (JSON Patch, field-level records, full before/after snapshots).
-
Retention policy (e.g., keep 90 days of diffs).
-
Multi-region requirements and latency SLOs.