hard general · part of Practice Questions · Senior SWE Roadmap
Requirements to clarify
- Functional: upload/download files, sync across multiple devices, share files/folders, handle offline edits.
- Non-functional: files can be large (need chunking), bandwidth should be conserved (don’t re-upload unchanged data), sync conflicts must be handled sensibly.
Core components
- Chunking: split files into fixed-size blocks; only upload/download changed blocks on an edit, and deduplicate identical blocks across files/users (huge storage savings).
- Metadata service: tracks file/folder structure, versions, and which blocks make up each file version — separate from the actual block storage.
- Block storage: the chunks themselves live in an object storage system (see Design an S3-like Object Storage System), content-addressed by hash so identical blocks are naturally deduplicated.
- Sync client: watches the local filesystem for changes, diffs against the last known state, uploads changed chunks, and downloads/applies remote changes — needs conflict resolution when the same file changed both locally and remotely.
- Notification/sync protocol: efficiently tells other devices “something changed” without constant polling (long-polling or push).
Key tradeoffs
- Chunk size: smaller chunks improve dedup and reduce re-upload on small edits, but increase metadata overhead.