StackSync

An open-source scalable personal cloud

Synchronization service

The synchronization service, namely SyncService, is the most important and critical part of the synchronization architecture. It is charge of managing the metadata in order to achieve data synchronization. Desktop clients communicate with the SyncService for two mainly reasons: to obtain the changes occurred when they were offline; and to commit new versions of a files.

When a client connects to the system, the first thing it does is asking the SyncService for changes that were made during the offline time period. This is very common situation for users working with two different computers, e.g., home and work. Assuming the home computer is off, if the user modifies some files while at work, the home computer will not realize about these changes until the user turns on the computer. At this time, the client will ask the SyncService and update to apply the changes made at work.

When the server receives a commit operation of a file, it must first check that the metadata received is consistent. If the metadata is correct, it proceeds to save it to a database. Afterwards, a notification is sent to all devices owned by the user reporting the file update. This provides StackSync with real-time in all devices as they receive notifications of updates and are always synchronized. However, if the metadata is incorrect, an notification is sent to the client to fix the error.