trachten / cpisync

A library for synchronizing remote data with minimum communication.
GNU General Public License v3.0
26 stars 11 forks source link

Why do we have both SyncMethod.elements and GenSync.myData? #81

Open novakboskov opened 3 years ago

novakboskov commented 3 years ago

SyncMethods such as IBLTSync use SyncMethod.elements to store their data (pointers to DataObject). Why don't they use GenSync.myData?

GenSync and SyncMethod are in 1-to-1 relation, means one GenSync has one SyncMethod, as per GenSync.h:570. What is the reason to store apparently the same information in these two places?

arorashu commented 3 years ago

So what I have found is that GenSync is a container around SyncMethod (and data and Communicants). So, SyncMethod does not actually have access to the GenSync.myData object. Now, all of the syncs implement SyncMethod. The abstraction for data in SyncMethods then is SyncMethod.element. This is for most purposes, just a list of all the elements, just like GenSync.myData.

Now, some sync implementations, use this SyncMethod.elements information through the SyncMethod::getNumElement() function. This is most heavily used by InteractiveCPISync. Which uses the add and delete methods for SyncMethod.elements.

All of the other sync implementations do not actually use this SyncMethod.elements. So, implementation changes would be needed for InteracticeCPISync (and minor changes for other syncs), if we decide to remove this object.