Now that we know how to identify particular items we can keep track of them with a transaction log. A transaction log is a history of events that happened since the last sync. This includes the database operations mentioned before: adding, deleting or modifying entries. For a good synchronization, a transaction log has to be kept on every client. The server, on the other side, must keep enough transaction information to know about all changes that happened since the last connect of any client.
Keeping a full transaction log would require much space. Fortunately, this transaction log information can easily be recreated if we have the date of the last change for an entry. We can find the modified entries by comparing their modification date with the date of the last sync. Now, special care is only needed for addition and deletion.
Adding an item is very easy: Since adding is the same as modification of an non-existing item, it can be handled like modification.
Deletion is not as easy. However, there are two simple ways to handle deletion: The first one is to keep empty records, which contain nothing but the UID and the last changed date. When such a record is synchrinized, it is treated as a deletion notice. The second way requires keeping extra information: At every sync we keep a list of items that were synchronized. An item that is missing during the next sync was deleted.
Both ways do not provide a way to distinguish between soft and hard deletion. This is no problem for a server, since it needs only hard deletion. For a client, however, this issue remains unsolved.