Practice a cloud storage system design question about enforcing drive-style usage quotas during uploads, deletes, retries, and concurrent operations. The prompt is aimed at candidates preparing quota accounting, reservation flows, reconciliation, and consistency trade-offs.
Design a quota limiter for a cloud storage product similar to a drive service. The system should enforce usage limits while users upload, modify, or delete files. The prompt may sound like rate limiting at first, but the core requirement is tracking and enforcing storage quota.
<details>
<summary>Hint 1</summary>
Start by naming the core entities, constraints, and success criteria.
</details>
<details>
<summary>Hint 2</summary>
Make the trade-offs explicit before going deep on implementation details.
</details>
### Constraints & Assumptions
- Quota is based on stored usage, not only request rate.
- Users or organizations have configured limits.
- File operations can be concurrent.
- The design should avoid allowing users to exceed quota through races.
### Clarifying Questions to Ask
- Is quota per user, per organization, or both?
- Do shared files count against owner, viewer, or both?
- What operations change usage?
- Does quota need strong consistency?
- How should pending uploads reserve space?
### What a Strong Answer Covers
```premium-lock What a Strong Answer Covers
```
### Follow-up Questions
- How would you handle a multi-gigabyte upload that fails halfway?
- How would shared folders affect quota accounting?
- What if counters drift from file metadata?
- How would you migrate quota rules?
Quick Answer: Practice a cloud storage system design question about enforcing drive-style usage quotas during uploads, deletes, retries, and concurrent operations. The prompt is aimed at candidates preparing quota accounting, reservation flows, reconciliation, and consistency trade-offs.
Design a quota limiter for a cloud storage product similar to a drive service. The system should enforce usage limits while users upload, modify, or delete files. The prompt may sound like rate limiting at first, but the core requirement is tracking and enforcing storage quota.
<details>
<summary>Hint 1</summary>
Start by naming the core entities, constraints, and success criteria.
</details>
<details>
<summary>Hint 2</summary>
Make the trade-offs explicit before going deep on implementation details.
</details>
Constraints & Assumptions
Quota is based on stored usage, not only request rate.
Users or organizations have configured limits.
File operations can be concurrent.
The design should avoid allowing users to exceed quota through races.
Clarifying Questions to Ask
Is quota per user, per organization, or both?
Do shared files count against owner, viewer, or both?
What operations change usage?
Does quota need strong consistency?
How should pending uploads reserve space?
What a Strong Answer Covers Premium
Follow-up Questions
How would you handle a multi-gigabyte upload that fails halfway?