2 ms·
Within a string, most CRDTs will keep both changes effectively concatenating them. If you have something like a Int value and need to handle it more gracefully
by samwillis 5y ago
Within a string, most CRDTs will keep both changes effectively concatenating them.
If you have something like a Int value and need to handle it more gracefully in your application than the arbitrary selection by the CRDT toolkit you can keep it within an array/list and then handle the merging yourself. So it starts off as [10], each user when changing it would delete the value and append a new one. That way if you have two users simultaneously change it, one to [15] and the other to [5]. The resulting synced value would be [15,5], you can then handle how to combine the values yourself (addition, average, etc) in a determinist way.
I haven't looked into it but some CRDT toolkits may store Ints by keeping track of changes to it, but the above allows you to do it yourself.