How it works
Store ownership, title, visibility, duration, status, and pointers to manifests or thumbnails in a metadata database. Keep original and encoded bytes in object storage. The two have little in common: a row of a few kilobytes that must support queries, and a multi-gigabyte file read as a stream. A cache can accelerate hot metadata reads, but the database remains authoritative; invalidate or update cached entries after writes.
A viewer opening a watch page asks the API for metadata and access policy. It returns a permitted manifest location only when status is ready; before then the interface shows processing or a clear failure. Completion may span storage and database operations without one atomic transaction, so use a durable state machine: a status that moves only along allowed transitions, such as pending, uploaded, processing, then ready or failed.
Follow one publication. A worker reports “done” at 10:00. A verifier checks the main manifest and all four rendition manifests in storage, finds one absent, and leaves the status at processing. A retry writes it. At 10:05 the verifier passes and runs the equivalent of SET status = ready WHERE status = processing, so a repeated event changes nothing. Repeats are normal: Amazon S3 event notifications, for instance, arrive at least once and without guaranteed order.
Reconciliation, a background job comparing database state with what storage actually holds, can find stuck jobs, orphaned objects, and missing outputs. The cost is more states for the interface and support staff to explain. An internal tool that encodes while the uploader waits could manage with one flag.
A worker reports success, but the manifest is absent from storage. Should the watch page expose the video?
No. Keep it processing or failed until required objects are verified. Retry or reconcile, then publish only when playback works.
Use this as a guide for self review; written answers are not graded.Keep in mind
- Metadata describes and authorizes media; object storage holds the bytes.
- Publication is a validated state transition, not a queue acknowledgment alone.