trachten / cpisync

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

GenSync._PostProcessing is needlessly convoluted #79

Open novakboskov opened 4 years ago

novakboskov commented 4 years ago

GenSync._PostProcessing is a private pointer to the function that takes a pointer to the GenSync object and pointers toGenSync::add(...) and GenSync::del(...). It's hard for me to reason about the scenario in which there is no simpler way to achieve the same.

All that GenSync._PostProcessing does is filling GenSync::myData with otherMinusSelf once the GenSync::serverSyncBegin or GenSync::clientSyncBegin is done.

What about simply having a virtual SyncMethod::postProcessing(GenSync&) and simple private members SyncMethod::otherMinusSelf and SyncMethod::selfMinusOther? Then GenSync::...SyncBegin can call myMeth.postProcessing(this) and each SyncMethod is free to implement its own version of post processing.

Additionally, seems like GenSync::myData and private SyncMethod::elements are basically the very same thing and SyncMethod::elements is used only in IBLTSetOfSets. If IBLTSetOfSets needs "elements", that needs to be in IBLTSetOfSet class itself.