Running the T
For this homework set, you will design an application for managing the T’s subway system.
The objective of this homework is to improve your knowledge about Rust’s concurrency model and constructs. The assignment "combines" knowledge from Graph Traversals and Serving the Web.
Deadline Friday 20 March NOON, new due date Friday 27 March NOON.
t_query
from STATION to STATION |
disable STATION |
enable STATION |
===>>> from Airport to Northeastern |
Airport Station, take blue |
Maverick Station, take blue |
Aquarium Station, take blue |
State Station, take blue |
Government Center Station, take blue |
---switch from blue to green |
Park Street Station, take green |
Boylston Street Station, take green |
Arlington Station, take green |
Copley Station, take green |
---ensure you are on E |
Prudential Station, take E |
Symphony Station, take E |
Northeastern University Station, take E |
===>>> disable Government |
done |
===>>> from Airport to Northeastern |
Airport Station, take blue |
Maverick Station, take blue |
Aquarium Station, take blue |
State Station, take blue |
---switch from blue to orange |
Downtown Crossing Station, take orange |
---switch from orange to red |
Park Street Station, take red |
---switch from red to green |
Boylston Street Station, take green |
Arlington Station, take green |
Copley Station, take green |
---ensure you are on E |
Prudential Station, take E |
Symphony Station, take E |
Northeastern University Station, take E |
===>>> enable Government |
done |
===>>> from Airport to Northeastern |
Airport Station, take blue |
Maverick Station, take blue |
Aquarium Station, take blue |
State Station, take blue |
Government Center Station, take blue |
---switch from blue to green |
Park Street Station, take green |
Boylston Street Station, take green |
Arlington Station, take green |
Copley Station, take green |
---ensure you are on E |
Prudential Station, take E |
Symphony Station, take E |
Northeastern University Station, take E |
===>>> from Airport to Northe**stern |
no such destination: Northe**stern |
===>>> from Airport to Center |
disambiguate your destination: Quincy Center Station Government Center Station Tufts Medical Center Station Malden Center Station |
===>>> disable Nor'easter |
no such station to disable: Nor'easter |
===>>> enable Gov'm**nt |
no such station to enable: Gov'm**nt |
===>>> enable Government |
done |
===>>> disable Government |
done |
===>>> disable Government |
done |
===>>> enable Government |
done |
===>>> from Airport to Hynes |
Airport Station, take blue |
Maverick Station, take blue |
Aquarium Station, take blue |
State Station, take blue |
Government Center Station, take blue |
---switch from blue to green |
Park Street Station, take green |
Boylston Street Station, take green |
Arlington Station, take green |
Copley Station, take green |
---ensure you are on C D B |
Hynes Convention Center, take C D B |
Details
The currentHope springs eternal. four T lines are specified in four data files, named after their color: green.dat, blue.dat, red.dat, and orange.dat.
Your t_query server must listen for queries and commands on the local loopback interface (127.0.0.1) on port 12345. For each command or query, it spawns a separate process so that the service can cope with many queries in parallel.
As for the format of the responses, they do not need to match the interactions above exactly but they should come close. Regardless, t_query must be robust with respect to errors from passengers and operators.