Chapter Twenty · Problem Fourteen
File Sync
Keep one person's files the same on every device. A small edit has to stay small on the wire, idle devices have to stop asking, and when two edits collide, nobody's work may vanish.
"Design a file storage and sync service: a user's files appear on all their devices and survive losing any one of them."
A laptop and a phone edit one document while both are offline. No clock, no rule and no merge can say which edit mattered. So this is the problem where a person, not the store, settles the conflict, and the design's job is to put both edits in front of that person with nothing lost.
Every part of the answer comes from a lesson you have read. Chapter 4's Concurrent Writes and Conflicts asked who resolves a conflict and named this very case, and its Consistency Models That Come Up says which operation needs which promise. Chapter 3's Picking the Partition Key and When One Machine Is Not Enough choose the split and count it. Chapter 5 gives the conditional write in Leases, Locks and Fencing, and one owner numbering a scope in Clocks and Ordering. Chapter 6's Queues, Logs and Pub-Sub gives the habit that makes catching up cheap: each reader keeps its own position.
Three things carry this problem at senior level. Chunking and content addressing: cut a file into pieces named by their hash, so that duplicates are stored once and only changed pieces travel. Metadata kept apart from those pieces, with strong consistency for the metadata alone. And two devices editing offline: detect it with versions, and resolve it without silent loss.
Set a 45-minute timer and sketch yours first. When it rings, run two edits through your sketch: one byte changed in a large file, then that same file changed on a phone in airplane mode. The lessons run on the same clock. Scope ends at minute ten, First Design at twenty and Scaling It at thirty, and what remains goes to deep dives and curveballs.