*Time for a coherent plan of attack* ### Current Issues: - There is a lot of redundancy between the managers/coordinators when it comes to basic checks - the package seperation kind of makes sense, but it needs to be better fleshed out - I need to enforce better seperation of responsibilities. Somewhat unclear when state is being kept centrally in the coordinator for no apparent reason. ### Solution: - Go through the packages and consolidate - Reduce the state we have to keep centrally, push responsibility to the other packages ### Plan of attack: - Outline core information flow - Examine what interfaces are nessecary to make this work - Stop looking at the server/reactor as seperate entities *I need to put the whole docker thing on the back burner for now. It isn't that important when it comes to immediate goals.* #### 12/05 TODO - Cleanup server side config stuff to make it coherent - Reflect changes to reactor side startup - Boil down interface to address core issues - Config outline: 1) Startup and load the existing config 2) Overwrite any previous settings with the flags 3) Intelligently translate config into action 4) launch coordinator and start up existing reactor managers - Config Structure: - Wrap viper functions in config struct methods to be used thrtugh interfaces - minimize the reliance on viper so we can sub in othermethods - is it even important to launch reactor managers? Wont they just be started on connection? #### 12/06 TODO - I think I can completely remove the old config way and just pass the viper object directly. I think its not worth the hassle of trying to keep track of a million interfaces #### 12/07 TODO - I concede, I will just remove flags as most people will never use them anyway and instead rely on env vars and config files. To hell with the flags. - I am ripping out all of the TUI and status manager stuff, its convoluted and harder than just pulling info from database. - I can eventaully rework TUI to pull from DB which is fine, there will never be that many clients anyway and a lot of them are only 1 time calls with refreshes which aren't that slow anyway. - alright I gutted the tui and system viewer, reworking sub coord to launch at start. That way there is a listener active - time to boil down to functionality a LOT, right now its clumsy and inefficent, there needs to be a better way to keep everything straight - Moving the DB responsibilites to the reactor itself seems to be the best way to do it in the short term. Reduce network load and overall keep things efficient. May lead to duplicte copies of data? Not the end of the world, logging system can make sure we are maintaining entries. **IDEA** Reactors log data themselves, Send periodic status updates over grpc to enable monitoring faster than the sample rate *This could work!* Outline: - Reactors reach out to server on boot to get DB info - compare this against what they have internally to ensure they are up to date and allow for migrations - Maybe not even save the db info because we don't need to?? - Reactors also recieve port for their specific manager - Can be dynamically given out to allow for spread out load - Reactors then reach out with sensor and device info periodically (5s?) which can be used for live monitoring - RM responds with any potential updates for the device settings i.e. change pwm duty on web interface, pass on to reactor - Allows for a live view with current reading as well as historical data at differing interval via grafana. (i.e. 5s live view with 10 min sample interval) Need to differentiate sensors vs devices that can be changed - Sensors have a variable sample rate and eventually name/address - Devices have more and widley varying parameters, could be pwm with freq/duty/onoff or ph pump with on, time or off etc. #### 12/09 TODO - Alright I have a baseline! I want to start to integrate atlas type stuff so that I have some mock data/sensors to work with. I am going to try to flesh out the "atlas" interface/struct to implement some of the more basic commands. #### 1/11 TODO Plan of attack for websocket stuff and things **Questions** - What to do about the reactor to user comms - Websockets? GRPC? smoke signals? -