mardi 19 décembre 2017

Implementation Design: Synchronised objects between multiple machines

We implemented a synchronization of a users data-objects between all of a users machines by uploading it to our database server. The object can be modified on the server and on the users machines itself and will be downloaded automatically onto all machines the users logs in on.

Concerning data-updates of the object, we apply the rule "first come, first served", which is important as changes can be made without server connection and then are uploaded once connection is re-established. Those scenarios are very unlikely anyway, so we can deal with those.

However, a problem for us is deleting the object. When the user decides to delete the object from any machine (from the local app or the web-end), how do we notify all the machines holding this object that the object is deleted?

Each object holds an unique ID. Normally we could just figure out whether the ID of any given object on a machine is existing in the users server-space, if not, delete it locally. However, we eventually want to allow manual sharing of those objects, meaning users should be able to upload the folder in which those objects are stored on their local disk and upload them, for any other user usable right away, by putting it in the right directory in their app-folder. Meaning, if an ID is not represented on the server, we do not delete it but upload it (as we have completely autonomous syncing). Those objects are not actually shared but mere copies, meaning that when I share an object manually, upon upload the server will assign this object a new, unique ID, as the objects will be stored in user relative, private web-space.

Now the question still is, how can we notify all other machines that an object is no longer existing on the server, and we do not want to upload it again (as the application currently would do). One idea was to keep an ever growing list of ID's that have been deleted on the server and first check if the ID is included in there, but this just sounds so wrong and un-clean to me.

I would appreciate any ideas and thoughts about this. Would it make sense to disable manual sharing and implement some sort of link-share system where you can generate a link, or some sort of code / share-ID for any object, with which other users can add other peoples objects to their accounts - which then would allow to use the missing ID as an indicator to delete the object locally - or do you see any more elegant solution?

Thanks in advance.

Aucun commentaire:

Enregistrer un commentaire