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
Think like an Architect
Before revealing the requirements, imagine you're in the interview right now."How would you clarify the scope with your interviewer?"