mardi 10 novembre 2020

What is the best synchronisation strategy to use when you have different entity clones whose certain fields should always be in sync

I'm trying to refactor the feature of the application responsible for sharing certain entities.

As of now it works as follows:

  1. Every entity has a field with coOwnerIds (a list of ids of the users that this entity has been shared with), it also has a field called syncedWith that contains a list of ids of the entity has been synchronised with. When such an entity gets shared, its clone is created for the user it gets shared with. Thus those clones must be synchronised with the original as well as each other.

  2. When some update on any of those entities occurs, that update should also happen on all the clones.

I'm trying to come up with a strategy that would simplify the synchronisation process. I'm thinking of the Observable pattern, but not sure it fits in well for this purpose.

Aucun commentaire:

Enregistrer un commentaire