ToyDB: Distributed SQL Database in Rust
I've been building a prototype of a relational in-memory database in Rust to replace some involved ad-hoc data structures and in the process, I came across this.I think that all the state management problems and solutions in all languages/frameworks (react, swiftui, elm etc etc) would be better implemented as a database with 
changefeeds [0]/ change data capture [1].The advantage compared with something like Redux is that it's more general. You don't need to implement an enum with a case for each action and then have a big dispatcher.All your update logic would be a big switch statement on change feed from the database which would handle all the logic.The fundamental problem of state management is as follows, if a leaf view changes some data, how does some view higher in the hierarchy learn about this?I think that this solves the problem better than alternatives or the observer pattern.Ideally the API would be something like LINQ methods in order to avoid parsing SQL.I'm still trying to figure out if this would work.[0] https://rethinkdb.com/docs/changefeeds/ruby/[1] https://en.wikipedia.org/wiki/Change_data_capture