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.<p>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].<p>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.<p>All your update logic would be a big switch statement on change feed from the database which would handle all the logic.<p>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?<p>I think that this solves the problem better than alternatives or the observer pattern.<p>Ideally the API would be something like LINQ methods in order to avoid parsing SQL.<p>I'm still trying to figure out if this would work.<p>[0] <a href="https://rethinkdb.com/docs/changefeeds/ruby/" rel="nofollow">https://rethinkdb.com/docs/changefeeds/ruby/</a><p>[1] <a href="https://en.wikipedia.org/wiki/Change_data_capture" rel="nofollow">https://en.wikipedia.org/wiki/Change_data_capture</a>