User should be able to park at a space of their choice and pay based on the number of hours.
There should be different sized lots to handle differently sized cars.
Payment system should track the number of hours remaining for each lot.
System to display the number of available lots
User can reserve parking slot
Efficient entry and exit
Notify users when their parking session expires
Allow disability or permit parking
500 total lots. Maximum 10 cars enter or exit per minute
pay(slot_number, plate_number, hours)
reserve(slot_number)
enter(slot_number, plate_number)
exit(slot_number, plate_number)
Lot
Parking lot
The parking lot will consist of two systems: one parking system which updates the lot database about incoming and outgoing vehicles, and their occupancy statuses. One payment system that writes to the lot table about how long the user can park at the location. It also stores the banking details and contact information of the customer to the payment table
flowchart TD
B["client"];
D["rate limiting system"];
n0[("lot table")];
n2["payment system"];
n3["parking system"];
n5[("payment table")];
B --> D;
D --> n2;
D --> n3;
n3 --> n0;
n2 --> n5;
n2 --> n0;
enter: writes plate number and occupancy status to the lot table. Decrement available lot by 1. If lot is full, return an error message.
exit: remove plate number and resets occupancy status
reserve: sets the parked until param of the lot ID
pay: sets the parked until param of the lot ID. Writes banking information and contact point to the payment table
sequenceDiagram participant User participant PaymentAPI participant ParkingLotSystem User->>PaymentAPI: Reserve Parking Slot PaymentAPI-->>User: Payment Confirmation User->>ParkingLotSystem: Update Lot ID ParkingLotSystem-->>ParkingLotSystem: Set occupied to true ParkingLotSystem-->>ParkingLotSystem: Set booked_until value ParkingLotSystem-->>ParkingLotSystem: Set plate_number ParkingLotSystem-->>ParkingLotSystem: Set parked_until value ParkingLotSystem-->>ParkingLotSystem: Decrease available lots by 1 User->>ParkingLotSystem: Enter Lot ID ParkingLotSystem-->>ParkingLotSystem: Record plate_number ParkingLotSystem-->>ParkingLotSystem: Set occupied to true User->>ParkingLotSystem: Exit Lot ID ParkingLotSystem-->>ParkingLotSystem: Clear plate_number ParkingLotSystem-->>ParkingLotSystem: Set occupied to false ParkingLotSystem-->>ParkingLotSystem: Increase available lots by 1
Dig deeper into 2-3 components and explain in detail how they work. For example, how well does each component scale? Any relevant algorithm or data structure you like to use for a component? Also you could draw a diagram using the diagramming tool to enhance your design...
Explain any trade offs you have made and why you made certain tech choices...
Try to discuss as many failure scenarios/bottlenecks as possible.
What are some future improvements you would make? How would you mitigate the failure scenario(s) you described above?