A slight bit of change in the plan, now I need to use the sqlite cache in the machine to store the pending actions and events etc. So here is what happens inside calcachedcalendar.js all the sequence of events and functions that happens during the updation of items online or offline.
- When the calendar goes offline and online
- refresh() is called when it goes online after being offline before
- refresh() checks if the calendar is online, then it refreshes the network calendar first then calls the onLoad event where the cachedCalendar gets created again, otherwise, it calls the synchronize method which is responsible for making the offline an online sync changes.
- The synchronize() function, all the logic for the synchronization goes in basically the sync is between the cache stored on the machine and the network. first it takes in pending sync, does all the actions related to the pending sync and then it does ChangeLog calling the replayChangesOn method and lasting if everything fails, it goes and does the full sync, which essentially means throwing away the cache and then just downloading the changes from the network computer.
- When an addItem, adoptItem, deleteItem call is made it first gets routed through the cachedCalendar and then is called to the uncachedCalendar.
- mCachedCalendar pulls its information from the sqlite file. unCachedCalendar is on the network.
More details on the code changes soon!