Estimate the scale of the system you are going to design...
**Admin api**
POST/PUT/DELETE /parkingLots/
**Transaction api**
**Read apis**
Table ParkingSlot is partitioned by lot_code field to allow for efficient access and avoid full table scans
Table Ticket is partitioned by entry_epoch_time_min ( yyyy-mm component ) to faciliated archival
Table ParkingSlot and Table Ticket has composite unique key defined on fields 'lot_code' , 'vehicle_reg_num' and 'entry_epoch_time_min' ( 'current_entry_epoch_time_min' for Table ParkingSLot )
Table ParkingSlot has composite primary key comprising of columns 'lot_code' and 'slot_code'.
Table ParkingSlot has secondary composite index defined on columns 'lot_code' , 'size_type_enum_C_S_L' and 'is_empty'
Table Ticket has composite primary key comprising of columns 'id' and 'lot_code'
*Configuration Service* - This is a micro service responsible for providing admin api s as described above . The domain entities it maintains are ParkingLot and ChargePolicy
*User Interface* - a UI built over Configuration service and Ticketing Service.
*Ticketing Service* - this microservice provides api for the checkin and checkout flows. Having this service separate from Configuration Service due to its different scaling and reliability needs. Additionally it can also provide validate ParkingSlot Entry api.
*ReadService* - This microservice powers the api Vacancy Summary . This api returns the current count of available slots per size type for a given slot . This api powers various electronic display boards that are refreshed at a higher frequency
*Checkin Flow* -- api called -- POST /parkingLots/
{
"vehicle_reg_num": "KA-03-XX-1234",
"size_type":"C" ,
"current_entry_epoch_time_min": 1735551
}
update ParkingSlot
set is_empty=false , vehicle_reg_num='KA-03-XX-1234' , current_entry_epoch_time_min=1735551
where
lot_code="LOT1"
and is_empty=true
and size_type_enum_C_S_L >= C
order by size_type_enum_C_S_L ASC
limit 1
returning slot_code
*Read Service* - This service keeps the summary ( size_type --> count ) per Parking lot code in memory to be able to provide a very low latency response to the vacancy Summary api