CRDT and Ash

First of all: Why use Ash? Because declarative programming and Elixir are awesome. Why CRDT? Because they are awesome too - anyone who's dealt with LiveViews losing their sockets knows what I mean. I'm using Rustler to talk to a Yjs (the package is Rjs which is pronounced 'wires'). A NIF written in Rust accepts an Ash resource instance and creates a Yjs document from it. I am contemplating how to do this in a generic way, and it appears that, while I might be able to code an Ash extension for this, it won't work with Rust serde. I'm contemplating using Json instead since it works bidirectionally between Ash and Yrs. Are there any gotchas I should be aware of when serializing Ash structs to Json? Would at least parts of JsonApi be of help? I haven't thought a lot about references yet but I think they will be links instead of being embedded. Every resource will have its own Yrs document. For now, this is just a fun experiment for learning CRDT and Rustler. Thanks!
4 Replies
jart
jart2y ago
Make sure you check out deltacrdt - I used it in a previous project.
Terris
TerrisOP2y ago
Thanks. I researched it a little and the deal breaker is incompatibility with Yjs which is used on the client side (I'm not using liveview forms).
jart
jart2y ago
Right right. Makes sense.

Did you find this page helpful?