List the key functional requirements for the system (Ask the AI for hints if stuck)...
our key requirements should be that users can enter, and peruse the parking lot for open spaces and exit at any time they want. Ideally we would tell users if there are available spaces for their car size and direct them to these spots in open space.
List the key non-functional requirements (performance, scalability, reliability, etc.)...
The system should be able to withstand all entries into the parking lot such that the parking lot has space for cars to move around or park. Upon failure of the allocation system the system should still show which spots are available or not.
Estimate the scale of the system. Consider daily active users, read/write ratio, storage requirements, bandwidth, and any relevant QPS calculations...
say there are 1000 daily users
for every user we will document their entry and upon parking document their position, we will do it once upon exit too, so there is potentially 3 writes per user. The reads come about when the system needs to know if a spot is taken or not, which is done each entry to inform graphically the user where to park. So reads is capacity of car garage per entry, and 3 writes per user in the overall lifecycle. We set a hard limit for how many cars are available and and each time a car leaves we take that id out and just reduce the gtick.
capacity of a 100, each user will have 3 writes and 1000 daily users means 3000 daily writes, the space of each write is unknown so bandwidth is hard to say.
Define the APIs expected from the system. This is your chance to analyze and define the read and write paths so that you can come up with the high-level design...
upon entry we need an api that tells the system we have a new car in there, that ticks the capacity checker, then if it parks we need a way to write that this spot is taken and what the license number is when they leave we simply decrease the capacity checker. We should also either have a sensor that checks if a spot is vacated or we can tag every vehicle with an id based on their driver's license and if that drivers license exits, if theres a spot that has that drivers license we can consider it vacant.
Describe the overall system architecture. Identify the main components needed to solve the problem end-to-end. Use the diagramming tool to create a block diagram.
the user communicates with the server that stores things in a no sql database, and the server will compute if we have space or do the writes and get back to the client/user.
Define the data model. Identify the main entities, their attributes, and relationships. Consider the choice of database type (SQL vs NoSQL) and justify your decision based on access patterns...
each parking spot has an id and a taken by variable which is either empty or taken, and we simply use no sql query by spot number for quick reads.
Deep dive into 2-3 key components. Explain how they work, how they scale, discuss tradeoffs, capacity, and any relevant algorithms or data structures.
one component is the entrance gate, it tells the users where there are empty spaces , if at all, and allows entry only after a button is pressed to scan the license plate and a gate opens,
this guarantees that we get one entry per user and we have a license plate logged in the capacity and in the data base.
next we have the parking spot, if a user chooses a spot they will input their license plate into that spot number, which in turn fills the space in the data base with that license plate and sets a timer given how long they paid.
lastly we simply have the exit gate that removes the license plate from the capacity and takes the capacity down by one.