Design On-Camera Footage Eviction With Protected Event Clips

Last updated: November 29, 2026

Quick Overview

Implement the storage manager for a camera's local disk: write video segments, mark some segments as event clips, and when the disk is full evict the oldest plain footage first, while event clips are protected for an extra `protect_secs` before they become evictable.

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

0

0

0 solved


Implement the storage manager for a camera's local disk: write video segments, mark some segments as event clips, and when the disk is full evict the oldest plain footage first, while event clips are protected for an extra `protect_secs` before they become evictable.

Verkada cameras keep 30 to 365 days of footage on the device and only upload on demand, so the eviction policy on the camera decides what an investigator can still find. This onsite round checks data structure choice, lazy deletion, and how you reason about a constrained embedded environment.

What the Interviewer Expects
  • Chooses a min-heap (or ordered structure) keyed by an effective eviction time
  • Handles re-flagging an existing segment without an O(n) heap search
  • Uses lazy deletion and explains stale entries
  • Keeps capacity accounting exact and rejects oversized writes
  • Talks about flash wear, crash safety, and metadata persistence on device
Key Topics to Cover
heaps
lazy deletion
retention policy
embedded storage
priority eviction
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
  • The camera reboots mid-write. How do you rebuild the index without reading every segment?
  • A customer has a legal hold that must never be evicted. How do you add that?
  • How would you expose 'oldest available footage' to the cloud so the UI shows the true retention?
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

Operations: write(seg_id, ts, size, flagged), flag(seg_id), and implicit eviction when used + size > capacity. Plain segments go oldest first. An event clip behaves as if it were recorded `prote...

High-Level Design

Effective rank = ts + protect_secs if flagged, else ts. Store segments in a dict and push (rank, ts, seg_id) into a min-heap. Flagging pushes a new entry rather than editing the heap; when poppi...


Submit Your Answer
Markdown supported

Related Questions