An Architecture For Pumping Drinks
Starting off the day with some learning about Rust!
I started off the day off by watching the into_rust() video lectures and exercises! These really helped me improve my understanding of Rust's Ownership model. My understanding was still stuck in C/C++!
Architecture
Let's start-off by making a little bit of an architecture! The following
picture was taken from a quick sketch I did, but I believe it has the
core pieces. This architecture only goes up to the web api
. The front-end
website will be dealt with later.
Some terms that are in the diagram:
dispenser
: Is an abstraction of the pump. it maintains state of how much liquid is in it, how to pump it at a given rate, and how to pump a given quantity.recipe
: A recipe is a listing of all of the liquids which need to be mixed (by name) and how much of each of them to make a givent quantity (in mL). Recipes also include information about user interactions, such as, if the drink should be mixed or stirred, or if ice should be added. Recipes have names and cam be looked up.mixer
: Amixer
contains a list of nameddispensers
. Thedispensers
get there name from a configuration file, or from theapi
, themixer
also sends down information about the liquid levels. Amixer
creates a drink by taking arecipe
andquantity
as input. System status information is relayed through themixer
to the LEDs
The goal is to create a service which will provide an HTTP API using one of Rust's web micro-frameworks ( Iron, pencil, rocket, etc.). After that is tested I will begin work on a basic frontend.