runrig-coop / early-warning-system

An early warning system for Richland Gro-Op to coordinate field health.
GNU General Public License v3.0
2 stars 1 forks source link

Data Permanence #10

Closed Wright4TheJob closed 11 months ago

Wright4TheJob commented 1 year ago

A persistent data store will be needed to carry forward user data, including historical measurements and observations, or program configurations. An initial version of this may be a simple text file (JSON, YAML, etc.). If data grows to the point that complexity or performance is a bottleneck for the developers or users, then a database or other more scalable solution may be necessary, and should only be added later when it becomes an issue.

Specifically, the program should both read the data file on startup and save to this file periodically, maybe once a change is concluded. Ideally the difference between the application state and data file is kept small while the program is running.

jgaehring commented 11 months ago

I'm hoping to pick this back up in the next couple days and just wanted to save a link to the reference code @Wright4TheJob found in the iced-rs examples for loading and saving JSON data on the file system:

https://github.com/iced-rs/iced/blob/master/examples/todos/src/main.rs

David already got the saving operations working synchronously with 024cc1e7e4c2b18a3af8e4527f55154d6df6911c:

https://github.com/runrig-coop/rgo-early-warning-system/blob/024cc1e7e4c2b18a3af8e4527f55154d6df6911c/src-tauri/src/main.rs#L46-L78

And I have some WIP commits saved on my fork, namely 387e629, which should be the germ of the loading implementation.