Model Long-Running Operations for a Video Transcoding API

Last updated: November 29, 2026

Quick Overview

Design and implement an Operations resource for a slow API method (transcoding an uploaded video): the start call returns an operation name immediately, and clients poll, wait, or cancel it until it reports a result or error.

Google
Software Engineering Fundamentals
Software Engineer
Google
November 29, 2026
Software Engineer
Onsite
Software Engineering Fundamentals
Medium

0

0

0 solved


Design and implement an Operations resource for a slow API method (transcoding an uploaded video): the start call returns an operation name immediately, and clients poll, wait, or cancel it until it reports a result or error.

Many Google APIs, from Cloud Speech to Vertex training, return google.longrunning.Operation for work that outlives an HTTP request. The interviewer wants a clear state machine, safe cancellation, and an answer for how clients wait without hammering the server.

What the Interviewer Expects
  • Return an operation handle immediately instead of blocking
  • Define states and allowed transitions clearly
  • Make done, result and error mutually consistent
  • Support cancel as a best-effort request
  • Discuss polling intervals and server-side wait with timeout
Key Topics to Cover
long-running operations
state machines
async APIs
polling
cancellation
How to Approach This
  1. Apply SOLID principles. Single Responsibility makes code testable, Open/Closed makes it extensible.
  2. Choose data structures based on access patterns, not familiarity.
  3. Prefer immutable data and message passing over shared mutable state for concurrency.
  4. Design APIs with RESTful conventions, versioning, meaningful errors, and pagination from day one.
Possible Follow-up Questions
  • How do you keep operations after the worker crashes?
  • How long should finished operations be retained?
  • How would you report progress percent in metadata?
  • Should cancel on a finished operation be an error?
Sharpen Your Skills on Codemia

Practice similar problems with our interactive workspace, get AI feedback, and track your progress.

Practice System Design Problems
Sample Answer
Requirements
  • start(input) returns an operation name like operations/123 with done=False.
  • get(name) returns {name, done, metadata, response | error}.
  • cancel(name) asks the worker to stop; a runnin...
High-Level Design

The operation record is the contract; the worker is an implementation detail. A record lives in durable storage keyed by name, and workers update it through one method that enforces legal transitions....


Submit Your Answer
Markdown supported