Skip to content

Instantly share code, notes, and snippets.

@jayjayswal
Last active August 29, 2015 14:15
Show Gist options
  • Save jayjayswal/8bc425eeb0fa66684afd to your computer and use it in GitHub Desktop.
Save jayjayswal/8bc425eeb0fa66684afd to your computer and use it in GitHub Desktop.
Version Control System and Synchronization System between Desktop and Web applications

Version Control System and Synchronization System between Desktop and Web applications

Activity log created at local desktop database

Steps:

  1. When internet connected, first update all activity log from local database to server.
  2. Download snippet info(xml) from database
  3. Compare it with local database (update newly created snippet from server to DA and delete snippet if it’s exist on DA but not at server.

Required Variables:

  • Snippet ID
  • Version Number
  • Version time stamp
  • Desktop app UID or Web app UID (Exception case)
  • Updated device ID
  1. Manage entry of new Code Snippet
Case Solution
New snippet at server side Download latest and old version of that snippet and update local desktop database (at step 3)
New snippet at desktop app Upload latest and old version of that snippet and update server database (at step 1)
Exception Case:Consider situation when DA not connected to internet,And last snippet ID is 10005.If user add snippet via webapp then its ID will be 10006.But, client’s DA is not updated yet. So if user add another snippet at via Desktop app then it will also have ID 10006. And then if user connect to internet it will create conflict. 1. Give every desktop app unique ID(DAUID) and register it with user. And make snippet ID and DAUID cluster primary key.So conflict can resolved by DAUID checking.(at step 1 & 3 both) OR 2. U have to restrict user to add snippet when Internet connection not available.
  1. Manage removing Code Snippet
Case Solution
delete snippet at server from desktop app Delete snippet and it’s old version at server (step 1)
delete snippet at desktop app from server Delete snippet and it’s old version at local database (step 3)
  1. Manage Version control (update) of code snippet
Case Solution
update snippet at server from desktop app update snippet and store it’s old version at server (step 1)
Update snippet at desktop app from server update snippet and store it’s old version at local database (step 3)
Exception case:Just like create exception case, If update made by both web app and DA then version no. will be same. At a time of first step we check time stamp too, If time stamp different then it means conflict occur, so upload all updates to server then re arrange it by time stamp then again download it. OR Don’t allow user to update snippet when internet is not available.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment