Summary of the invention
The purpose of the embodiment of the invention is to provide a kind of method of data synchronization, client and server, in order to solve the problem that fingerprint is compared that blindly sends, reduces the mutual of server and client, save radio resources.
For achieving the above object, the embodiment of the invention provides a kind of method of data synchronization, and this method comprises: the server data modification information that reception server is sent; Client data modification information and described server data modification information are compared, obtain identical data item identifier; Send described identical data item identifier clients corresponding data content and fingerprint to server, be used for the corresponding synchrodata of described server change server, described fingerprint is the numerical value that one group of data is obtained after by algorithm process; Or, receive described identical data item identifier corresponding server data content, the synchrodata of client correspondence is changed.
For achieving the above object, the embodiment of the invention also provides a kind of method of data synchronization, this method comprises: to client send server data change information, be used for client and carry out the client data modification information with the comparison of described server data modification information and obtain identical data item identifier; Receive described identical data item identifier clients corresponding data content and fingerprint, synchrodata corresponding in the server is changed, described fingerprint is the numerical value that one group of data is obtained after by algorithm process; Or described identical data item identifier corresponding server data content sent to client, be used for the corresponding synchrodata of described client change.
For achieving the above object, the embodiment of the invention also provides a kind of data sync client end, and this client comprises: the modification information receiving element is used for the server data modification information that reception server is sent; The modification information comparing unit is used for client data modification information and described server data modification information are compared, and obtains identical data item identifier; The modification information processing unit, send described identical data item identifier clients corresponding data content and fingerprint to server, be used for the corresponding synchrodata of described server change server, described fingerprint is the numerical value that one group of data is obtained after by algorithm process; Or, receive described identical data item identifier corresponding server data content, the synchrodata of client correspondence is changed.
For achieving the above object, the embodiment of the invention also provides a kind of data synchronization server, this server comprises: transmitting element, be used for to client send server data change information, described server data modification information is used for client and carries out the client data modification information with the comparison of described server data modification information and obtain identical data item identifier; Processing unit is used to receive described identical data item identifier clients corresponding data content and fingerprint, and synchrodata corresponding in the server is changed, and described fingerprint is the numerical value that one group of data is obtained after by algorithm process; Or described identical data item identifier corresponding server data content sent to client, be used for the corresponding synchrodata of described client change.
Technique scheme has following advantage or beneficial effect:
The invention provides device, method and system that a kind of data sync fingerprint sends, solved and blindly sent the problem that fingerprint is compared, thereby reduced the mutual of both sides, saved Radio Resource.
Embodiment
Below in conjunction with embodiment of the invention accompanying drawing, the technical scheme in the embodiment of the invention is clearly and completely described, obviously, described embodiment only is the present invention's part embodiment, rather than whole embodiment.Based on the embodiment among the present invention, those of ordinary skills belong to the scope of protection of the invention not making the every other embodiment that is obtained under the creative work prerequisite.
Embodiment one
Fig. 1 is the method for data synchronization flow chart of the embodiment of the invention one.As shown in Figure 1, this method comprises:
Step S101: the server data modification information that reception server is sent;
Step S102: client data modification information and described server data modification information are compared, obtain identical data item identifier;
Step S103: send described identical data item identifier clients corresponding data content and fingerprint to server, be used for the corresponding synchrodata of described server change server; Or, receive described identical data item identifier corresponding server data content, the synchrodata of client correspondence is changed.If synchrodata change standard is described client data modification information, then described identical data item identifier clients corresponding data content and fingerprint are sent to server end, be used for changing the corresponding synchrodata of server; If synchrodata change standard is described server data modification information, then the synchrodata of client correspondence is changed according to identical data item identifier corresponding server data content.
In a preferred embodiment, described client data modification information and server data change information can comprise data item identifier and/or synchrodata modification information, and described client data modification information and server data change information also can comprise data item identifier and/or synchrodata deletion information.
Need between existing station terminal equipment and the server to initiate synchronously, the mapping relations of their data item as shown in Figure 5, wherein LUID is unique ID of certain bar data correspondence in the client, GUID is unique ID of certain bar data correspondence in the server.Fig. 6 is the data change information of the Changelog of server, and data change information also can be placed on the Changelog outside of server.Fig. 7 is the data change information of the Changelog of client, and data change information also can be placed on the Changelog outside of client.
According to Fig. 6 as can be known, have 4 data item ABCD1012, ABCD1013, ABCD 1015 and ABCD 1016 to change among the Changelog of server, wherein, ABCD1012 and ABCD 1015 revise, and ABCD1013 and ABCD 1016 are deleted.
In the synchronizing process next time, in PKG2, server will use<ModifyID〉inform the data item ID that change (deletion, revise) has taken place on recipient's server.According to Fig. 6 as can be known, server has 4 data item to change, and detailed process is as follows:
If be as the criterion with client, client is received after the PKG2, through resolving, find that server has four data item that variation has taken place, according to Fig. 7,1012,1015 and 1016 also are present among the Changelog of client, according to the conflict strategy, be as the criterion with client, client will be in PKG3 directly sends 1012,1015 and 1016 data and up-to-date fingerprint so, and detailed process is as follows:
After server is received PKG3, directly give ABCD1012, ABCD1015 and ABCD1016 data item content and new fingerprint.Meanwhile, the Changelog of server as shown in Figure 8.
The beneficial effect of the embodiment of the invention: solved and blindly sent the problem that fingerprint is compared, thereby reduced the mutual of both sides, saved Radio Resource.
Embodiment two
Fig. 2 is the method flow diagram of the embodiment of the invention two.As shown in Figure 2, this method comprises:
Step S201:, be used for client and carry out the comparison of data change information and obtain identical data item identifier to client send server data change information;
Step S202: receive described identical data item identifier clients corresponding data content and fingerprint, synchrodata corresponding in the server is changed; Or described identical data item identifier corresponding server data content sent to client, be used for the corresponding synchrodata of described client change.If synchrodata change standard is described client data modification information, then receive described identical data item identifier clients corresponding data content and fingerprint, synchrodata corresponding in the server is changed; If synchrodata change standard is described server data modification information, then send described identical data item identifier corresponding server data content to client, be used for the corresponding synchrodata of described client change.
In a preferred embodiment, described client data modification information and server data change information for example can comprise data item identifier and/or synchrodata modification information; Described client data modification information and server data change information can also comprise: data item identifier and/or synchrodata deletion information.
Need between existing station terminal equipment and the server to initiate synchronously, the mapping relations of their data item as shown in Figure 5, wherein LUID is unique ID of certain bar data correspondence in the client, GUID is unique ID of certain bar data correspondence in the server.Fig. 6 is the data change information of the Changelog of server, and data change information also can be placed on the Changelog outside of server.Fig. 7 is the data change information of the Changelog of client, and data change information also can be placed on the Changelog outside of client.
According to Fig. 6 as can be known, have 4 data item ABCD1012, ABCD1013, ABCD 1015 and ABCD 1016 to change among the Changelog of server, wherein, ABCD1012 and ABCD 1015 revise, and ABCD1013 and ABCD 1016 are deleted.
In the synchronizing process next time, in PKG2, server will use<ModifyID〉inform the data item ID that change (deletion, modification) taken place on recipient's server, and provide the concrete mode of change.Detailed process is as follows:
If be as the criterion with server, though 1012,1015 and 1016 are present among the Changelog of client, but client does not need to send 1012,1015 and 1016 content and 1012, the fingerprint of 1015 and 1016 correspondences, after server sent to client with the comparison result data, the data that send to server were as follows:
After server was received above-mentioned data, directly with the clauses and subclauses deletion of 1016 data item of server, at this moment, server Changelog as shown in Figure 9.
The beneficial effect of the embodiment of the invention: solved and blindly sent the problem that fingerprint is compared, thereby reduced the mutual of both sides, saved Radio Resource.
Embodiment three
Fig. 3 is the structural representation of the data sync client end of the embodiment of the invention three.As shown in Figure 3, this client comprises: modification information receiving element 301 is used for the server data modification information that reception server is sent; Modification information comparing unit 302 is used for client data modification information and described server data modification information are compared, and obtains identical data item identifier; Modification information processing unit 303 sends described identical data item identifier clients corresponding data content and fingerprint to server, is used for the corresponding synchrodata of described server change server; Or, receive described identical data item identifier corresponding server data content, the synchrodata of client correspondence is changed.
In a preferred embodiment, described modification information processing unit comprises: the standard judgment sub-unit is used to judge that synchrodata change standard is described server data modification information, still described client data modification information; If described client data modification information then triggers first and handles subelement, if described server data modification information then triggers second and handles subelement; First handles subelement, is used for the triggering according to described standard judgment sub-unit, sends described identical data item identifier clients corresponding data content and fingerprint to server, is used for the corresponding synchrodata of described server change server; Second handles subelement, is used for the triggering according to described standard judgment sub-unit, receives described identical data item identifier corresponding server data content, and the synchrodata of client correspondence is changed.
The beneficial effect of the embodiment of the invention: solved and blindly sent the problem that fingerprint is compared, thereby reduced the mutual of both sides, saved Radio Resource.
Embodiment four
Fig. 4 is the structural representation of the data synchronization server of the embodiment of the invention four.As shown in Figure 4, this server comprises: transmitting element 401, be used for to client send server data change information, and described server data modification information is used for client to carry out the comparison of data change information and obtains identical data item identifier; Processing unit 402 is used to receive described identical data item identifier clients corresponding data content and fingerprint, and synchrodata corresponding in the server is changed; Or described identical data item identifier corresponding server data content sent to client, be used for the corresponding synchrodata of described client change.
In a preferred embodiment, described processing unit comprises: judgment sub-unit is used to judge that synchrodata change standard is described server data modification information, still described client data modification information; If described client data modification information then triggers the 3rd and handles subelement, if described server data modification information then triggers the and manages subelement everywhere; The 3rd handles subelement, is used for the triggering according to described judgment sub-unit, receives described identical data item identifier clients corresponding data content and fingerprint, and synchrodata corresponding in the server is changed; The manages subelement everywhere, is used for the triggering according to described judgment sub-unit, sends described identical data item identifier corresponding server data content to client, and described server data content is used for the corresponding synchrodata of described client change.
The beneficial effect of the embodiment of the invention: solved and blindly sent the problem that fingerprint is compared, thereby reduced the mutual of both sides, saved Radio Resource.
Figure 10 is the flow chart of embodiment of the invention data synchronization process.User end to server sends synchronous initiation data PKG1, comprises fingerprint occupation mode negotiation information among the PKG1 or specifies fingerprint occupation mode information.Server sends data PKG2 to client, comprises the server data modification information among the server Changelog among the PKG2.After client is received data PKG2, the client data modification information among the Changelog of server data modification information among the PKG2 and client is compared.If when the client data modification information is synchrodata change standard, then described identical data item identifier clients corresponding data content and fingerprint are sent to server end, are used for changing the corresponding synchrodata of server; If when described server data modification information is synchrodata change standard, then the synchrodata of client correspondence is changed according to the server data content of same data item.
User end to server sends PKG3, comprises data change information among the PKG3, the content and the fingerprint of the data item in the change change daily record.Server sends PKG4 to client, comprises the sign of the data element that server indication client need send among the PKG4.User end to server sends PKG5, comprises among the PKG5 that client sends indicated data element.Server sends PKG6 to client, comprises among the PKG6 that server returns receiving status information, the data that all right send server end is revised.User end to server sends PKG7, comprises among the PKG7 that client returns state and the mapping directive that receives data.Server sends PKG8 to client, comprises among the PKG8 that server returns the state information to mapping directive.Same EOS, client sends to the user with synchronized result.
The beneficial effect of the embodiment of the invention: solved and blindly sent the problem that fingerprint is compared, thereby reduced the mutual of both sides, saved Radio Resource.