Design a key value store and an Index.
MediumLet's design a key-value store with indexing capabilities. Think of it as a simplified, in-memory database. The core idea is to store data (values) associated with keys and provide efficient retrieval not just by key (primary index) but also by other attributes of the value itself (secondary indices). This is crucial for supporting various query patterns beyond simple key lookups. We need to support multiple, dynamic secondary indices. A real-world example would be storing customer records and needing to look them up not just by customer ID (the key) but also by email address or zip code. We will focus on building a system that allows adding, retrieving, updating, and deleting key-value pairs, along with creating and using secondary indices on the values.
Requirements
Interview Simulation
Experience a realistic interview conversation. The interviewer will ask clarifying questions,and you'll reveal your understanding of the requirements.
Let's start by understanding the scope. What are the core functionalities this system needs to provide?
💡 Interview Tip
Identify the Actors (Who uses the system?) and their Use Cases (What are they trying to achieve?). Start with the 'Happy Path' scenarios.