Summary of the invention
The technical problem to be solved in the present invention provides a kind of can the minimizing needs data quantity transmitted in the data sync, promote method of data synchronization, system and client, the server of data synchronization efficiency.
For solving the problems of the technologies described above, embodiments of the invention provide technical scheme as follows:
On the one hand, embodiments of the invention provide a kind of method of data synchronization, comprising:
User end to server sends update request, carries local unique identification and two above secondary finger print datas in the described update request;
Described client receives the synchronization request that carries the secondary finger print data that described server returns, and the secondary finger print data that carries in the described synchronization request is and the inconsistent secondary finger print data of the secondary finger print data of described server stores;
The corresponding data item of secondary finger print data that described client is carried in described server transmission and described synchronization request.
Wherein, can also carry the one-level finger print data in the described update request.
Further, described user end to server also comprises before sending update request:
Described client generates the one-level finger print data according to described local unique identification by the fingerprint generating algorithm;
Described client is encoded to two above data item under the described local unique identification, and generates two the above secondary finger print datas corresponding with described data item according to described coding by the fingerprint generating algorithm.
Embodiments of the invention also provide a kind of method of data synchronization, comprising:
Server receives the update request that client sends, and carries local unique identification and two above secondary finger print datas in the described update request;
Described server is compared described two above secondary finger print datas with the secondary finger print data of being stored, the inconsistent secondary finger print data of secondary finger print data that finds out Yu stored;
Described server sends the synchronization request that carries described inconsistent secondary finger print data to described client, and request transmits and the corresponding data item of described inconsistent secondary finger print data.
Wherein, also comprise before the update request that described server reception client sends:
Described server defines the local unique identification of described client and the corresponding relation between the global unique identification, and stores described corresponding relation.
Wherein, described server is compared described two above secondary finger print datas and is comprised with the secondary finger print data of being stored:
Local unique identification that described whois lookup is stored and global unique identification corresponding relation are found out and the corresponding global unique identification of local unique identification that receives;
Described server is compared two received above secondary finger print datas with the secondary finger print data under the described global unique identification.
Further, also carry the one-level finger print data in the described update request, described server also comprises before described two above secondary finger print datas are compared with the secondary finger print data of being stored:
Described server judges that one-level finger print data that carries in the described update request and the one-level finger print data of being stored are inconsistent.
Embodiments of the invention also provide a kind of client, comprising:
Sending module is used for sending update request to server, carries local unique identification and two above secondary finger print datas in the described update request;
Receiver module is used to receive the synchronization request that carries the secondary finger print data that described server returns, and the secondary finger print data that carries in the described synchronization request is and the inconsistent secondary finger print data of the secondary finger print data of described server stores;
Respond module is used for sending the corresponding data item of secondary finger print data of carrying with described synchronization request to described server.
Wherein, described client also comprises:
Coding module is used for two above data item under the described local unique identification are encoded;
Generation module is used for generating two the above secondary finger print datas corresponding with described data item according to described coding by the fingerprint generating algorithm.
Embodiments of the invention also provide a kind of server, comprising:
Receiver module is used to receive the update request that client sends, and carries local unique identification and two above secondary finger print datas in the described update request;
Comparison module, two above secondary finger print datas that are used for described receiver module is received are compared with the secondary finger print data of being stored, the inconsistent secondary finger print data of secondary finger print data that finds out Yu stored;
Processing module is used for sending the synchronization request that carries described inconsistent secondary finger print data to described client, and request transmits and the corresponding data item of described inconsistent secondary finger print data.
Wherein, described server also comprises:
Definition module is used to define the local unique identification of described client and the corresponding relation between the global unique identification;
Memory module is used to store described corresponding relation.
Wherein, described comparison module comprises:
Search submodule, be used to search the local unique identification of described memory module storage and the corresponding relation of global unique identification, find out the corresponding global unique identification of local unique identification that receives with described receiver module;
Comparison sub-module, two above secondary finger print datas that are used for described receiver module is received are compared with the secondary finger print data under the described global unique identification, find out with described global unique identification under the inconsistent secondary finger print data of secondary finger print data.
Embodiments of the invention also provide a kind of data synchronous system, comprising:
Client, be used for sending update request to server, carry local unique identification and two above secondary finger print datas in the described update request, receive the synchronization request that carries the secondary finger print data that described server returns, the secondary finger print data that carries in the described synchronization request is and the inconsistent secondary finger print data of the secondary finger print data of described server stores the corresponding data item of secondary finger print data of carrying in described server transmission and described synchronization request;
Described server, be used to receive the update request that client sends, described two above secondary finger print datas are compared with the secondary finger print data of being stored, the inconsistent secondary finger print data of the secondary finger print data that finds out and stored, send the synchronization request that carries described inconsistent secondary finger print data to described client, request transmits and the corresponding data item of described inconsistent secondary finger print data.
Embodiments of the invention have following beneficial effect:
In the such scheme, server is compared two above secondary finger print datas that client sends with the secondary finger print data of self storing, the inconsistent secondary finger print data of the secondary finger print data of finding out and being stored, and to client transmission synchronization request, request transmits and the corresponding data item of this inconsistent secondary finger print data.By technical scheme provided by the invention, client only need be transferred to server with the corresponding data item of inconsistent secondary finger print data, and do not need all data item all are transferred to server, having reduced needs data quantity transmitted, reaches the purpose that promotes data synchronization efficiency.
Embodiment
For technical problem, technical scheme and advantage that embodiments of the invention will be solved is clearer, be described in detail below in conjunction with the accompanying drawings and the specific embodiments.
Embodiments of the invention are in the available data simultaneous techniques, need data quantity transmitted bigger, the problem that the efficient of data sync is lower, provide a kind of can the minimizing to need data quantity transmitted in the data sync, promote method of data synchronization, system and client, the server of data synchronization efficiency.
As shown in Figure 1, the embodiments of the invention method of data synchronization comprises:
Step 101, user end to server send update request, carry local unique identification and two above secondary finger print datas in this update request;
The synchronization request that carries the secondary finger print data that step 102, client reception server return, the secondary finger print data that carries in this synchronization request is and the inconsistent secondary finger print data of the secondary finger print data of server stores;
The corresponding data item of secondary finger print data of carrying instep 103, user end to server transmission and this synchronization request.
Wherein, can also carry and the corresponding one-level finger print data of this part unique identification in the update request that user end to server sends, the one-level finger print data finger print data that just client generates according to all data item of storage in the prior art, if the one-level finger print data that one-level finger print data that client sends and server are stored is inconsistent, server is compared above-mentioned two above secondary finger print datas with the secondary finger print data of being stored, the inconsistent secondary finger print data of secondary finger print data that finds out Yu stored.If the one-level finger print data that client sends is consistent with the one-level finger print data that server is stored, then server no longer compares the secondary finger print data, adds the workload that the one-level finger print data can reduce server in update request.
Among this embodiment, client is after receiving the synchronization request that carries the secondary finger print data that server returns, only need and to send to server with the corresponding data item of this secondary finger print data, and do not need to transmit all data item, having significantly reduced needs data quantity transmitted, has promoted data synchronization efficiency.
As shown in Figure 2, embodiments of the invention also provide a kind of method of data synchronization, comprising:
Step 201, server receive the update request that client sends, and carry local unique identification and two above secondary finger print datas in this update request;
Step 202, server are compared above-mentioned two above secondary finger print datas the inconsistent secondary finger print data of secondary finger print data that finds out Yu stored with the secondary finger print data of being stored;
Step 203, server send the synchronization request that carries this inconsistent secondary finger print data to client, and request transmits and the corresponding data item of this inconsistent secondary finger print data.
Can also carry and the corresponding one-level finger print data of this part unique identification in the update request that the client that server receives sends, if the one-level finger print data that one-level finger print data that client sends and server are stored is inconsistent, server is compared above-mentioned two above secondary finger print datas again with the secondary finger print data of being stored, the inconsistent secondary finger print data of secondary finger print data that finds out Yu stored.If the one-level finger print data that client sends is consistent with the one-level finger print data that server is stored, then server no longer compares the secondary finger print data, and the introduction of one-level finger print data can reduce the workload of server.
Among this embodiment, secondary finger print data that server relatively receives and the secondary finger print data of being stored, the inconsistent secondary finger print data of the secondary finger print data that finds out and stored, and sending the synchronization request carry this inconsistent secondary finger print data to client, request transmits and the corresponding data item of this inconsistent secondary finger print data.In the present embodiment, server just request transmits the data item that changes, and does not need to ask to transmit all data item, and having significantly reduced needs data quantity transmitted, has promoted data synchronization efficiency.
As shown in Figure 3, embodiments of the invention provide a kind of client, comprising:
Sendingmodule 31 is used for sending update request to server, carries local unique identification and two above secondary finger print datas in this update request;
Receiver module 32 is used for the synchronization request that carries the secondary finger print data that reception server returns, and the secondary finger print data that carries in this synchronization request is and the inconsistent secondary finger print data of the secondary finger print data of server stores;
Respondmodule 33 is used for sending the corresponding data item of secondary finger print data of carrying with this synchronization request to server.
Further, this client also comprises:
Coding module 34 is used for two above data item under this part unique identification are encoded;
Generation module 35 is used for generating two the above secondary finger print datas corresponding with above-mentioned data item according to above-mentioned coding by the fingerprint generating algorithm.
Wherein,generation module 35 also is used for generating the one-level finger print data according to this part unique identification by the fingerprint generating algorithm, and sendingmodule 31 can also carry and the corresponding one-level finger print data of this part unique identification in the update request that server sends.
Among this embodiment, client is after receiving the synchronization request that carries the secondary finger print data that server returns, only need and to send to server with the corresponding data item of this secondary finger print data, and do not need to transmit all data item, having significantly reduced needs data quantity transmitted, has promoted data synchronization efficiency.
As shown in Figure 4, embodiments of the invention provide a kind of server, comprising:
Receiver module 41 is used to receive the update request that client sends, and carries local unique identification and two above secondary finger print datas in this update request;
Comparison module 42, two above secondary finger print datas that are used forreceiver module 41 is received are compared with the secondary finger print data of being stored, the inconsistent secondary finger print data of secondary finger print data that finds out Yu stored;
Processing module 43 is used for sending the synchronization request that carries this inconsistent secondary finger print data to client, and request transmits and the corresponding data item of this inconsistent secondary finger print data.
Further, this server also comprises:
Definition module 44 is used to define the local unique identification of client and the corresponding relation between the global unique identification;
Memory module 45 is used to store this corresponding relation.
Further,comparison module 42 comprises:
Search submodule 46, be used to search the local unique identification ofmemory module 45 storages and the corresponding relation of global unique identification, find out the corresponding global unique identification of local unique identification that receives withreceiver module 41;
Comparison sub-module 47, two above secondary finger print datas that are used forreceiver module 41 is received are compared with the secondary finger print data under this global unique identification, find out with this global unique identification under the inconsistent secondary finger print data of secondary finger print data.
Can also carry in the update request thatreceiver module 41 receives and the corresponding one-level finger print data of this part unique identification,memory module 45 also stores one-level finger print data that should global unique identification,comparison module 42 is compared the one-level finger print data that receives earlier with the one-level finger print data of being stored, when above-mentioned one-level finger print data is inconsistent, secondary finger print data that relatively receives again and the secondary finger print data of being stored.
Wherein, the data item under the local unique identification that client sent beforememory module 45 also stored and the secondary finger print data of corresponding data item, behind the inconsistent secondary finger print data of secondary finger print data thatcomparison sub-module 47 finds out and stored,processing module 43 sends the synchronization request that carries this secondary finger print data to client, and request transmits and the corresponding data item of this secondary finger print data.
Among this embodiment, server is compared the one-level finger print data that receives earlier with the one-level finger print data of being stored, if it is inconsistent, then continue secondary finger print data that relatively receives and the secondary finger print data of being stored, the inconsistent secondary finger print data of the secondary finger print data that finds out and stored, and sending the synchronization request carry this inconsistent secondary finger print data to client, request transmits and the corresponding data item of this inconsistent secondary finger print data.In the present embodiment, server just request transmits the data item that changes, and does not need to ask to transmit all data item, and having significantly reduced needs data quantity transmitted, has promoted data synchronization efficiency.
As shown in Figure 5, embodiments of the invention provide a kind of data synchronous system, comprising:
Client 51, be used for sending update request toserver 52, carry local unique identification and two above secondary finger print datas in this update request, the synchronization request that carries the secondary finger print data thatreception server 52 returns, the secondary finger print data that carries in this synchronization request is the inconsistent secondary finger print data of storing withserver 52 of secondary finger print data, the corresponding data item of secondary finger print data of carrying inserver 52 transmissions and this synchronization request;
Server 52, be used to receive the update request thatclient 51 sends, above-mentioned two above secondary finger print datas are compared with the secondary finger print data of being stored, the inconsistent secondary finger print data of the secondary finger print data that finds out and stored, send the synchronization request that carries above-mentioned inconsistent secondary finger print data toclient 51, request transmits and the corresponding data item of above-mentioned inconsistent secondary finger print data.
Each mobile phone terminal all has unique local unique identification, under the local unique identification to data item concrete more than two should be arranged, such as name data item, image dataitem etc.Client 51 produces the one-level finger print data according to this part unique identification by the fingerprint generating algorithm, and the data item under this part unique identification encoded, such as the name data item is compiled is 1, it is 2 that the image data item is compiled, coding according to data item produces the secondary finger print data by the fingerprint generating algorithm then, each data item Figure 6 shows that the one-level finger print data ofclient 51 generations and the corresponding relation schematic diagram between the secondary finger print data to a secondary finger print data should be arranged.Client 51 sends toserver 52 with all finger print datas, local unique identification and all data item and backs up after generating one-level finger print datas and two above secondary finger print datas.
52 pairs of servers should have anabove client 51,server 52 is that eachclient 51 is distributed a global unique identification, and set up as shown in Figure 7 local unique identification and the corresponding relation between the global unique identification, after the data thatserver 52reception clients 51 send over, as shown in Figure 8, with two above secondary finger print datas and corresponding store data items under the catalogue of the global unique identification of correspondence.
Below in conjunction with system shown in Figure 5 method of data synchronization of the present invention is described in detail, as shown in Figure 9, present embodiment comprises:
Step 901,client 51 generate one-level finger print data and two above secondary finger print datas;
Afterclient 51 is initiated data sync,client 51 utilizes the fingerprint generating algorithm to produce the one-level finger print data according to the local unique identification of mobile phone terminal, if any data item under should the part unique identification changes, this one-level finger print data also can change so.
Client 51 utilizes the fingerprint generating algorithm to produce the secondary finger print data according to the coding of each data item under the local unique identification, and each data item is to having a secondary finger print data, the corresponding one-level finger print data of all data item.If change has taken place a certain data item in the client, client will be to this data item recompile so, also can change to secondary finger print data that should data item; If a certain data item in the client is deleted, client will be deleted secondary finger print data that should data item; If added a certain data item in the client, client can be encoded to this data item so, and generates secondary finger print data that should data item, and the change of any secondary finger print data will cause the one-level finger print data also to change;
Step 902,client 51 send update request toserver 52;
Client 51 sends update requests toserver 52, comprises local unique identification, one-level finger print data, two above secondary finger print datas and data item coding in this update request;
The one-level finger print data of the one-level finger print data that step 903,server 52 relatively receive and self storage;
Server 52 is searched the local unique identification of storage and the corresponding relation between the global unique identification, the corresponding global unique identification of local unique identification of finding out and receiving sees whether the one-level finger print data of this global unique identification correspondence is consistent with the one-level finger print data that receives.If consistent, show that all data item under this part unique identification all do not change, all data item ofclient 51 storages just all do not send and change, and thenserver 52 does not require the transmission of any data item in the response of returning toclient 51; If inconsistent, show that change has taken place the data item under this part unique identification, just variation has taken place inclient 51 stored data items, turns to step 904;
The secondary finger print data of the secondary finger print data that step 904,server 52 relatively receive and self storage finds out inconsistent secondary finger print data;
Server 52 can know that by searching secondary finger print data that relatively receives and the secondary finger print data of self storing variation has taken place which data item ofclient 51,server 52 is compared the secondary finger print data under this global unique identification with the secondary finger print data that receives, find out inconsistent secondary finger print data, comprise secondary finger print data newly-increased, that delete and change;
Step 905,server 52 send the synchronization request that carries this inconsistent secondary finger print data toclient 51, and the request transmission is to data item that should inconsistent secondary finger print data;
If newly-increased secondary finger print data is arranged, show that thenclient 51 has increased newly data item that should the secondary finger print data; If the secondary finger print data that changes shows that then change has taken place the data item that 51 pairs of clients should the secondary finger print data; If the secondary finger print data of deletion is arranged, show that thenclient 51 deleted data item that should the secondary fingerprint data.Server 52 is by comparison secondary finger print data, which variation has taken place in the data that can clearly knowclient 51 storages, then the data item that only needs the request transmission to change gets final product, avoided after finding that the one-level finger print data changes, ask all data item oftransmission client 51 storages, significantly reduced the transmission quantity of data sync;
Step 906,client 51 will send toserver 52 to data item that should inconsistent secondary finger print data;
Step 907,server 52 upgrade self stored data items and finger print data.
Theserver 52 one-level finger print data of storage before replaces with the one-level finger print data that receives, and replaces with the data item that receives with sending the data item that changes, and upgrades the secondary finger print data of this data item correspondence simultaneously.If increased data item in the client newly, this newly-increased data item ofserver 52 storages and corresponding secondary finger print data; If deleted data item in the client,server 52 these data item of deletion and corresponding secondary finger print data; If the data item in the client changes,server 52 upgrades this data item and corresponding secondary finger print data.By above-mentioned steps 901~907, just finished the data sync between the client and server.
Among this embodiment, also can include only local unique identification and two above secondary finger print datas in the update request, server is after receiving update request, two above secondary finger print datas that directly will receive compare with the secondary finger print data under the corresponding global unique identification, search inconsistent secondary finger print data.When the data item of client does not change, can avoid again the secondary finger print data being compared by in update request, carrying the one-level finger print data, reduced the workload of server.
Adopt the fingerprint generating algorithm to generate finger print data in the embodiment of the invention, and come the judgment data item whether to change by the variation of finger print data, some similar algorithms can be used in embodiments of the present invention equally, such as adopting the MD5 algorithm that data item is carried out digital signature, come the judgment data item whether to change according to the variation of digital signature.The embodiment of the invention adopts the data that the secondary finger print data relatively reduces needs transmission, along with the segmentation of data item and further increasing of data volume, can also adopt three grades or the above finger print data coupling of level Four further to reduce the data that need transmit.
The technical scheme of the embodiment of the invention not only can be applied in mobile phone terminal and data in server synchronously in, can also be applied in other scenes that need data sync simultaneously.
Among this embodiment, server stores one-level finger print data and the secondary finger print data that sends before the client in advance, receive one-level finger print data and secondary finger print data that client sends afterwards, and the one-level finger print data that receives compared with the one-level finger print data of being stored, if it is inconsistent, then continue secondary finger print data that relatively receives and the secondary finger print data of being stored, the inconsistent secondary finger print data of the secondary finger print data that finds out and stored, and sending the synchronization request carry this inconsistent secondary finger print data to client, request transmits and the corresponding data item of this inconsistent secondary finger print data.In the present embodiment, the data item that client only need change to Server Transport, and do not need to transmit all data item, having significantly reduced needs data quantity transmitted, has promoted data synchronization efficiency.
Described method embodiment is corresponding with described device embodiment, the description of relevant portion gets final product among the part comparable device embodiment that does not describe in detail in method embodiment, and the description of relevant portion gets final product among the part reference method embodiment that does not describe in detail in device embodiment.
One of ordinary skill in the art will appreciate that, realize that all or part of step in the foregoing description method is to instruct relevant hardware to finish by program, described program can be stored in the computer read/write memory medium, this program is when carrying out, comprise step as above-mentioned method embodiment, described storage medium, as: magnetic disc, CD, read-only storage memory body (Read-Only Memory, ROM) or at random store memory body (Random Access Memory, RAM) etc.
In each method embodiment of the present invention; the sequence number of described each step can not be used to limit the sequencing of each step; for those of ordinary skills, under the prerequisite of not paying creative work, the priority of each step is changed also within protection scope of the present invention.
The above is a preferred implementation of the present invention; should be pointed out that for those skilled in the art, under the prerequisite that does not break away from principle of the present invention; can also make some improvements and modifications, these improvements and modifications also should be considered as protection scope of the present invention.