Great write-up!<p>> If we extend it further with a fairly simple distributed mutex mechanism, we can now persist and share state across any service which can access the Redis instance!<p>I’m curious to hear more about the approach you took here. Does the first server to open the document hold the mutex, or do servers only hold the mutex when briefly while they persist data?<p>(I’ll also shamelessly plug Y-Sweet, an open source Yjs server with persistence that I contribute to <a href="https://github.com/jamsocket/y-sweet">https://github.com/jamsocket/y-sweet</a>)
> Beyond this, if you want to determine causality, e.g. whether events are "causally related" (happened before or after each other) or are "concurrent" (entirely independent of), you can look at Vector Clocks—I won't go down that rabbit-hole here, though.<p>If anyone want to go down that rabbit hole: <a href="https://www.exhypothesi.com/clocks-and-causality/" rel="nofollow">https://www.exhypothesi.com/clocks-and-causality/</a>
I'll add Loro[0] to the author's list. While I utilise Yjs heavily for another project, Loro is fairly featureful and so I picked it to build a screenplay editor[1], which requires things like Peritext or tree structures. It's fairly young, though.<p>I'll also commend the author's attempt at DIY! Even if your case does not require a custom solution, it's healthy to understand how your tools work.<p>[0] <a href="https://loro.dev" rel="nofollow">https://loro.dev</a><p>[1] <a href="https://www.weedonandscott.com/tech/project-realm" rel="nofollow">https://www.weedonandscott.com/tech/project-realm</a>