Question
Design a photo-sharing service where users upload images, view their libraries, and share content. Identical bytes should be stored once, while near-duplicate detection may assist organization or moderation. ## Requirements - Define upload, finalize, view, share, and delete APIs. - Hash content during upload and map user-owned logical objects to immutable blobs. - Preserve authorization: discovering that another user uploaded the same bytes must not leak their identity or metadata. - Make concurrent identical uploads safe and avoid duplicate blob writes. - Delete a blob only after no authorized logical object references it, including delayed or failed workflows. - Distinguish cryptographic exact deduplication from perceptual similarity and state false-positive policy. Describe metadata, object storage, reference counting or garbage collection, CDN behavior, and processing jobs. ## Follow-ups 1. Support client-side encryption and explain its effect on deduplication. 2. Generate thumbnails and moderate content idempotently. 3. Repair leaked or undercounted references. 4. Find near-duplicates at billion-image scale.