Local and remote data synchronisation
We have a local server with an access database which feeds data to clients in the same domain. Now we also have a website which is hosted externally, and working on a bridge system to provided upload/downloaded functionality of products, categories and orders etc.
Products, categories and customers etc. can only be added locally, however, orders can be added both locally and on the website. We are trying to have these synchronised by the bridge开发者_开发技巧 application which uses Web Services. We have had this working but have come across more issues. Our current approach is:
- Every individual record has a local id (luid) and a web server id (suid), one example of usage is when an item is added on the website, it is given a unique suid and the luid is -1, once the item is downloaded by the bridge application, an luid is applied and updated. This is the inverse for items added on the local server.
- Every indivdual record also has a flag field (highlighting insert, update, remove(from the website) and delete).
The above works well - apart from the luid and suid approach has made it impossible to easily track record relationships once an item is downloaded. This approach only seems to work well for one-way data - i.e. just uploading products to the website for viewing (and updating and removing them dynamically).
To solve this problem I have considered using GUIDs or perhaps COMBs GUID approach which means that items can be added on both sides and synced appropriately, thought the performance hit concerns me slightly.
Some important points are:
- The local server is the data "base camp" where everything needs to be (eventually) stored.
- Only the local bridge application can make requests to the web server due to web services.
- Needs to support the chance the there may not always be an internet connection, so requesting unique IDs from the web server is not ideal.
Does anyone have an opinion on a much better programming approach to handling this sort of 'synchronisation'?
A unique id is surely going to simplify things. I don't see why you need to be concerned about performance, the GUID can be constructed from something machine-specific or ids can be issued in tranches so that normalid construction is a purely local activity.
精彩评论