CN100566234C - Method of data synchronization and processing method, client device, server - Google Patents

Method of data synchronization and processing method, client device, server Download PDF

Info

Publication number
CN100566234C
CN100566234C CNB200710135831XA CN200710135831A CN100566234C CN 100566234 C CN100566234 C CN 100566234C CN B200710135831X A CNB200710135831X A CN B200710135831XA CN 200710135831 A CN200710135831 A CN 200710135831A CN 100566234 C CN100566234 C CN 100566234C
Authority
CN
China
Prior art keywords
data
server
identify label
client
unit
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CNB200710135831XA
Other languages
Chinese (zh)
Other versions
CN101075864A (en
Inventor
黎巍
丁千
刘方敏
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Tencent Technology Shenzhen Co Ltd
Original Assignee
Tencent Technology Shenzhen Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Tencent Technology Shenzhen Co Ltd filed Critical Tencent Technology Shenzhen Co Ltd
Priority to CNB200710135831XA priority Critical patent/CN100566234C/en
Publication of CN101075864A publication Critical patent/CN101075864A/en
Application granted granted Critical
Publication of CN100566234C publication Critical patent/CN100566234C/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Landscapes

  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
  • Information Transfer Between Computers (AREA)

Abstract

The invention discloses a kind of method of data synchronization.The inventive method comprises: identify label position, deletion sign position, modification time that the scanning client has been preserved data stab, and judge whether these data need to be synchronized to server, if, client with this data upload to server; If server parses obtains these data for treating deleted data, then server searches and deletes these data according to identify label; If it is data to be updated that server parses obtains these data, then server is this data allocations identify label, and the data that will carry this identify label return to client storage; If it is data to be updated that server parses obtains these data, then server upgrades the data of the identify label correspondence of having preserved on the server.Adopt method provided by the invention or device to make the data of server and client to be consistent.

Description

Method of data synchronization and processing method, client device, server
Technical field
The present invention relates to Internet technical field, relate in particular to a kind of method of data synchronization and processing method, client device, server.
Background technology
The appearance of the Internet has brought brand-new application service theory to calendar, and the network calendar system substitutes traditional Active Desktop Calendar gradually, and the service of recording events and schedule is provided for people.
The network calendar system is with on the server of network calendar data centralized stores in the Internet, and the user can pass through client arbitrarily, logins the network calendar system of its customization, obtains the data of preserving on the server, and it is edited.Here alleged editor mainly comprises: add data, revise and the deletion data with existing.Such as, the user wants to add a schedule, at this moment, the user only need click the date and the moment in the network calendar system, then, the network calendar system just ejects a simple dialog box, and after the user imported schedule by this dialog box, client can be sent to the data of this schedule server and preserve.
The network calendar system just can normally use after generally needing client and the server of preserving the network calendar data to connect, but because the user obtains the environment that the network condition of network calendar data might be in a kind of change, and the user does not wish when client can't connect with server, be user when being in off-line state, influence the arrangement of schedule.Therefore, there is the subnetwork calendar system that the off-line editing function of network calendar is provided at present, makes the user who is in off-line state also can carry out schedule.
Support the network calendar system of off-line editing need on client and server, all preserve the network calendar data, like this, obtain less than the network calendar data that is kept on the server even if be in the user of off-line state, also can continue to use the network calendar data of client storage to edit.
But, in the process that prior art is put into practice and studied, find to exist at least in the existing network calendar system following problem:
After the user carried out off-line editing to the network calendar data, the network calendar data that the network calendar data of client storage and server are preserved can produce inconsistent.Such as, the user has deleted certain network calendar data under off-line state, but after client and server connected, when promptly the user was in line states, these data still occurred in the network calendar system.
Summary of the invention
The technical problem that the embodiment of the invention will solve provides a kind of method of data synchronization, makes the user after carrying out off-line editing, and the data that the data of client storage and server are preserved can be consistent.
For solving the problems of the technologies described above, embodiment provided by the present invention is achieved through the following technical solutions:
A kind of method of data synchronization comprises:
The data that the scanning client has been preserved, if judging the identify label obtain described data is server-assignment, and, the modification time of described data stabs and is later than the modification time of preserving on the server that has data of common identity sign with described data and stabs, the described data of then described client mark are data to be updated, and described data are sent to server; Described server is according to described mark, upgrade preserve on it have the data of common identity sign with described data;
If judging the identify label obtain described data is server-assignment, and the deleted marker position of described data is set to wait to delete, then client is labeled as the identify label for the treatment of deleted data with the identify label of described data, and sends to server; Described server is deleted the data of described identify label correspondence according to described mark;
If judging the identify label that obtains described data is that described client is distributed, then described client is data to be added with described data markers, and described data are sent to server; Described server is given described data allocations identify label according to described mark, and returns the data of carrying described identify label to described client.
A kind of client data processing method comprises:
Client is obtained user instruction;
Add instruction if described user instruction is data, then described client is the data allocations identify label of input, and preserves the data of carrying described identify label, is data to be added with described data markers, and described data are sent to server;
If described user instruction is the data modification instruction, then described client is according to the identify label of carrying in the described data modification instruction, data to described identify label correspondence are upgraded, and, the modification time that upgrades described data stabs, with described data markers is data to be updated, and described data are sent to server;
If described user instruction is the data delete instruction, then described client is according to the identify label of carrying in the described data delete instruction, the deleted marker position of the data of described identify label correspondence is set to wait to delete, the identify label of described data is labeled as the identify label for the treatment of deleted data, and sends to server.
A kind of client device comprises:
Memory cell is used to preserve data;
Input unit is used to obtain the input of user instruction and data;
The user instruction resolution unit is used to discern the user instruction that input unit obtains;
Data identify label allocation units, if it is that data are added instruction that described user instruction resolution unit is discerned described user instruction, the then data allocations identify label that gets access to for input unit, and the data that will carry described identify label send to memory cell and preserve, with described data markers is data to be added, and described data are sent to server;
First data processing unit, if it is the data modification instruction that described user instruction resolution unit is discerned described user instruction, then according to the identify label of carrying in the described data modification instruction, data to identify label correspondence described in the described memory cell are upgraded, and the modification time that upgrades described data stabs, with described data markers is data to be updated, and described data are sent to server;
Second data processing unit, if it is the data delete instruction that described user instruction resolution unit is discerned described user instruction, then according to the identify label of carrying in the described data delete instruction, the deleted marker position of the data of identify label correspondence described in the described memory cell is set to wait to delete, with described data markers is data to be updated, and described data are sent to server.
A kind of client device comprises:
Memory cell is used to preserve data;
The first data characteristics identification unit, be used for the data of described memory cell are carried out identification, whether comprise: distinguishing the data identify label is to be distributed by server or client, extract the modification time stamp of data or the deleted marker position of judgment data and be set to wait to delete;
The Network Synchronization unit is used for that to carry out data message mutual with server;
Control unit, judge whether to call the Network Synchronization unit according to the identification result of the first data characteristics identification unit and carry out data sync, comprise: if the identification of the first data characteristics identification unit obtains being kept at the identify label of the data of described memory cell is server-assignment, and, the modification time of described data stabs the modification time that is later than the data with common identity sign of preserving on the server and stabs, be data to be updated then, call described Network Synchronization unit described data are sent to server described data markers; If it is server-assignment that identification obtains being kept at the identify label of the data of described memory cell, and, the deleted marker position of described data is set to wait to delete, then the identify label with described data is labeled as the identify label for the treatment of deleted data, calls described Network Synchronization unit the identify label of described data is sent to server; If it is that client is distributed that identification obtains being kept at the identify label of the data of described memory cell, is data to be added with described data markers then, calls described Network Synchronization unit described data are sent to server.
A kind of server comprises:
Memory cell is used to preserve data;
Receiving element is used for carrying out data interaction with client, comprises the data of obtaining client upload, and these data comprise: data to be updated, data to be added or treat the identify label of deleted data;
The second data characteristics identification unit, the type that is used for data that described receiving element is got access to is carried out identification, and call edit cell data are edited, comprise: if identification obtains data is data to be added, then call edit cell and be this data allocations identify label, and the data that will carry this identify label are kept at memory cell, and the data that will carry this identify label return to client storage; If it is data to be updated that identification obtains data, then calls edit cell and upgrade the data that have the common identity sign in the described memory cell with these data; If identification obtains data for treating deleted data, then call the data that described edit cell deletion is kept at described memory cell;
Edit cell is used for the edit cell of safeguarding of data, is used for the maintenance of data.
Technique scheme has following beneficial effect: the embodiment of the invention is stabbed by identify label position, deletion sign position, the modification time of scan-data, judges whether these data need to be synchronized to server, if then these data are sent to server; The type of the data that server parses is received, and operate accordingly according to different data types, make the data of client storage and the data that server is preserved to be consistent.
Description of drawings
The method of data synchronization flow chart that Fig. 1 provides for first embodiment of the invention;
The method of data synchronization flow chart that Fig. 2 provides for second embodiment of the invention;
The method of data synchronization flow chart that Fig. 3 provides for third embodiment of the invention;
The method of data synchronization flow chart that Fig. 4 provides for fourth embodiment of the invention;
The method of data synchronization flow chart that Fig. 5 provides for fifth embodiment of the invention;
The method of data synchronization flow chart that Fig. 6 provides for sixth embodiment of the invention;
The first client device structural representation that Fig. 7 provides for the embodiment of the invention;
The second client device structural representation that Fig. 8 provides for the embodiment of the invention;
The 3rd client device structural representation that Fig. 9 provides for the embodiment of the invention;
The server architecture schematic diagram that Figure 10 provides for the embodiment of the invention.
Embodiment
The method of data synchronization that is provided for the clearer explanation embodiment of the invention, the present invention is an example with the synchronous specific implementation of network calendar data, describe client and server in detail and carry out the process of data sync and the technological means that is adopted, but, method that the embodiment of the invention provided and device be not limited only to the network calendar data synchronously, method and apparatus that the embodiment of the invention provides is applicable to that also other need carry out the system of data synchronization processing.
At first, briefly introduce the data edition mode of the network calendar system that the embodiment of the invention provides, and, further specify, for realizing purpose of the present invention, when the user edits the network calendar data, the necessary operation that client device and server are performed.
In embodiments of the present invention, the data edition mode of described network calendar system comprises: add data, revise data with existing and deletion data with existing.
The first, add data, can be divided into online interpolation data and off-line and add data.
Wherein, described online interpolation data refer to the data that the user adds under the situation that client and server have connected, and these data can be uploaded to server.Concrete, client is data to be added with this data markers, and these data are sent to server, server is this data allocations identify label (ID, identification), preserve and to carry the data of this identify label, and the data that will carry this identify label return to client storage.
In embodiments of the present invention, client is that data to be added are specially with this data markers: client increases the action type field in data, and in this field, insert and be used to represent that these data are the combination of numbers of data to be added, such as, can pre-defined combination of numbers " 00 ", represent that these data are data to be added, if then server is resolved and to be obtained the combination of numbers that the action type field fills in and be " 00 ", server is this data allocations identify label, the data of this identify label are carried in preservation, and the data that will carry this identify label return to client storage.Client also can adopt the type of other mode flag datas in other embodiments of the invention, does not influence the realization of the embodiment of the invention.
In addition, server can take a plurality of bytes for the identify label of data allocations, such as, 32 bytes.
Described off-line adds data and refers to user's interpolation data when client and server fail to connect, and these data are not uploaded to server.Concrete, client is given identify label of this data allocations, and preserves the data of carrying this identify label.
In sum, the identify label of online interpolation data is by server-assignment, and the identify label of off-line interpolation data is distributed by client.For the ease of distinguishing identify label is that client is distributed, or server-assignment, there is a newly-built flag bit to be used to represent this identify label is by whose distribution in the identify label, described newly-built flag bit is usually located at the highest of identify label, can stipulate, the newly-built flag bit of the identify label of server-assignment is always " 1 ", the newly-built flag bit of the identify label that client is distributed is always " 0 ", perhaps, the flag bit of the identify label of server-assignment is always " 0 ", and the flag bit of the identify label that client is distributed is always " 1 ".And, the identify label that server is preserved, and the identify label of client storage all is unique.
By said method as can be known, by judge identify label that newly-built flag bit can decision data be distribute by client or by server-assignment, and then, judge whether the data that obtain client storage once were synchronized to server.Because, no matter the interpolation of network calendar data is carried out under off-line state, still under presence, carry out, when the data sync of adding behind server, server all can be identify label of this data allocations again, and the data that will carry this identify label return to client storage, so, if the identify label of the data of client storage is a server-assignment, illustrate that then these data once were synchronized to server, distribute if the identify label of the data of client storage is a client, the data of adding when these data then are described for off-line also are not synchronized to server.
The second, revise data with existing, can be divided into online modification data with existing and off-line and revise data with existing.
Wherein, described online modification data with existing refers to the user and revise data when client and server connects, and these amended data can be synchronized to server.Concrete, the modification time that client is upgraded these data stabs, and amended data are sent to server, and is data to be updated with this data markers; Server is according to the identify label of this data carry, searches and upgrades preservation has the common identity sign thereon with these data data.
Such as, the user has revised certain data 9 o'clock on the 30th May in 2007, then client is updated to the modification time stamp of these data 9 o'clock on the 30th May in 2007, client sends to server with amended data, and with data class to be added seemingly, client is that data to be updated are specially with amended data markers: client increases the action type field in data, and inserts in this field and be used to represent that these data are the combination of numbers of data to be updated.
With respect to the online modification data with existing, the difference that described off-line is revised data with existing is: the user is the modification data when client and server do not connect, and these amended data are not uploaded on the server.Concrete, the modification time that client is upgraded these data stabs, and preserves amended data.
The 3rd, the deletion data with existing can be divided into online deletion data with existing and off-line deletion data with existing.
Wherein, described online deletion data with existing refers to user's deleted data when client and server connects, concrete, client is deleted these data of preserving on it, with data to be added and data class to be updated seemingly, client increases the action type field in the identify label of these data, and fill in this field and predefinedly to be used to represent that these data are to treat the combination of numbers of deleted data, send this identify label to server, whois lookup is to the data of this identify label correspondence, and deletion.
Combination of numbers that it should be noted that the action type Field Definition cannot repeat or produce conflict, such as, pre-defined " 00 " expression data are data to be added, then cannot represent that with this combination of numbers data are for treating deleted data or data to be updated again.
With respect to online deletion data with existing, the off-line deleted data refers to user's deleted data when client and server do not connect, and the processing of this deleted data is only carried out in client.Concrete, the deleted marker position of these data of client is set to wait to delete.Be set to " 1 " such as, the deleted marker position of pre-defined data and represent that these data wait to delete, and the deleted marker position of data is set to " 0 " or deletion action is not carried out to data for empty expression in the deleted marker position.
The data of off-line editing of network calendar system and the data of online editing have below briefly been narrated, after client inserts the Internet and connects with server, server need carry out data sync with client, what is called is exactly that client and data in server are consistent synchronously, and this synchronizing process comprises following two links:
The first, client will be preserved on the server, and the data sync that client does not have to preserve is got off.
To achieve these goals, the technological means that the embodiment of the invention adopted specifically comprises:
After client and server connect, client is stabbed the up-to-date modification time of preserving on it and is sent to server, server stabs the up-to-date modification time stamp of preserving with himself with this modification time and compares, if stabbing, the up-to-date modification time of server is later than the up-to-date modification time stamp of client, then show and preserved data new for client on the server, and then, whois lookup is preserved to the server stabs the up-to-date modification time of server from the up-to-date modification time of described client and stabs, data during this period of time, and those data are sent to client storage.Stab such as the up-to-date modification time of, client and to be: 9 o'clock on the 30th May in 2007, and the up-to-date modification time of server stabs and is: 11 o'clock on the 30th May in 2007, then server stabs modification time 9 and all sends to client storage up to all data of 11 o'clock.
The second, if preserve the data of off-line editing on the client, then client arrives server with the data sync of described off-line editing, the data consistent that makes the preservation of client and server.
Generally, after client and server connect, need earlier the data sync on the server to be got off, then, the data sync with off-line editing arrives server again, but does not get rid of other possibilities.
Below in conjunction with accompanying drawing, the data sync of off-line editing is specified the implementation of the embodiment of the invention with regard to described client to this link of server.
Referring to Fig. 1, the method for data synchronization that first embodiment of the invention provides comprises:
Step 101: client scan has been preserved the identify label of data, judges that whether this identify label is server-assignment, if then execution in step 102, if not, then execution in step 107;
Wherein, whether the judgment data identify label is method that server distributed referring to relevant portion above.
Step 102: scan the deleted marker position of these data, judge whether this flag bit is effectively, judges promptly whether this flag bit is set to wait to delete, if then execution in step 103, if not, then execution in step 105;
Step 103: client is deleted on it these data of preserving, and the identify label of these data is labeled as the identify label for the treatment of deleted data, and these data is sent to server, execution in step 104; Whois lookup is to the data and the deletion of this identify label correspondence;
Step 104: client judges whether these data are last data, if, then finish this flow process, if not, then return step 101;
Step 105: the modification time of these data of client scan stabs, relatively this modification time modification time of stabbing these data that whether equal or return early than server stabs, if, then these data do not need synchronously, execution in step 104 if not, illustrates that the modification of these data is new with respect to server, then these data need be synchronized to server, execution in step 106;
Step 106: client is data to be updated with this data markers, and these data is sent to server, execution in step 104; Server resolves according to mark that to obtain these data be data to be updated, then server update its go up preserve have the data that common identity identifies with these data;
Step 107: scan the deleted marker position of these data, judge whether this flag bit is effectively,, if not, illustrate that these data are the data that are in user's interpolation of off-line state, execution in step 109 if then execution in step 108;
Step 108: client is deleted this data, returns step 104;
Step 109: client is data to be added with this data markers, and these data are sent to server, returns step 104; Server resolves according to mark that to obtain these data be data to be added, and then server be identify label of this data allocations, and the data of this identify label are carried in preservation, and the data that will carry this identify label return to client storage.
Wherein, in data synchronization process, client data are carried out mark mode referring to the mark mode of preamble to the online editing data, repeat no more.
The method flow that is provided by first embodiment of the invention as can be seen, scanning process to data is: identify label-->deleted marker position--, and>modification time stabs, wherein, if the identify label of data is distributed by client, illustrate that then these data are data to be added, therefore, as long as whether the deleted marker position of these data of scanning is effectively, and the modification time that does not need to scan these data stabs.
The method of data synchronization flow chart that Fig. 2 provides for second embodiment of the invention, this method to the process of a data scanning is:>deleted marker position comprises in identify label-->modification time stamp--:
Step 201: client scan has been preserved the identify label of data, judges that whether this identify label is server-assignment, if then execution in step 202, if not, then execution in step 207;
Step 202: the modification time of these data of client scan stabs, relatively this modification time whether stab early than or the modification time that equals these data that server returns stab, if, illustrate that then these data do not need synchronously, execution in step 203, if not, then execution in step 204;
Step 203: client judges whether these data are last data, if, the synchronous flow process of end data then, if not, then execution in step 201;
Step 204: the deleted marker position of these data of client scan, judge whether this flag bit is that effectively if then execution in step 205, if not, then execution in step 206;
Step 205: client is deleted on it these data of preserving, and the identify label of these data is labeled as the identify label for the treatment of deleted data, returns step 203; Whois lookup is to the data and the deletion of this identify label correspondence;
Step 206: client is data to be updated with this data markers, and these data are sent to server, returns step 203; Server resolves according to mark that to obtain these data be data to be updated, then upgrade preserve it on have the data that common identity identifies with these data;
Step 207: the deleted marker position of these data of client scan, judge whether this flag bit is that effectively if then execution in step 208, if not, then execution in step 209;
Step 208: client is deleted this data, returns step 203;
Step 209: client is data to be added with this data markers, and these data are sent to server, returns step 203; Server resolves according to mark that to obtain these data be data to be added, and then server be this data allocations identify label, and the data of this identify label are carried in preservation, and the data that will carry this identify label return to client storage.
Figure 3 shows that the method for data synchronization flow chart that third embodiment of the invention provides, this method to the data scanning process is: deleted marker position-->identify label-->modification time stabs, and comprising:
Step 301: client scan has been preserved the deleted marker position of data, judges whether this flag bit is that effectively if then execution in step 302, if not, then execution in step 306;
Step 302: the identify label of these data of client scan, judge whether this identify label is server-assignment, if then execution in step 303, if not, then execution in step 305;
Step 303: client is deleted these data of preserving on it, and the identify label of these data is labeled as the identify label for the treatment of deleted data, execution in step 304; Whois lookup is to the data and the deletion of this identify label correspondence;
Step 304: client judges whether these data are last data, if, then finish this flow process, if not, then return step 301;
Step 305: client is deleted this data, returns step 304;
Step 306: the identify label of these data of client scan, judge whether this identify label is server-assignment, if then execution in step 307, if not, illustrate that these data are data to be added, then execution in step 309;
Step 307: the modification time of these data of client scan stabs, relatively this modification time whether stab early than or the modification time that equals these data that server returns stab, if, illustrate that then these data do not need synchronously, return step 304, if not, then execution in step 308;
Step 308: client is data to be updated with this data markers, and with the server that is sent to of these data, returns step 304; Server resolves according to mark that to obtain these data be data to be updated, then server update its go up preserve have the data that common identity identifies with described data;
Step 309: client is data to be added with this data markers, and these data are sent to server, returns step 304; Server resolves according to mark that to obtain these data be data to be added, and then server be this data allocations identify label, and the data of this identity are carried in preservation, and the data that will carry this identify label return to client storage.
Can learn by the foregoing description, for identify label is the data that client is distributed, the modification time that does not need to scan these data stabs, so, in the method that the embodiment of the invention provides, do not provide the embodiment that the modification time of scan-data at first stabs, but the embodiment that the scanning modification time stabs can draw according to the method that first embodiment of the invention to the three embodiment provide, this paper repeats no more.
The process of the data sync that above embodiment provides is: scan data, if judging these data needs synchronously, then this data sync is arrived server, but because the data of user's off-line editing may be a lot, therefore, for fear of continuing to upload the pressure that data are brought to network, following several implementation methods are also provided.
Figure 4 shows that the method for data synchronization flow chart that fourth embodiment of the invention provides.The method that the 4th embodiment provides and the present invention first, the difference of the method that second and third embodiment provides is: this method scans all data of client storage earlier, obtain to be synchronized to the identify label of data in server, and preserve, then, every the time of presetting, obtain the identify label of preset quantity, with the data sync of these identify label correspondences to server.
Scanning process to data in the method that fourth embodiment of the invention provides is: identify label-->deleted marker position--, and>modification time stabs, and specifically comprises:
Step 401: client scan has been preserved the identify label of data, judges that whether this identify label is server-assignment, if then execution in step 402, if not, then execution in step 407;
Step 402: scan the deleted marker position of these data, judge whether this flag bit is that effectively if then execution in step 403, if not, then execution in step 405;
Step 403: client is kept at the identify label memory cell with this identify label, execution in step 404;
The device definition that to preserve identify label in the embodiment of the invention is the identify label memory cell.
Step 404: client judges that whether these data are last data, if then execution in step 410, if not, then return step 401;
Step 405: the modification time of these data of client scan stabs, and relatively this modification time modification time of whether stabbing these data of returning early than server stabs, if, then return step 404, if not, then execution in step 406;
Step 406: client is kept at described identify label memory cell with the identify label of these data, is data to be updated with the data markers of this identify label correspondence, returns step 404;
Step 407: scan the deleted marker position of these data, judge whether this flag bit is that effectively if then execution in step 408, if not, then execution in step 409;
Step 408: client is deleted this data, returns step 404;
Step 409: client is kept at the identify label memory cell with the identify label of these data, is data to be added with the data markers of this identify label correspondence, returns step 404;
Step 410: client is every the time of presetting, and the identify label of obtaining preset quantity from the identify label memory cell sends to server with the data of this identify label correspondence, and server is operated according to mark.
Wherein, the data of identify label correspondence comprise: data to be added, data to be updated, and the identify label for the treatment of deleted data.
Concrete, if server judges that according to mark obtaining data is to treat the identify label of deleted data, then server searches and deletes these data according to identify label; If judge that obtain data is data to be updated, then server be this data allocations identify label, and the data of this identify label are carried in preservation, and the data that will carry this identify label return to client storage; If judge that obtain these data is data to be updated, then server update its go up preserve have the data that common identity identifies with these data.
Figure 5 shows that the method for data synchronization flow process that fifth embodiment of the invention provides, scanning process to data among this embodiment is identical with the scanning process that second embodiment of the invention provides, for: identify label-->modification time stamp-->deleted marker position, difference is that the method that this embodiment provides is that first all data to client storage scan, obtain to be synchronized to the identify label of data in server, and preserve, then, every the time of presetting, obtain the identify label of preset quantity, the data of these identify label correspondences are sent to server.The specific implementation process of the method that fifth embodiment of the invention provides can be with reference to the accompanying drawings 5, and the method that fourth embodiment of the invention provides draws, and does not repeat them here.
Figure 6 shows that the method for data synchronization flow chart that sixth embodiment of the invention provides, the scanning process to data among this embodiment is identical with the scanning process that third embodiment of the invention provides, for: deleted marker position-->identify label-->modification time stabs; Difference is that the method that this embodiment provides is that first all data to client storage scan, obtain to be synchronized to the identify label of data in server, and preserve, then, every the time of presetting, obtain the identify label of preset quantity, the data with these identify label correspondences send to server again.Sixth embodiment of the invention provide the specific implementation process of method can be with reference to the accompanying drawings 6 and the method that provides of fourth embodiment of the invention draw, do not repeat them here.
In other embodiments of the invention, also can set the number of the data of each scanning, and the blanking time of scanning, such as, preestablish and scan 10 data every 10 seconds, to need data in synchronization to be sent to server in these 10 data, this embodiment and the 4th embodiment, the difference of the 5th and the 6th embodiment is, need preset a scan period, and after having scanned data, add a Rule of judgment again, judge whether the data number of current scanning has reached the quantity that presets, if, then need data in synchronization send to server, and record is the end point of scanning this time, waits for scanning next time arrival constantly, if not, then continue scanning, up to the data that scanned preset quantity.
In addition, in the process of carrying out data sync, in order to make data accurately be synchronized to server, in the method for data synchronization that the foregoing description provides, can further include: whether the periodic detection of client gets access to the connectivity detection messages that server sends, if, show that then client and server are in connection status, then continue data synchronization process, if not, then illustrate to disconnect client and being connected of server, then stop data synchronization process.
It should be noted that, if the user has deleted some data to be added under off-line state, identify label just is the data of being distributed by client, client can directly be deleted these data of preserving on it so, and the deleted marker position of these data is set to wait to delete earlier, deletes these data then in the process of data sync again.In this case, just can there be deleted data to be added in the data of client storage, so, in other embodiments of the invention, if client scan is distributed by client to the identify label of these data, illustrate that then these data are data to be added, client can directly send to server with these data, and needn't scan the deleted marker position of these data again, and, if client scans the deleted marker position of data earlier and is set to wait to delete, then client can send to server with the identify label of these data, and the identify label that need not discern these data again is by whose distribution.
More than specifically described the method for the data sync that the embodiment of the invention provides, below the user is landed the network calendar system process be introduced.
After client inserts the Internet and connects with server, client need be with the off-line editing data sync to server, for fear of same user at a plurality of clients logging in network calendar systems simultaneously, a plurality of different off-line editing data occur and require to be synchronized to server simultaneously, make off-line editing data synchronization process produce conflict, in embodiments of the present invention, requirement is in the same moment, same user can only be a client login, so, when the user lands request by the user end to server transmission, server need judge whether this user logins, if server judges that obtaining this user logins, then server can send prompting and refusal login to the client of current request login, perhaps, also can end logging status formerly, and allow client executing user's login of current request login.In a word, server need guarantee unique login of user.
Followingly the equipment that the embodiment of the invention provides is described in detail with reference to accompanying drawing.
Referring to accompanying drawing 7, specify and the invention provides first client device when the user is in off-line state, how according to user's instruction service data, first client device comprises:
Memory cell 76 is used to preserve data;
Input unit 71 is used to obtain the input of user instruction and data;
User instruction resolution unit 72 is used to discern the user instruction that input unit obtains;
Data identify label allocation units 73, if the described user instruction of described user instruction resolution unit 72 identifications is that data are added instruction, the then data allocations identify label that gets access to for input unit 71, and the data that will carry described identify label send to memory cell 76 and preserve;
Wherein, when the user is in line states, if the described user instruction of described user instruction resolution unit 72 identifications is that data are added instruction, then with these data directly synchronously to server, give this data allocations identify label by server, and the memory cell 76 that the server data that will carry this identify label send to first client device is preserved.
First data processing unit 74, if the described user instruction of described user instruction resolution unit 72 identifications is the data modification instruction, then according to the identify label of carrying in the described data modification instruction, data to identify label correspondence described in the described memory cell 76 are upgraded, and upgrade the modification time stamp of described data;
Second data processing unit 75, if the described user instruction of described user instruction resolution unit 72 identifications is the data delete instruction, then according to the identify label of carrying in the described data delete instruction, the deleted marker position of the data of identify label correspondence is set to wait to delete described in the described memory cell 76.
Referring to accompanying drawing 8, specify the second client device structural representation provided by the invention, be used for data sync comprising to server:
Memory cell 81 is used to preserve data;
The first data characteristics identification unit 82, be used for the data of described memory cell 81 are carried out identification, comprise: distinguishing the data identify label is to be distributed by server or client, and the modification time that extracts data stabs, and whether the deleted marker position of judgment data is set to wait to delete;
Control unit 83, judge whether to call Network Synchronization unit 84 according to the identification result of the first data characteristics identification unit 82 and carry out data sync, comprise: if 82 identifications of the first data characteristics identification unit obtain the described identify label that is kept at the data of described memory cell 81 is server-assignment, and, the modification time of described data stabs the modification time that is later than the data with common identity sign of preserving on the server and stabs, be to add data then, call described Network Synchronization unit 84 described data are sent to server described data markers; If it is server-assignment that identification obtains being kept at the identify label of the data of described memory cell 81, and, the deleted marker position of described data is set to wait to delete, then the identify label with described data is labeled as the identify label for the treatment of deleted data, calls described Network Synchronization unit 84 this identify label is sent to server; If it is that client is distributed that identification obtains the described identify label that is kept at the data of described memory cell 81, is data to be added with described data markers then, calls Network Synchronization unit 84 described data are sent to server;
Network Synchronization unit 84 is used for that to carry out data message mutual with server.
In order to make data to be synchronized to server accurately, in second client device, can further include:
Whether state perception unit 85 is used to monitor client and keeps being connected with server, if then enable calling of 82 pairs of Network Synchronization unit 84 of control unit.
For fear of continuing to upload the pressure that data are brought to network, the present invention also provides the 3rd client device, Figure 9 shows that the structural representation of this equipment, wherein, the memory cell 81 in memory cell 91 and the present invention's second client device and the function of the first data characteristics identification unit 82 are identical, repeat no more, and the 3rd client device also comprises: buffer unit 95, timer units 96, and
Control unit 93, be used for judging whether to call Network Synchronization unit 94 according to the identification result of the first data characteristics identification unit 92, comprise: if 92 identifications of the first feature identification unit obtain being kept at the identify label of the data of described memory cell 91 is server-assignment, and, the modification time of described data stabs the modification time that is later than the data with common identity sign of preserving on the server and stabs, then the described data of mark are data to be updated, call described Network Synchronization unit 94 and the identify label of these data is sent to buffer unit 95 preserve; If the identify label that is kept at the data of described memory cell 91 is a server-assignment, and, the deleted marker position of described data is set to wait to delete, then the identify label of the described data of mark is the identify label for the treatment of deleted data, calls described Network Synchronization unit 94 and the identify label of these data is sent to buffer unit 95 preserves; Distribute if the identify label that is kept at the data of described memory cell 91 is a client, then the described data of mark are data to be added, call described Network Synchronization unit 94 and the identify label of these data is sent to buffer unit 95 preserve;
Buffer unit 95, according to the judged result of control unit 94, buffer memory is carried out in the identify label that need is synchronized to data in server;
Timer units 96 is used for periodic trigger network lock unit 94 data of the identify label correspondence of buffer unit 95 buffer memorys is sent to server;
Network Synchronization unit 94, under the triggering of timer units 96, obtain the identify label of preset quantity from buffer unit 95, the data of described identify label correspondence are sent to server, and the data of described identify label correspondence comprise: data to be updated, data to be added, treat the identify label of deleted data.
In order to make data to be synchronized to server accurately, can also comprise in the 3rd client device: the function of the state perception unit 85 in the state perception unit, the function of this unit and second client device is identical, repeats no more.
Referring to accompanying drawing 10, specify the server that the embodiment of the invention provides, comprising:
Memory cell 104 is used to preserve data;
Receiving element 101 is used for carrying out data interaction with client, comprises the data of obtaining client upload, and these data comprise: data to be updated, data to be added, treat the identify label of deleted data;
The second data characteristics identification unit 102, the type that is used for data that described receiving element 101 is got access to is carried out identification, and call 103 pairs of data of edit cell and edit, comprise: if identification obtains data is data to be added, then call edit cell 103 and be this data allocations identify label, and the data that will carry this identify label are kept at memory cell 104, and the data that will carry this identify label return to client storage; If it is data to be updated that identification obtains data, then calls edit cell 103 and upgrade the data that have the common identity sign in the described memory cell 104 with these data; If identification obtains data for treating deleted data, then call the data that described edit cell 103 deletions are kept at described memory cell 104;
Edit cell 103 is used for the maintenance of data.
More than a kind of method of data synchronization provided by the present invention and processing method, client device, server are described in detail, for one of ordinary skill in the art, thought according to the embodiment of the invention, part in specific embodiments and applications all can change, in sum, this description should not be construed as limitation of the present invention.

Claims (10)

1, a kind of method of data synchronization is characterized in that, comprising:
The data that the scanning client has been preserved, if judging the identify label obtain described data is server-assignment, and, the modification time of described data stabs and is later than the modification time of preserving on the server that has data of common identity sign with described data and stabs, the described data of then described client mark are data to be updated, and described data are sent to server; Described server is according to described mark, upgrade preserve on it have the data of common identity sign with described data;
If judging the identify label obtain described data is server-assignment, and the deleted marker position of described data is set to wait to delete, then client is labeled as the identify label for the treatment of deleted data with the identify label of described data, and sends to server; Described server is deleted the data of described identify label correspondence according to described mark;
If judging the identify label that obtains described data is that described client is distributed, then described client is data to be added with described data markers, and described data are sent to server; Described server is given described data allocations identify label according to described mark, and returns the data of carrying described identify label to described client.
2, the method for claim 1 is characterized in that, before described client sends to server with data, further comprises:
Client storage is sent to the identify label of data in server;
Described client periodically sends to server with the data of the identify label correspondence of preset quantity.
3, method as claimed in claim 1 or 2 is characterized in that, described client flag data is specially:
Described client is by increasing action type field, the type of the described data of mark in data;
And described server obtains the type of data by resolving described action type field, carries out accordingly and handles.
4, method as claimed in claim 3 is characterized in that, described method also comprises:
Whether the periodic detection of client gets access to the connectivity detection messages that server sends, and if not, then stops to send data to described server.
5, a kind of client data processing method is characterized in that, comprising:
Client is obtained user instruction;
Add instruction if described user instruction is data, then described client is the data allocations identify label of input, and preserves the data of carrying described identify label, is data to be added with described data markers, and described data are sent to server;
If described user instruction is the data modification instruction, then described client is according to the identify label of carrying in the described data modification instruction, data to described identify label correspondence are upgraded, and, the modification time that upgrades described data stabs, with described data markers is data to be updated, and described data are sent to server;
If described user instruction is the data delete instruction, then described client is according to the identify label of carrying in the described data delete instruction, the deleted marker position of the data of described identify label correspondence is set to wait to delete, the identify label of described data is labeled as the identify label for the treatment of deleted data, and sends to server.
6, a kind of client device is characterized in that, comprising:
Memory cell is used to preserve data;
Input unit is used to obtain the input of user instruction and data;
The user instruction resolution unit is used to discern the user instruction that input unit obtains;
Data identify label allocation units, if it is that data are added instruction that described user instruction resolution unit is discerned described user instruction, the then data allocations identify label that gets access to for input unit, and the data that will carry described identify label send to memory cell and preserve, with described data markers is data to be added, and described data are sent to server;
First data processing unit, if it is the data modification instruction that described user instruction resolution unit is discerned described user instruction, then according to the identify label of carrying in the described data modification instruction, data to identify label correspondence described in the described memory cell are upgraded, and the modification time that upgrades described data stabs, with described data markers is data to be updated, and described data are sent to server;
Second data processing unit, if it is the data delete instruction that described user instruction resolution unit is discerned described user instruction, then according to the identify label of carrying in the described data delete instruction, the deleted marker position of the data of identify label correspondence described in the described memory cell is set to wait to delete, the identify label of described data is labeled as the identify label for the treatment of deleted data, and sends to server.
7, a kind of client device is characterized in that, comprising:
Memory cell is used to preserve data;
The first data characteristics identification unit, be used for the data of described memory cell are carried out identification, whether comprise: distinguishing the data identify label is to be distributed by server or client, extract the modification time stamp of data or the deleted marker position of judgment data and be set to wait to delete;
The Network Synchronization unit is used for that to carry out data message mutual with server;
Control unit, judge whether to call the Network Synchronization unit according to the identification result of the first data characteristics identification unit and carry out data sync, comprise: if the identification of the first data characteristics identification unit obtains being kept at the identify label of the data of described memory cell is server-assignment, and, the modification time of described data stabs the modification time that is later than the data with common identity sign of preserving on the server and stabs, be data to be updated then, call described Network Synchronization unit described data are sent to server described data markers; If it is server-assignment that identification obtains being kept at the identify label of the data of described memory cell, and, the deleted marker position of described data is set to wait to delete, then the identify label with described data is labeled as the identify label for the treatment of deleted data, calls described Network Synchronization unit the identify label of described data is sent to server; If it is that client is distributed that identification obtains being kept at the identify label of the data of described memory cell, is data to be added with described data markers then, calls described Network Synchronization unit described data are sent to server.
8, equipment as claimed in claim 7 is characterized in that, also comprises:
Buffer unit according to the judged result of control unit, will be sent to the pairing identify label of server data and carry out buffer memory;
Timer units, periodic trigger network lock unit sends to server with the data of the identify label correspondence of buffer unit buffer memory;
Described Network Synchronization unit, under the triggering of described timer units, the identify label of obtaining preset quantity from buffer unit sends to server with the data of described identify label correspondence.
9, as claim 7 or 8 described equipment, it is characterized in that, also comprise:
Whether state perception unit is used to monitor client and keeps being connected with server, if then enable control unit calling the Network Synchronization unit.
10, a kind of server is characterized in that, comprising:
Memory cell is used to preserve data;
Receiving element is used for carrying out data interaction with client, comprises the data of obtaining client upload, and these data comprise: data to be updated, data to be added or treat the identify label of deleted data;
The second data characteristics identification unit, the type that is used for data that described receiving element is got access to is carried out identification, and call edit cell data are edited, comprise: if identification obtains data is data to be added, then call edit cell and be this data allocations identify label, and the data that will carry this identify label are kept at memory cell, and the data that will carry this identify label return to client storage; If it is data to be updated that identification obtains data, then calls edit cell and upgrade the data that have the common identity sign in the described memory cell with these data; If identification obtains data for treating deleted data, then call the data that described edit cell deletion is kept at described memory cell;
Edit cell is used for the edit cell of safeguarding of data, is used for the maintenance of data.
CNB200710135831XA 2007-07-16 2007-07-16 Method of data synchronization and processing method, client device, server Active CN100566234C (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CNB200710135831XA CN100566234C (en) 2007-07-16 2007-07-16 Method of data synchronization and processing method, client device, server

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CNB200710135831XA CN100566234C (en) 2007-07-16 2007-07-16 Method of data synchronization and processing method, client device, server

Publications (2)

Publication Number Publication Date
CN101075864A CN101075864A (en) 2007-11-21
CN100566234C true CN100566234C (en) 2009-12-02

Family

ID=38976700

Family Applications (1)

Application Number Title Priority Date Filing Date
CNB200710135831XA Active CN100566234C (en) 2007-07-16 2007-07-16 Method of data synchronization and processing method, client device, server

Country Status (1)

Country Link
CN (1) CN100566234C (en)

Families Citing this family (42)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101849228B (en) * 2007-01-16 2013-05-08 吉兹莫克斯有限公司 Method and system for creating it-oriented server-based web applications
CN101227379B (en) * 2008-01-25 2012-07-04 中兴通讯股份有限公司 Method and system for implementation of data synchronization
CN102413156B (en) * 2010-09-21 2014-04-16 腾讯科技(深圳)有限公司 Distributed data storage system and method
CN102457499B (en) * 2010-10-26 2015-09-16 腾讯科技(深圳)有限公司 The method that works offline of client and the client that works offline
CN102024040A (en) * 2010-12-08 2011-04-20 北京握奇数据***有限公司 Database synchronization method, device and system
CN102857529A (en) * 2011-06-30 2013-01-02 镇江雅迅软件有限责任公司 Offline application system based on timestamp
CN103136200B (en) * 2011-11-22 2018-02-02 中兴通讯股份有限公司 Data fresh information acquisition methods, device and method of data synchronization, device
CN103164422A (en) * 2011-12-09 2013-06-19 百度在线网络技术(北京)有限公司 Method, equipment and system for conducting data synchronism by adopting general data storage format
CN102647467B (en) * 2012-03-31 2015-11-25 吴志华 There is schedule off-line editing transmission method and the system on line of forecast function
CN103379115B (en) * 2012-04-28 2018-01-05 盛乐信息技术(上海)有限公司 A kind of method of data synchronization and equipment being locally stored with network storage
CN103793400B (en) * 2012-10-30 2018-06-01 金蝶软件(中国)有限公司 The batch regulation method and device of tables of data
CN103812902B (en) * 2012-11-13 2018-09-21 中国电信股份有限公司 Method, system and the mobile terminal handled official business offline are realized using mobile terminal
CN103179216A (en) * 2013-04-16 2013-06-26 上海同岩土木工程科技有限公司 File scanning and automatic unloading method based on Twain protocol
CN103279510A (en) * 2013-05-17 2013-09-04 上海市计量测试技术研究院 Method for discontinuously synchronizing multiple data bases in online mode
CN104424109B (en) * 2013-09-09 2020-03-24 联想(北京)有限公司 Information processing method and electronic equipment
CN104717241A (en) * 2013-12-12 2015-06-17 鸿合科技有限公司 File network sharing method, terminal and server
CN103701913B (en) * 2013-12-30 2017-02-22 广州爱九游信息技术有限公司 Data synchronization method and device
CN105530269B (en) * 2014-09-28 2019-04-09 阿里巴巴集团控股有限公司 Data interactive method and system and server
CN104618426B (en) * 2014-12-17 2019-01-15 深圳市腾讯计算机***有限公司 A kind of event data processing method, server, client and system
CN104537018A (en) * 2014-12-18 2015-04-22 深圳市科漫达智能管理科技有限公司 Data synchronization method, device and system
CN104484428B (en) * 2014-12-18 2018-11-20 深圳市科漫达智能管理科技有限公司 A kind of method, apparatus and system that data are synchronous
CN104462477B (en) * 2014-12-18 2018-03-30 深圳市科漫达智能管理科技有限公司 The method, apparatus and system of data syn-chronization based on timestamp
CN104580454A (en) * 2014-12-31 2015-04-29 乐视网信息技术(北京)股份有限公司 Data synchronizing method, device and system
CN104796408B (en) * 2015-03-25 2018-11-02 广州视睿电子科技有限公司 Single-point live login method and single-point live login device
CN106375354B (en) * 2015-07-20 2020-06-05 阿里巴巴集团控股有限公司 Data processing method and device
CN110474972B (en) * 2016-06-03 2022-07-08 青岛海信移动通信技术股份有限公司 Method and device for synchronizing contact information
CN106255103A (en) * 2016-07-29 2016-12-21 华为技术有限公司 A kind of method of data synchronization and equipment
CN106254456B (en) * 2016-08-03 2020-03-10 深圳市商汤科技有限公司 Data synchronization method and data synchronization system
CN106599268A (en) * 2016-12-22 2017-04-26 曙光信息产业(北京)有限公司 Processing method and device of SQL statement
CN106682193B (en) * 2016-12-29 2021-01-08 北京奇虎科技有限公司 Data persistence storage method and device based on cache
CN107147644B (en) * 2017-05-10 2020-07-28 四川长虹电器股份有限公司 Method for realizing login of mobile APP user in single device
CN109547510A (en) * 2017-09-22 2019-03-29 镇江雅迅软件有限责任公司 A kind of off-line system method of data synchronization
CN107835160A (en) * 2017-10-20 2018-03-23 浙江工商大学 Third party's user authen method based on Quick Response Code
CN108846045B (en) * 2018-05-30 2022-10-18 杭州吉吉知识产权运营有限公司 Storage method and system for drinking water data of intelligent water cup
CN109359484A (en) * 2018-08-22 2019-02-19 北京中测安华科技有限公司 Processing method, device, equipment and the medium of the security audit terminal log of cloud platform
CN110868437B (en) * 2018-08-28 2022-08-02 中兴通讯股份有限公司 Information synchronization method, terminal and computer readable storage medium
CN109067913A (en) * 2018-09-19 2018-12-21 量子云未来(北京)信息科技有限公司 A kind of method and device for maintaining data synchronous
CN109542887B (en) * 2018-11-29 2023-03-31 中国科学院文献情报中心 Method and device for offline editing and fusing general online data
CN110990359A (en) * 2019-12-18 2020-04-10 北京华峰创业科技有限公司 Method and system for cleaning useless data in synchronous framework
CN111708796A (en) * 2020-06-23 2020-09-25 浪潮云信息技术股份公司 Data consistency method based on time stamp
CN113181633B (en) * 2021-03-26 2024-02-13 百果园技术(新加坡)有限公司 Game data synchronization method, system and device
CN115510166A (en) * 2022-11-23 2022-12-23 云账户技术(天津)有限公司 Data synchronization service method and device, remote platform and electronic equipment

Also Published As

Publication number Publication date
CN101075864A (en) 2007-11-21

Similar Documents

Publication Publication Date Title
CN100566234C (en) Method of data synchronization and processing method, client device, server
CN101127915B (en) Electronic program navigation data synchronization method and system based on incremental mode
CN109542865B (en) Method, device, system and medium for synchronizing configuration files of distributed cluster system
CN106648903B (en) The method and apparatus for calling distributed file system
US10103940B2 (en) Local network and method of updating a device in a local network
CN101447891B (en) Service model self-adapting system and method thereof
EP2086204A3 (en) Method and system for data synchronisation between network devices
CN107231400B (en) Data synchronization method and device
CN102447582A (en) Resource synchronization method and device
CN106844558A (en) Intelligent question and answer method and system
CN113709250B (en) Cross-domain user data synchronization method based on subscription transmission mode
CN101515935A (en) Data synchronization method and server
CN104410875A (en) System and method for realizing IPTV box end service zero configuration automatic opening
CN107634975A (en) A kind of method of data synchronization, equipment and system
CN103024094A (en) Safe and reliable DNS zone file information issuing updating method and system
CN101087263B (en) A method and system for capturing user status information via search engine
CN110555600B (en) Method, device, equipment and storage medium for preventing forbidden components in modular BOM from being misused
CN107295057B (en) Apparatus for relaying data transmission in SCADA system
CN105429823A (en) Method and device for detecting multicast traffic in distributed communication equipment
CN111090648B (en) Relational database data synchronization conflict resolution method
CN104993920B (en) A kind of lock in time method and SNTP clients based on SNTP
CN114327556A (en) Device and method for realizing application configuration hot update based on Internet of things edge cloud cooperation
CN106789188A (en) A kind of method of the apparatus self-adaptation addressing of bus type topological structure
CN103118072B (en) A kind of method and system of database update
CN101276332B (en) Making data processing method and system

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
C14 Grant of patent or utility model
GR01 Patent grant