Example of using these over a network #139
-
I am a total noob when it comes to using CRDTs and definitely a rustling, but I was wondering if there is an example of using CRDTs across a network, perhaps a simple add-wins example between two instances of a rust program that write to the same data structure. The premise of CRDTs, as I understand it, is that different replicas of the data exist, they will act on it (perhaps differently), and then need to merge state without conflicts. Since the merge semantics are implicit to the data structure, there need not be coordination in order to resolve conflicts during a merge event. But, from the examples folder in the repo, I don't quite see how these are being used to show collaboration between replicas across a network Like, if I run the examples its just one instance of a program and I feel like I don't get the breadth of how CRDTs should be used. How would one use a networking library to see them in action? Apologies if my question doesn't make sense. I may simply just not understand this crate well enough |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 2 replies
-
While im still looking more into crdt to determine if it would be of any benefit for my use case, I can say that it it really depends on your use case network wise. The code itself doesnt have any network related bits (thats for you to supply), but you can serialize and deserialize your objects and pass them over to other peers (including you receiving theirs) and go from there. There are also crates that have network use cases that make use of rust-crdt (you can find them on https://crates.io/crates/crdts/reverse_dependencies) that you can review as examples. |
Beta Was this translation helpful? Give feedback.
-
@dariusc93 is right, the datastructures in this repo are agnostic to the network logic, you could serialize the state of a CRDT, email it to another computer and load up in your program and merge it with the local state on that machine. Where ever you see state being serialized in the CRDT, you should think "these bytes are sent over the network somehow". How you do that is really up to the networking tool you choose to use. |
Beta Was this translation helpful? Give feedback.
While im still looking more into crdt to determine if it would be of any benefit for my use case, I can say that it it really depends on your use case network wise. The code itself doesnt have any network related bits (thats for you to supply), but you can serialize and deserialize your objects and pass them over to other peers (including you receiving theirs) and go from there. There are also crates that have network use cases that make use of rust-crdt (you can find them on https://crates.io/crates/crdts/reverse_dependencies) that you can review as examples.