Replies: 1 comment
-
I guess my point is: how can I test this properly/thoroughly to make sure the required CRDT and Vector/Matrix properties are indeed preserved. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi there!
I am working on a new version of the open source SmartShape Engine written 100% in Rust using wgpu.
One of the main features I am investigating is making the new engine data driven + collaborative in a decentralized way. For example, if a user changes the color of an object, that object would change color for all the other users.
Here is an example that uses some WASM properties to synchronize the state of the WASM modules between multiple instances: https://twitter.com/kettlecorn/status/1620567336704180225 It's very low level and transparent. But IMHO it does cover the elephant in the room for larger projects: consistency and concurrency.
So I am trying to use CRDTs instead. The goal is to store the entire state of the 3D application in a CRDT and communicate the CRDT operations on the network to synchronize that state along multiple instances.
To do that, I need to store things like
Vector
andMatrix
in such CRDT. I have started working with the crdts crate. To implement the state as acrdts::Map<uuid::Uuid, crdts::Orswot<String, Value>, Value>
. In order for this to work,Value
must implement:Hash
PartialEq
Eq
PartialOrd
Ord
Implementing
Eq
andPartialEq
andHash
I leveraged the
ordered_float
crate to have comparable/hashable floats:IMHO it makes sense and it builds fine. So I expect this choice to work OK with the rest of the
nalgebra
API.Am I missing something?
Implementing
Ord
andPartialOrd
This is where things get tricky: it does not make much mathematical sense to sort/compare vectors or matrices. But my understanding is that is does not have to make sense mathematically as long as it is consistent from a data point of view.
Thus, I am using
Vector::norm()
andMatrix::norm()
to compareValue
:Again, I know that makes no mathematical sense. But I don't actually intend to actually sort/compare
Vector
and/orMatrices
in my code to compute anything (I might even find a way to make sureOrd
andPartialOrd
are not visible/usable outside of the CRDT interface). I just need this traits implemented so the CRDT can sort the values.Does it make sense to use the norm here?
Beta Was this translation helpful? Give feedback.
All reactions