Checkpoint: Download Engineering
Quiz
- A resumable image download sends `Range: bytes=921600-` but the server responds with status `200` and the full body. What must the downloader do?
- Truncate the `.part` file and write from byte 0, because the server ignored the range and sent the whole body.
- Append the body to the existing `.part` file, since the server confirmed the request succeeded.
- Publish the file with `os.replace` and let the integrity check fix it later.
- Retry with backoff until the server returns `206 Partial Content`.
- Which failure should NOT be retried by the image downloader?
- `429 Too Many Requests` with a `Retry-After` header
- `503 Service Unavailable`
- `403 Forbidden`
- A read timeout mid-transfer
- In an HLS manifest, which tag declares the initialization segment that must be written before any fMP4 media fragment?
- `#EXT-X-STREAM-INF`
- `#EXTINF`
- `#EXT-X-ENDLIST`
- `#EXT-X-MAP`
- A DASH manifest offers 1080p, 720p and 480p video representations plus one audio-only representation. The config sets `max_height: 720`. What should the crawler download?
- The 720p video representation plus the audio representation, then mux them at merge time.
- Only the 1080p representation, because highest quality is always safest for archival.
- The 720p video representation only, since audio is embedded in the video fragments.
- The 480p representation, because it is the smallest eligible stream.
- Which statements about the capstone storage contract are correct? Select all that apply.
- The stored file extension should be taken from the URL path, since platforms always serve the matching format.
- The final path derives from the content hash, not from the URL, timestamp or post ID.
- A `200` response with `Content-Type: image/jpeg` is enough proof that the body is a valid JPEG.
- `tmp_root` and `media_root` should be on the same filesystem so `os.replace` stays atomic.
- Hashing should happen inside the write loop so each chunk is hashed and written in one pass.
- Which checks does the storage stage run on a downloaded file before publishing it? Select all that apply.
- Check the size falls inside the configured min/max bounds for that media kind.
- Sniff the leading magic bytes against the claimed format.
- Trust the `Content-Type` header as the authoritative format signal.
- Derive the stored extension from the sniffed format rather than the URL.
- Compare bytes written against `Content-Length` when that header exists.
- A resumable download sends the `Range` request header and expects status code ____ back from a server that honored it.
- After merging fragments, the capstone validates duration and dimensions of the output video with the ____ tool.
- In the capstone, in-progress bytes are written to a temp file and published into the store with `os.replace`, which is ____ on the same filesystem.
- Explain how your capstone download stage guarantees that a killed worker never leaves a corrupt or duplicated file in the store. Cover the temp-file lifecycle, the resume path, and the dedupe moments.
Sign in to submit answers.