This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Question about <handle-version-data> pairs in open mesh framework

according to the introduction of mesh framework( value storage part), it says all mesh data is saved in a structure. My understanding is : Handle means a trickle instance reference, value is the data of mesh packet, and version is somehow like a sequence number of mesh packet of this value, is this right? if my understanding is right, does that mean mesh framework create a trickle instance for the mesh pakcet if only the data in mesh packet is different from others?

Parents
  • Hi,

    The first statement is correct. For every new value you push to a specific handle, the version number is incremented by one. This way, the other devices know to replace their current data entry for that handle with the new data.

    When pushing new data, you always have to specify the handle you want to push it to. The framework will increase the version number of that handle, but it won't create a new trickle instance. Instead, it'll use that handle's running trickle instance (if any), replace the data, and reset the interval.

    If two devices write to the same handle at the same time (ie with the same version number), you will have a conflict. This is normally detected by the other devices, but it will lead to strange behavior, and it is recommended to avoid this scenario at all costs, as it is very likely to desync your state across devices.

Reply
  • Hi,

    The first statement is correct. For every new value you push to a specific handle, the version number is incremented by one. This way, the other devices know to replace their current data entry for that handle with the new data.

    When pushing new data, you always have to specify the handle you want to push it to. The framework will increase the version number of that handle, but it won't create a new trickle instance. Instead, it'll use that handle's running trickle instance (if any), replace the data, and reset the interval.

    If two devices write to the same handle at the same time (ie with the same version number), you will have a conflict. This is normally detected by the other devices, but it will lead to strange behavior, and it is recommended to avoid this scenario at all costs, as it is very likely to desync your state across devices.

Children
No Data
Related