WO2015127607A1 - 终端侧和服务器侧数据同步装置及方法 - Google Patents
终端侧和服务器侧数据同步装置及方法 Download PDFInfo
- Publication number
- WO2015127607A1 WO2015127607A1 PCT/CN2014/072576 CN2014072576W WO2015127607A1 WO 2015127607 A1 WO2015127607 A1 WO 2015127607A1 CN 2014072576 W CN2014072576 W CN 2014072576W WO 2015127607 A1 WO2015127607 A1 WO 2015127607A1
- Authority
- WO
- WIPO (PCT)
- Prior art keywords
- database file
- server
- terminal
- synchronization
- data
- 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.)
- Ceased
Links
Classifications
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/20—Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
- G06F16/27—Replication, distribution or synchronisation of data between databases or within a distributed database system; Distributed database system architectures therefor
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/20—Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
- G06F16/27—Replication, distribution or synchronisation of data between databases or within a distributed database system; Distributed database system architectures therefor
- G06F16/273—Asynchronous replication or reconciliation
Definitions
- Terminal side and server side data synchronization device and method Terminal side and server side data synchronization device and method
- the present invention relates to the field of data synchronization technologies, and in particular, to a terminal side data synchronization apparatus and method, and a server side data synchronization apparatus and method.
- the terminal connects to the cloud server to retrieve data stored in the user cloud.
- the terminal downloads the data stored in the cloud.
- the terminal compares the difference between the cloud data and the terminal data one by one.
- the recovery module inserts the records that need to be restored into the application database.
- the smartphone system uses SQLite as the application database.
- SQLite is the file database.
- An application generally has a separate DB (DataBase, Database).
- the DB contains all the tables, indexes, and triggers of the application.
- the Android system also provides a ContentProvider layer in the data access layer to provide unified operations such as adding, deleting, and modifying the database.
- a ContentProvider layer in the data access layer to provide unified operations such as adding, deleting, and modifying the database.
- the invention is based on the above problems, and proposes a new technical solution, which can reduce the time of terminal cloud data recovery and improve the user experience.
- the present invention provides a terminal-side data synchronization device, which is configured to implement data synchronization between a terminal and a server, and includes: an acquiring unit, when receiving a data synchronization request, acquiring a database file in the terminal; a sending unit, configured to send the data synchronization request and the database file to the server, so that the server acquires data stored in the server according to the data synchronization request, and according to the database file and the server Generating the data in the synchronization database file corresponding to the data synchronization request, and sending the synchronization database file to the terminal; receiving unit, receiving the synchronization database file sent by the server; replacing unit, using the The synchronization database file replaces the database file to enable synchronization of data stored in the server to the terminal.
- the database file in the terminal is acquired, and the database file is sent to the server, so that the server performs corresponding processing according to the database file and the locally stored data.
- the synchronization database file is obtained, and the synchronization database file is directly sent to the terminal, so that the terminal only needs to replace the database file with the synchronous database file, then the data synchronization is completed, the terminal does not need to perform the synchronization processing operation, and Powerful computing and processing capabilities, greatly reducing the time of data synchronization, improving the user experience, while the complex data operations are done by the server, saving the power of the terminal.
- the synchronous database file refers to a file generated after the data in the server is synchronized to the database file in the terminal.
- the acquiring unit is further configured to: when receiving the data synchronization request, acquire the quantity of data stored in the server, and when the quantity exceeds a preset quantity, acquire the location The database file in the terminal.
- the database file is sent to the server, and the synchronization data is processed by the server, thereby reaching
- a normal data synchronization method can be used, that is, synchronous data processing by the terminal.
- the obtaining unit is further configured to: obtain version information corresponding to the database file, where the version information includes database version information and service logic version information; And sending: the version information to the server.
- the terminal sends the database version information and the service logic version information to the server, so that the server can simulate the environment in which the terminal processes the data according to the database version information and the service logic version information, and then process the data that needs to be synchronized.
- the method further includes: a first file processing unit, performing compression and encryption processing on the database file acquired by the obtaining unit to obtain a processed database file; : Send the processed database file to the server.
- the database file in order to ensure the security and transmission speed of the database file during the transmission process, the database file can be compressed and encrypted, and decompressed and decrypted after the transmission is completed.
- the receiving unit is further configured to: receive the processed synchronization database file sent by the server; further include: a second file processing unit, decrypting the processed synchronization database file And decompression processing to obtain the synchronization database file.
- the synchronized database file in order to ensure the security of the synchronized database file during transmission and to ensure the transmission speed, the synchronized database file can be compressed and encrypted, and decompressed and decrypted after the transmission is completed.
- a server-side data synchronization device for implementing data synchronization between a terminal and a server, including: a receiving unit, receiving a data synchronization request and a database file sent by the terminal; Obtaining data stored in the server according to the data synchronization request; comparing, reading data in the database file, and comparing data in the database file with data stored in the server to obtain a data difference information; a generating unit, performing a processing operation on the database file according to the data difference information to generate a synchronization database file; and sending, by the sending unit, the synchronization database file to the terminal, for the terminal to use
- the synchronization database file replaces the database file to enable synchronization of data stored in the server to the terminal.
- the database file in the terminal is acquired, and the database file is sent to the server, so that the server stores the number according to the database file and the local storage.
- the synchronous database file is obtained, and the synchronous database file is directly sent to the terminal, so that the terminal only needs to replace the database file with the synchronous database file, then the data synchronization is completed, and the terminal does not need to perform synchronization processing again. Operation, and because of the server's powerful computing and processing capabilities, greatly reducing the time of data synchronization, improving the user experience, while the complex data operations are done by the server, saving the power of the terminal.
- the synchronous database file refers to a file generated after the data in the server is synchronized to the database file in the terminal.
- the receiving unit is further configured to: receive version information corresponding to the database file that is sent by the terminal, where the generating unit is further configured to:: according to the version information and the data The difference information performs a processing operation on the database file to generate the synchronization database file.
- the terminal sends the database version information and the service logic version information to the server, so that the server can simulate the environment in which the terminal processes the data according to the database version information and the service logic version information, and then process the data that needs to be synchronized.
- the receiving unit is further configured to: receive the processed database file sent by the terminal; and further include: a decompressing unit, performing decompression and decryption processing on the processed database file, To get the database file.
- the database file in order to ensure the security and transmission speed of the database file during the transmission process, the database file can be compressed and encrypted, and decompressed and decrypted after the transmission is completed.
- the method further includes: an encryption unit, performing encryption and compression processing on the synchronization database file to obtain a processed synchronization database file; and the sending unit is further configured to: A synchronization database file is sent to the terminal.
- the synchronized database file in order to ensure the security of the synchronized database file during transmission and to ensure the transmission speed, the synchronized database file can be compressed and encrypted, and decompressed and decrypted after the transmission is completed.
- the processing operation includes: an adding operation, a deleting operation, and/or a modifying operation.
- the processing operation is to add, delete, and/or modify according to the data stored in the server and the database file in the terminal, so that all the data stored in the server is added to the database file in the terminal. And delete the duplicate data to form a synchronous database file.
- add operation All the data in the server is added to the database file.
- the deletion operation refers to deleting some duplicate data files.
- the modification operation refers to modifying and merging some similar files according to dates and the like.
- a method for synchronizing data between a terminal and a server including: acquiring a database file in the terminal when receiving a data synchronization request; Sending the data synchronization request and the database file to the server, for the server to acquire data stored in the server according to the data synchronization request, and according to the database file and the storage in the server Generating a synchronization database file corresponding to the data synchronization request, and transmitting the synchronization database file to the terminal; receiving the synchronization database file sent by the server; replacing the database file with the synchronization database file, To synchronize synchronization of data stored in the server to the terminal.
- the database file in the terminal is acquired, and the database file is sent to the server, so that the server performs corresponding processing according to the database file and the locally stored data.
- the synchronization database file is obtained, and the synchronization database file is directly sent to the terminal, so that the terminal only needs to replace the database file with the synchronous database file, then the data synchronization is completed, the terminal does not need to perform the synchronization processing operation, and Powerful computing and processing capabilities, greatly reducing the time of data synchronization, improving the user experience, while the complex data operations are done by the server, saving the power of the terminal.
- the synchronous database file refers to a file generated after the data in the server is synchronized to the database file in the terminal.
- the method further includes: acquiring, when the data synchronization request is received, the number of data stored in the server, and acquiring, when the quantity exceeds a preset quantity, a database in the terminal file.
- the database file is sent to the server, and the synchronous data is processed by the server, thereby achieving large capacity in processing.
- the normal data synchronization method can be used, that is, the synchronous data processing by the terminal.
- the method further includes: obtaining version information corresponding to the database file, where the version information includes database version information and service logic version information; and sending the version information to the server.
- the terminal sends the database version information and the service logic version information to the server, which In this way, the server can simulate the environment in which the terminal processes the data according to the database version information and the business logic version information, and then process the data that needs to be synchronized.
- the method further includes: performing compression and encryption processing on the acquired database file to obtain the processed database file; and sending the processed database file to the server.
- the database file in order to ensure the security and transmission speed of the database file during the transmission process, the database file can be compressed and encrypted, and decompressed and decrypted after the transmission is completed.
- the method further includes: receiving the processed synchronization database file sent by the server; and performing decryption and decompression processing on the processed synchronization database file to obtain the synchronization database file.
- the synchronized database file in order to ensure the security of the synchronized database file during transmission and to ensure the transmission speed, the synchronized database file can be compressed and encrypted, and decompressed and decrypted after the transmission is completed.
- a server-side data synchronization method configured to implement data synchronization between a terminal and a server, including: receiving a data synchronization request and a database file sent by the terminal; Obtaining data stored in the server; reading data in the database file, and comparing data in the database file with data stored in the server to obtain data difference information; according to the data difference Information processing the database file to generate a synchronization database file; transmitting the synchronization database file to the terminal, for the terminal to replace the database file with the synchronization database file, to implement the The data stored in the server is synchronized to the terminal.
- the database file in the terminal is acquired, and the database file is sent to the server, so that the server performs corresponding processing according to the database file and the locally stored data.
- the synchronization database file is obtained, and the synchronization database file is directly sent to the terminal, so that the terminal only needs to replace the database file with the synchronous database file, then the data synchronization is completed, the terminal does not need to perform the synchronization processing operation, and Powerful computing and processing capabilities, greatly reducing the time of data synchronization, improving the user experience, while the complex data operations are done by the server, saving the power of the terminal.
- the synchronous database file refers to a file generated after the data in the server is synchronized to the database file in the terminal.
- the method further includes: receiving, by the terminal, a pair with the database file
- the version information should be processed according to the version information and the data difference information to generate the synchronization database file.
- the terminal sends the database version information and the service logic version information to the server, so that the server can simulate the environment in which the terminal processes the data according to the database version information and the service logic version information, and then process the data that needs to be synchronized.
- the method further includes: receiving a processed database file sent by the terminal; and performing decompression and decryption processing on the processed database file to obtain the database file.
- the database file in order to ensure the security and transmission speed of the database file during the transmission process, the database file can be compressed and encrypted, and decompressed and decrypted after the transmission is completed.
- the method further includes: performing encryption and compression processing on the synchronization database file to obtain a processed synchronization database file; and sending the processed synchronization database file to the terminal.
- the synchronized database file in order to ensure the security of the synchronized database file during transmission and to ensure the transmission speed, the synchronized database file can be compressed and encrypted, and decompressed and decrypted after the transmission is completed.
- the processing operation includes: an adding operation, a deleting operation, and/or a modifying operation.
- the processing operation is to add, delete, and/or modify according to the data stored in the server and the database file in the terminal, so that all the data stored in the server is added to the database file in the terminal. And delete the duplicate data to form a synchronous database file.
- the adding operation is to add all the data in the server to the database file
- the deleting operation refers to deleting some duplicate data files
- the modifying operation refers to modifying and merging some similar files according to dates and the like.
- a program product stored on a non-transitory machine readable medium for data synchronization, the program product comprising machine executable instructions for causing a computer system to perform the following steps Obtaining a database file in the terminal when receiving the data synchronization request; sending the data synchronization request and the database file to the server, where the server acquires the storage in the server according to the data synchronization request Data, and generating a synchronization database file corresponding to the data synchronization request according to the database file and the data stored in the server, and transmitting the synchronization database file to the terminal; receiving the Synchronizing the database file; replacing the database file with the synchronization database file And implementing synchronization of data stored in the server to the terminal.
- a non-volatile machine readable medium storing a program product for data synchronization, the program product comprising machine executable instructions for causing a computer system to perform the following steps: when receiving Obtaining a database file in the terminal when the data synchronization request is obtained; sending the data synchronization request and the database file to the server, where the server acquires the storage in the server according to the data synchronization request Data, and generating a synchronization database file corresponding to the data synchronization request according to the database file and data stored in the server, and transmitting the synchronization database file to the terminal; receiving the synchronization sent by the server a database file; replacing the database file with the synchronization database file to synchronize synchronization of data stored in the server to the terminal.
- a machine readable program the program causing a machine to execute the data synchronization method according to any one of the above aspects.
- a storage medium storing a machine readable program, wherein the machine readable program causes a machine to execute the data synchronization method according to any one of the technical solutions described above.
- a program product stored on a non-transitory machine readable medium for data synchronization, the program product comprising machine executable instructions for causing a computer system to perform the following steps Receiving a data synchronization request and a database file sent by the terminal; acquiring data stored in the server according to the data synchronization request; reading data in the database file, and using data in the database file with the server Comparing the stored data to obtain data difference information; performing processing operations on the database file according to the data difference information to generate a synchronization database file; and transmitting the synchronization database file to the terminal for the The terminal replaces the database file with the synchronization database file to synchronize synchronization of data stored in the server to the terminal.
- a non-volatile machine readable medium storing a program product for data synchronization, the program product comprising machine executable instructions for causing a computer system to perform the steps of: receiving a terminal Transmitting a data synchronization request and a database file; acquiring data stored in the server according to the data synchronization request; reading data in the database file, and storing data in the database file with the server Data is compared to obtain data difference information; processing the database file according to the data difference information to generate a synchronization database file; and transmitting the synchronization database file to the terminal for use by the terminal
- the synchronization database file replaces the database file to enable synchronization of data stored in the server to the terminal.
- a machine readable program the program causing a machine to perform the data synchronization method according to any one of the above aspects.
- a storage medium storing a machine readable program, wherein the machine readable program causes a machine to execute the data synchronization method according to any one of the technical solutions described above.
- FIG. 1 shows a block diagram of a terminal side data synchronizing apparatus according to an embodiment of the present invention
- FIG. 2 shows a block diagram of a server side data synchronization device in accordance with an embodiment of the present invention
- FIG. 3 is a flowchart showing a terminal side data synchronization method according to an embodiment of the present invention
- FIG. 4 is a flow chart showing a server side data synchronization method according to an embodiment of the present invention.
- FIG. 5 shows a detailed flow chart of a data synchronization method in accordance with an embodiment of the present invention. detailed description
- FIG. 1 shows a block diagram of a terminal side data synchronizing apparatus according to an embodiment of the present invention.
- a terminal-side data synchronization apparatus 100 is configured to implement data synchronization between a terminal and a server, and includes: an obtaining unit 102, when receiving a data synchronization request, acquiring the terminal a database file; the sending unit 104, sending the data synchronization request and the database file to the server, for the server to acquire data stored in the server according to the data synchronization request, and according to the And generating, by the database file and the data stored in the server, a synchronization database file corresponding to the data synchronization request, and sending the synchronization database file to the terminal; and receiving unit 106, receiving the service The synchronization database file sent by the server; the replacing unit 108, replacing the database file with the synchronization database file, to synchronize data stored in the server to the terminal.
- the database file in the terminal is acquired, and the database file is sent to the server, so that the server performs corresponding processing according to the database file and the locally stored data.
- the synchronization database file is obtained, and the synchronization database file is directly sent to the terminal, so that the terminal only needs to replace the database file with the synchronous database file, then the data synchronization is completed, the terminal does not need to perform the synchronization processing operation, and Powerful computing and processing capabilities, greatly reducing the time of data synchronization, improving the user experience, while the complex data operations are done by the server, saving the power of the terminal.
- the synchronous database file refers to a file generated after the data in the server is synchronized to the database file in the terminal.
- the acquiring unit 102 is further configured to: when receiving the data synchronization request, acquire the quantity of data stored in the server, and when the quantity exceeds a preset quantity, obtain A database file in the terminal.
- the database file is sent to the server, and the synchronous data is processed by the server, thereby achieving large capacity in processing.
- the normal data synchronization method can be used, that is, the synchronous data processing by the terminal.
- the obtaining unit 102 is further configured to: obtain version information corresponding to the database file, where the version information includes database version information and service logic version information; Also used to: send the version information to the server.
- the terminal sends the database version information and the service logic version information to the server, so that the server can simulate the environment in which the terminal processes the data according to the database version information and the service logic version information, and then process the data that needs to be synchronized.
- the method further includes: a first file processing unit 1 10, performing compression and encryption processing on the database file acquired by the obtaining unit to obtain a processed database file; Also used to: send the processed database file to the server.
- the database file in order to ensure the security and transmission speed of the database file during the transmission process, can be compressed and encrypted, and decompressed and decrypted after the transmission is completed.
- the receiving unit 106 is further configured to: receive the processed synchronization database file sent by the server; further include: a second file processing unit 1 12, the processed synchronization database The file is decrypted and decompressed to obtain the synchronized database file.
- the synchronized database file in order to ensure the security of the synchronized database file during transmission and to ensure the transmission speed, the synchronized database file can be compressed and encrypted, and decompressed and decrypted after the transmission is completed.
- FIG. 2 shows a block diagram of a server side data synchronization device in accordance with an embodiment of the present invention.
- the server-side data synchronization apparatus 200 is configured to implement data synchronization between the terminal and the server, and includes: a receiving unit 202, receiving a data synchronization request and a database file sent by the terminal;
- the unit 204 is configured to acquire data stored in the server according to the data synchronization request.
- the comparing unit 206 reads data in the database file, and performs data in the database file and data stored in the server.
- Comparing to obtain data difference information Comparing to obtain data difference information; generating unit 208, performing processing operations on the database file according to the data difference information to generate a synchronization database file; and sending unit 210, sending the synchronization database file to the terminal, to Replacing the database file with the synchronization database file for the terminal to synchronize data stored in the server to the terminal.
- the database file in the terminal is acquired, and the database file is sent to the server, so that the server performs corresponding processing according to the database file and the locally stored data.
- the synchronization database file is obtained, and the synchronization database file is directly sent to the terminal, so that the terminal only needs to replace the database file with the synchronous database file, then the data synchronization is completed, the terminal does not need to perform the synchronization processing operation, and Powerful computing and processing capabilities, greatly reducing the time of data synchronization, improving the user experience, while the complex data operations are done by the server, saving the power of the terminal.
- the synchronous database file refers to a file generated after the data in the server is synchronized to the database file in the terminal.
- the receiving unit is further configured to: receive version information corresponding to the database file that is sent by the terminal, where the generating unit is further configured to:: according to the version information and the data The difference information performs a processing operation on the database file to generate the synchronization database file.
- the terminal sends the database version information and the service logic version information to the server, so that the server can simulate the environment in which the terminal processes the data according to the database version information and the service logic version information. In turn, the data that needs to be synchronized is processed.
- the receiving unit 202 is further configured to: receive the processed database file sent by the terminal; and further include: a decompressing unit 212, decompressing and decrypting the processed database file Processed to get the database file.
- the database file in order to ensure the security and transmission speed of the database file during the transmission process, the database file can be compressed and encrypted, and decompressed and decrypted after the transmission is completed.
- the method further includes: an encryption unit 214, performing encryption and compression processing on the synchronization database file to obtain a processed synchronization database file; and the sending unit 208 is further configured to: The subsequent synchronization database file is sent to the terminal.
- the synchronized database file in order to ensure the security of the synchronized database file during transmission and to ensure the transmission speed, the synchronized database file can be compressed and encrypted, and decompressed and decrypted after the transmission is completed.
- the processing operation includes: an adding operation, a deleting operation, and/or a modifying operation.
- the processing operation is to add, delete, and/or modify according to the data stored in the server and the database file in the terminal, so that all the data stored in the server is added to the database file in the terminal. And delete the duplicate data to form a synchronous database file.
- the adding operation is to add all the data in the server to the database file
- the deleting operation refers to deleting some duplicate data files
- the modifying operation refers to modifying and merging some similar files according to dates and the like.
- FIG. 3 shows a flow chart of a data storage method in accordance with an embodiment of the present invention.
- a terminal-side data synchronization method is configured to implement data synchronization between a terminal and a server, and the method includes: Step 302: When receiving a data synchronization request, acquiring, in the terminal, a database file; Step 304, sending the data synchronization request and the database file to the server, so that the server acquires data stored in the server according to the data synchronization request, and according to the database file and The data stored in the server generates a synchronization database file corresponding to the data synchronization request, and sends the synchronization database file to the terminal; Step 306, receiving the synchronization database file sent by the server; Step 308; The database file is replaced with the synchronization database file to enable synchronization of data stored in the server to the terminal.
- the database in the terminal is acquired.
- the file is sent to the server, so that the server processes the database file and the locally stored data to obtain a synchronous database file, and directly sends the synchronous database file to the terminal, so that the terminal only needs to use the synchronous database.
- the terminal does not need to perform the synchronization processing operation, and the powerful computing and processing capability of the server greatly reduces the data synchronization time and improves the user experience, and at the same time
- the data operation is done by the server, which saves the power of the terminal.
- the synchronous database file refers to a file generated after the data in the server is synchronized to the database file in the terminal.
- the method further includes: acquiring, when the data synchronization request is received, the quantity of data stored in the server, when the quantity exceeds a preset quantity, acquiring A database file in the terminal.
- the database file is sent to the server, and the synchronous data is processed by the server, thereby achieving large capacity in processing.
- the normal data synchronization method can be used, that is, the synchronous data processing by the terminal.
- the step 302 further includes: obtaining version information corresponding to the database file, where the version information includes database version information and service logic version information; and sending the version information to The server.
- the terminal sends the database version information and the service logic version information to the server, so that the server can simulate the environment in which the terminal processes the data according to the database version information and the service logic version information, and then process the data that needs to be synchronized.
- the step 302 further includes: performing compression and encryption processing on the obtained database file to obtain a processed database file; and sending the processed database file to the server.
- the database file in order to ensure the security and transmission speed of the database file during the transmission process, the database file can be compressed and encrypted, and decompressed and decrypted after the transmission is completed.
- the step 306 further includes: receiving a processed synchronization database file sent by the server; performing decryption and decompression processing on the processed synchronization database file to obtain the synchronization database. file.
- the synchronized database file in order to ensure the security of the synchronized database file during transmission and to ensure the transmission speed, can also be compressed and encrypted, and decompressed and decrypted after the transmission is completed.
- FIG. 4 shows a flow chart of a data synchronization method in accordance with an embodiment of the present invention.
- the server-side data synchronization method is configured to implement data synchronization between the terminal and the server, and the method includes: Step 402: Receive a data synchronization request and a database file sent by the terminal; Step 404; Acquiring data stored in the server according to the data synchronization request; Step 406, reading data in the database file, and comparing data in the database file with data stored in the server to obtain Data difference information; Step 408: Perform a processing operation on the database file according to the data difference information to generate a synchronization database file.
- Step 410 Send the synchronization database file to the terminal, where the terminal uses the terminal The synchronization database file replaces the database file to enable synchronization of data stored in the server to the terminal.
- the database file in the terminal is acquired, and the database file is sent to the server, so that the server performs corresponding processing according to the database file and the locally stored data.
- the synchronization database file is obtained, and the synchronization database file is directly sent to the terminal, so that the terminal only needs to replace the database file with the synchronous database file, then the data synchronization is completed, the terminal does not need to perform the synchronization processing operation, and Powerful computing and processing capabilities, greatly reducing the time of data synchronization, improving the user experience, while the complex data operations are done by the server, saving the power of the terminal.
- the synchronous database file refers to a file generated after the data in the server is synchronized to the database file in the terminal.
- the step 402 further includes: receiving version information corresponding to the database file sent by the terminal; processing the database file according to the version information and the data difference information. Operation to generate the synchronization database file.
- the terminal sends the database version information and the service logic version information to the server, so that the server can simulate the environment in which the terminal processes the data according to the database version information and the service logic version information, and then process the data that needs to be synchronized.
- the step 402 further includes: receiving a processed database file sent by the terminal; performing decompression and decryption processing on the processed database file to obtain the data. Library file.
- the database file in order to ensure the security and transmission speed of the database file during the transmission process, the database file can be compressed and encrypted, and decompressed and decrypted after the transmission is completed.
- the step 410 further includes: performing encryption and compression processing on the synchronization database file to obtain a processed synchronization database file; and sending the processed synchronization database file to the terminal.
- the synchronized database file in order to ensure the security of the synchronized database file during transmission and to ensure the transmission speed, the synchronized database file can be compressed and encrypted, and decompressed and decrypted after the transmission is completed.
- the processing operation includes: an adding operation, a deleting operation, and/or a modifying operation.
- the processing operation is to add, delete, and/or modify according to the data stored in the server and the database file in the terminal, so that all the data stored in the server is added to the database file in the terminal. And delete the duplicate data to form a synchronous database file.
- the adding operation is to add all the data in the server to the database file
- the deleting operation refers to deleting some duplicate data files
- the modifying operation refers to modifying and merging some similar files according to dates and the like.
- FIG. 5 shows a detailed flow chart of a data synchronization method in accordance with an embodiment of the present invention.
- Step 502 The terminal determines, according to the quantity of data stored by the server, whether to perform recovery by using a fast cloud recovery method. If the number of recovery in the server is greater than the set threshold, perform fast cloud recovery. Otherwise, the normal recovery mode is used.
- Step 504 After entering the fast cloud recovery, the terminal uploads the compressed application DB (ie, database) file to the server.
- the compressed application DB ie, database
- Step 506 The terminal uploads the content information of the DB ContentProvider, the mobile phone manufacturer, and the ROM version number to the server.
- Step 508 The server compares the difference between the data in the database file uploaded by the terminal and the data stored in the server, and generates a data difference synchronization table.
- Step 510 The server determines a related data synchronization service processing engine according to the ContentProvider version number of the DB, the mobile phone manufacturer, the ROM version number, and the like, and the server synchronizes the table according to the data difference.
- the step DB file calls the business processing engine to simulate the terminal to add, delete, and modify operations, and generates a synchronized DB file.
- Step 512 The server compresses the synchronized DB file and sends it to the terminal.
- Step 514 After receiving the DB file, the terminal overwrites the DB file of the application, and then restarts the ContentProvider monthly service of the application.
- a synchronized DB file is generated in the server and sent to the terminal, and the terminal receives the synchronized DB. , directly overwrite the local DB file, restart the ContentProvider service. In this way, it takes a few minutes and several tens of minutes to complete the synchronization work, and the invention takes only a few seconds to several tens of seconds, which greatly improves the user experience.
- a program product stored on a non-transitory machine readable medium for data synchronization, the program product comprising machine executable instructions for causing a computer system to perform the following steps Obtaining a database file in the terminal when receiving the data synchronization request; sending the data synchronization request and the database file to the server, where the server acquires the storage in the server according to the data synchronization request Data, and generating a synchronization database file corresponding to the data synchronization request according to the database file and the data stored in the server, and transmitting the synchronization database file to the terminal; receiving the Synchronizing the database file; replacing the database file with the synchronization database file to synchronize synchronization of data stored in the server to the terminal.
- a non-volatile machine readable medium storing a program product for data synchronization, the program product comprising machine executable instructions for causing a computer system to perform the following steps: when receiving Obtaining a database file in the terminal when the data synchronization request is obtained; sending the data synchronization request and the database file to the server, where the server acquires the storage in the server according to the data synchronization request Data, and generating a synchronization database file corresponding to the data synchronization request according to the database file and data stored in the server, and transmitting the synchronization database file to the terminal; receiving the synchronization sent by the server a database file; replacing the database file with the synchronization database file to synchronize synchronization of data stored in the server to the terminal.
- a machine readable program the program causing a machine to execute the data synchronization method according to any one of the above aspects.
- a storage medium storing a machine readable program, wherein The machine readable program causes a machine to perform the data synchronization method as described in any one of the above aspects.
- a program product stored on a non-transitory machine readable medium for data synchronization, the program product comprising machine executable instructions for causing a computer system to perform the following steps Receiving a data synchronization request and a database file sent by the terminal; acquiring data stored in the server according to the data synchronization request; reading data in the database file, and using data in the database file with the server Comparing the stored data to obtain data difference information; performing processing operations on the database file according to the data difference information to generate a synchronization database file; and transmitting the synchronization database file to the terminal for the The terminal replaces the database file with the synchronization database file to synchronize synchronization of data stored in the server to the terminal.
- a non-volatile machine readable medium storing a program product for data synchronization, the program product comprising machine executable instructions for causing a computer system to perform the steps of: receiving a terminal Transmitting a data synchronization request and a database file; acquiring data stored in the server according to the data synchronization request; reading data in the database file, and storing data in the database file with the server Data is compared to obtain data difference information; processing the database file according to the data difference information to generate a synchronization database file; and transmitting the synchronization database file to the terminal for use by the terminal
- the synchronization database file replaces the database file to enable synchronization of data stored in the server to the terminal.
- a machine readable program the program causing a machine to execute the data synchronization method according to any one of the above aspects.
- a storage medium storing a machine readable program, wherein the machine readable program causes a machine to execute the data synchronization method according to any one of the technical solutions described above.
Landscapes
- Engineering & Computer Science (AREA)
- Databases & Information Systems (AREA)
- Theoretical Computer Science (AREA)
- Computing Systems (AREA)
- Data Mining & Analysis (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
Abstract
提供了一种终端侧数据同步装置和方法,以及服务器侧数据同步装置和方法,其中,终端侧数据同步装置包括:获取单元,当接收到数据同步请求时,获取终端中的数据库文件;发送单元,将数据同步请求和数据库文件发送至服务器,以供服务器根据数据同步请求获取服务器中存储的数据,并根据数据库文件和服务器中存储的数据生成与数据同步请求对应的同步数据库文件,并发送同步数据库文件至终端;接收单元,接收服务器发送的同步数据库文件;替换单元,使用同步数据库文件替换数据库文件,以实现将服务器中存储的数据同步至终端,可以减少终端云数据恢复的时间,提高用户体验。
Description
终端侧和服务器侧数据同步装置及方法
技术领域
本发明涉及数据同步技术领域, 具体而言, 涉及一种终端侧数据同步装置和方法 以及一种服务器侧数据同步装置和方法。
背景技术
随着智能手机的快速发展, 越来越多的人用智能手机打电话、 收发信息、 收发邮 件。 早期的非智能机由于存储空间有限, 通常会对联系人、 信息、 邮件的存储条数和 空间进行限制, 目前智能手机内置存储普遍都是 4G 以上, 智能手机厂商对联系人、 信息、 邮件的存储条数和空间不进行限制了。 很多用户在使用智能手机时, 希望联系 人、 信息、 邮件等存储条数和空间是无限的, 日积月累的使用导致联系人、 信息、 邮 件数据库的记录数达到几千条甚至几万条。
而随着云技术的快速发展, 很多智能手机用户选择了云同步服务来备份和恢复手 机的重要数据, 如联系人、 信息、 邮件等数据。 目前移动终端通过云端恢复数据的原 理是:
1、 终端通过网络连接云服务端检索用户云端存储的数据。
2、 终端下载云端存储的数据。
3、 终端逐条比较云端数据和终端数据的差异。
4、 恢复模块把需要恢复的记录插入到应用数据库中。
我们知道虽然智能手机发展非常迅速, 但是受手机体系架构的限制, 手机在浮点 计算和存储 I/O方面仍然不是很快。 目前智能手机系统大量釆用 SQLite作为应用的数 据库, SQLite 是文件数据库, 一个应用一般有一个单独的 DB ( DataBase,数据库) , DB中包含应用所有的表、 索引、 触发器。
安卓系统在数据访问层还提供了 ContentProvider层来提供数据库统一的增加、 删 除、 修改等操作。 在恢复数据时, 在一张表插入记录, 首先需要由 ContentProvider层 来进行业务逻辑的处理, 然后再插入 DB 中; 由于索引和触发器的存在, 可能会同时 插入几张数据表。 所以恢复数据的过程中会产生大量浮点运算和 I/O 处理, 恢复几千
条数据需要几分钟甚至几十分钟, 如果数据量更大, 时间就更长。
因此, 需要一种新的技术方案, 可以减少终端云数据恢复的时间, 提高用户体 验。 发明内容
本发明正是基于上述问题, 提出了一种新的技术方案, 可以减少终端云数据恢复 的时间, 提高用户体验。
有鉴于此, 本发明提出了一种终端侧数据同步装置, 用于实现终端和服务器之间 的数据同步, 包括: 获取单元, 当接收到数据同步请求时, 获取所述终端中的数据库 文件; 发送单元, 将所述数据同步请求和所述数据库文件发送至所述服务器, 以供所 述服务器根据所述数据同步请求获取所述服务器中存储的数据, 并根据所述数据库文 件和所述服务器中存储的数据生成与所述数据同步请求对应的同步数据库文件, 并发 送所述同步数据库文件至所述终端; 接收单元, 接收所述服务器发送的所述同步数据 库文件; 替换单元, 使用所述同步数据库文件替换所述数据库文件, 以实现将所述服 务器中存储的数据同步至所述终端。
在该技术方案中, 当想要将服务器中的数据同步到终端时, 获取终端中的数据库 文件, 将数据库文件发送给服务器, 这样, 由服务器根据数据库文件和本地存储的数 据进行相应的处理, 得到同步数据库文件, 并直接将该同步数据库文件发给终端, 这 样, 终端只需要用同步数据库文件替换数据库文件后, 就完成了数据的同步, 不需要 终端再进行同步处理操作, 并且由于服务器的强大的计算和处理能力, 从而大大减少 了数据同步的时间, 提高了用户体验, 同时由于复杂的数据操作都由服务器来完成, 节省了终端的电量。
其中, 同步数据库文件是指将服务器中的数据同步到终端中的数据库文件之后生 成的一个文件。
在上述技术方案中, 优选地, 所述获取单元还用于: 在接收到所述数据同步请求 时, 获取所述服务器中存储的数据的数量, 在所述数量超过预设数量时, 获取所述终 端中的数据库文件。
在该技术方案中, 当服务器中存储的数据的数量超过预设数量, 即需要同步的数 据超过预设值时, 再将数据库文件发送至服务器, 通过服务器处理同步数据, 从而达
到在处理大容量的数据时, 减少数据处理时间的目的, 而当需要同步的数据较少时, 则可以釆用正常的数据同步方法, 即由终端进行同步数据处理。
在上述技术方案中, 优选地, 所述获取单元还用于: 获取与所述数据库文件对应 的版本信息, 其中, 所述版本信息包括数据库版本信息和业务逻辑版本信息; 所述发 送单元还用于: 发送所述版本信息至所述服务器。
在该技术方案中, 终端将数据库版本信息和业务逻辑版本信息发送至服务器, 这 样, 服务器可以根据数据库版本信息和业务逻辑版本信息模拟终端处理数据的环境, 进而对需要同步的数据进行处理。
在上述技术方案中, 优选地, 还包括: 第一文件处理单元, 对所述获取单元获取 的所述数据库文件进行压缩和加密处理, 以得到处理后的数据库文件; 所述发送单元 还用于: 发送所述处理后的数据库文件至所述服务器。
在该技术方案中, 为了保证数据库文件在传输过程中的安全和传输速度, 可以将 数据库文件进行压缩和加密, 并在传输完成后进行解压和解密。
在上述技术方案中, 优选地, 所述接收单元还用于: 接收所述服务器发送的处理 后的同步数据库文件; 还包括: 第二文件处理单元, 对所述处理后的同步数据库文件 进行解密和解压缩处理, 以得到所述同步数据库文件。
在该技术方案中, 为了保证同步后的数据库文件在传输过程中的安全和保证传输 速度, 还可以对已同步数据库文件进行压缩和加密, 以及在传输完成后进行解压和解 密。
根据本发明的另一方面, 还提供了一种服务器侧数据同步装置, 用于实现终端和 服务器之间的数据同步, 包括: 接收单元, 接收终端发送的数据同步请求和数据库文 件; 获取单元, 根据所述数据同步请求获取所述服务器中存储的数据; 对比单元, 读 取所述数据库文件中的数据, 并将所述数据库文件中的数据与所述服务器中存储的数 据进行对比, 以得到数据差异信息; 生成单元, 根据所述数据差异信息对所述数据库 文件进行处理操作, 以生成同步数据库文件; 发送单元, 将所述同步数据库文件发送 至所述终端, 以供所述终端使用所述同步数据库文件替换所述数据库文件, 以实现将 所述服务器中存储的数据同步至所述终端。
在该技术方案中, 当想要将服务器中的数据同步到终端时, 获取终端中的数据库 文件, 将数据库文件发送给服务器, 这样, 由服务器根据数据库文件和本地存储的数
据进行相应的处理, 得到同步数据库文件, 并直接将该同步数据库文件发给终端, 这 样, 终端只需要用同步数据库文件替换数据库文件后, 就完成了数据的同步, 不需要 终端再进行同步处理操作, 并且由于服务器的强大的计算和处理能力, 从而大大减少 了数据同步的时间, 提高了用户体验, 同时由于复杂的数据操作都由服务器来完成, 节省了终端的电量。
其中, 同步数据库文件是指将服务器中的数据同步到终端中的数据库文件之后生 成的一个文件。
在上述技术方案中, 优选地, 所述接收单元还用于: 接收所述终端发送的与所述 数据库文件对应的版本信息; 所述生成单元还用于: 根据所述版本信息和所述数据差 异信息对所述数据库文件进行处理操作, 以生成所述同步数据库文件。
在该技术方案中, 终端将数据库版本信息和业务逻辑版本信息发送至服务器, 这 样, 服务器可以根据数据库版本信息和业务逻辑版本信息模拟终端处理数据的环境, 进而对需要同步的数据进行处理。
在上述技术方案中, 优选地, 所述接收单元还用于: 接收所述终端发送的处理后 的数据库文件; 还包括: 解压单元, 对所述处理后的数据库文件进行解压缩和解密处 理, 以得到所述数据库文件。
在该技术方案中, 为了保证数据库文件在传输过程中的安全和传输速度, 可以将 数据库文件进行压缩和加密, 并在传输完成后进行解压和解密。
在上述技术方案中, 优选地, 还包括: 加密单元, 对所述同步数据库文件进行加 密和压缩处理, 以得到处理后的同步数据库文件; 所述发送单元还用于: 将所述处理 后的同步数据库文件发送至所述终端。
在该技术方案中, 为了保证同步后的数据库文件在传输过程中的安全和保证传输 速度, 还可以对已同步数据库文件进行压缩和加密, 以及在传输完成后进行解压和解 密。
在上述技术方案中, 优选地, 所述处理操作包括: 增加操作、 删除操作和 /或修改 操作。
在该技术方案中, 处理操作是根据服务器中存储的数据和终端中的数据库文件, 进行添加、 删除和 /或修改等操作, 从而将服务器中存储的数据全部添加到终端中的数 据库文件中, 并删除重复的数据, 从而形成一个同步数据库文件。 具体地, 添加操作
是将服务器中的数据全部添加到数据库文件中, 删除操作是指删除一些重复的数据文 件, 修改操作是指将一些同类的文件根据日期等修改合并。
根据本发明的另一方面, 还提供了一种终端侧数据同步方法, 用于实现终端和服 务器之间的数据同步, 包括: 当接收到数据同步请求时, 获取所述终端中的数据库文 件; 将所述数据同步请求和所述数据库文件发送至所述服务器, 以供所述服务器根据 所述数据同步请求获取所述服务器中存储的数据, 并根据所述数据库文件和所述服务 器中存储的数据生成与所述数据同步请求对应的同步数据库文件, 并发送所述同步数 据库文件至所述终端; 接收所述服务器发送的所述同步数据库文件; 使用所述同步数 据库文件替换所述数据库文件, 以实现将所述服务器中存储的数据同步至所述终端。
在该技术方案中, 当想要将服务器中的数据同步到终端时, 获取终端中的数据库 文件, 将数据库文件发送给服务器, 这样, 由服务器根据数据库文件和本地存储的数 据进行相应的处理, 得到同步数据库文件, 并直接将该同步数据库文件发给终端, 这 样, 终端只需要用同步数据库文件替换数据库文件后, 就完成了数据的同步, 不需要 终端再进行同步处理操作, 并且由于服务器的强大的计算和处理能力, 从而大大减少 了数据同步的时间, 提高了用户体验, 同时由于复杂的数据操作都由服务器来完成, 节省了终端的电量。
其中, 同步数据库文件是指将服务器中的数据同步到终端中的数据库文件之后生 成的一个文件。
在上述技术方案中, 优选地, 还包括: 在接收到所述数据同步请求时, 获取所述 服务器中存储的数据的数量, 在所述数量超过预设数量时, 获取所述终端中的数据库 文件。
在该技术方案中, 当服务器中存储的数据的数量超过预设数量, 即需要同步的数 据超过预设值时, 再将数据库文件发送至服务器, 通过服务器处理同步数据, 从而达 到在处理大容量的数据时, 减少数据处理时间的目的, 而当需要同步的数据较少时, 则可以釆用正常的数据同步方法, 即由终端进行同步数据处理。
在上述技术方案中, 优选地, 还包括: 获取与所述数据库文件对应的版本信息, 其中, 所述版本信息包括数据库版本信息和业务逻辑版本信息; 以及发送所述版本信 息至所述服务器。
在该技术方案中, 终端将数据库版本信息和业务逻辑版本信息发送至服务器, 这
样, 服务器可以根据数据库版本信息和业务逻辑版本信息模拟终端处理数据的环境, 进而对需要同步的数据进行处理。
在上述技术方案中, 优选地, 还包括: 对获取的所述数据库文件进行压缩和加密 处理, 以得到处理后的数据库文件; 发送所述处理后的数据库文件至所述服务器。
在该技术方案中, 为了保证数据库文件在传输过程中的安全和传输速度, 可以将 数据库文件进行压缩和加密, 并在传输完成后进行解压和解密。
在上述技术方案中, 优选地, 还包括: 接收所述服务器发送的处理后的同步数据 库文件; 对所述处理后的同步数据库文件进行解密和解压缩处理, 以得到所述同步数 据库文件。
在该技术方案中, 为了保证同步后的数据库文件在传输过程中的安全和保证传输 速度, 还可以对已同步数据库文件进行压缩和加密, 以及在传输完成后进行解压和解 密。
根据本发明的又一方面, 还提供了一种服务器侧数据同步方法, 用于实现终端和 服务器之间的数据同步, 包括: 接收终端发送的数据同步请求和数据库文件; 根据所 述数据同步请求获取所述服务器中存储的数据; 读取所述数据库文件中的数据, 并将 所述数据库文件中的数据与所述服务器中存储的数据进行对比, 以得到数据差异信 息; 根据所述数据差异信息对所述数据库文件进行处理操作, 以生成同步数据库文 件; 将所述同步数据库文件发送至所述终端, 以供所述终端使用所述同步数据库文件 替换所述数据库文件, 以实现将所述服务器中存储的数据同步至所述终端。
在该技术方案中, 当想要将服务器中的数据同步到终端时, 获取终端中的数据库 文件, 将数据库文件发送给服务器, 这样, 由服务器根据数据库文件和本地存储的数 据进行相应的处理, 得到同步数据库文件, 并直接将该同步数据库文件发给终端, 这 样, 终端只需要用同步数据库文件替换数据库文件后, 就完成了数据的同步, 不需要 终端再进行同步处理操作, 并且由于服务器的强大的计算和处理能力, 从而大大减少 了数据同步的时间, 提高了用户体验, 同时由于复杂的数据操作都由服务器来完成, 节省了终端的电量。
其中, 同步数据库文件是指将服务器中的数据同步到终端中的数据库文件之后生 成的一个文件。
在上述技术方案中, 优选地, 还包括: 接收所述终端发送的与所述数据库文件对
应的版本信息; 根据所述版本信息和所述数据差异信息对所述数据库文件进行处理操 作, 以生成所述同步数据库文件。
在该技术方案中, 终端将数据库版本信息和业务逻辑版本信息发送至服务器, 这 样, 服务器可以根据数据库版本信息和业务逻辑版本信息模拟终端处理数据的环境, 进而对需要同步的数据进行处理。
在上述技术方案中, 优选地, 还包括: 接收所述终端发送的处理后的数据库文 件; 对所述处理后的数据库文件进行解压缩和解密处理, 以得到所述数据库文件。
在该技术方案中, 为了保证数据库文件在传输过程中的安全和传输速度, 可以将 数据库文件进行压缩和加密, 并在传输完成后进行解压和解密。
在上述技术方案中, 优选地, 还包括: 对所述同步数据库文件进行加密和压缩处 理, 以得到处理后的同步数据库文件; 将所述处理后的同步数据库文件发送至所述终 端。
在该技术方案中, 为了保证同步后的数据库文件在传输过程中的安全和保证传输 速度, 还可以对已同步数据库文件进行压缩和加密, 以及在传输完成后进行解压和解 密。
在上述技术方案中, 优选地, 所述处理操作包括: 增加操作、 删除操作和 /或修改 操作。
在该技术方案中, 处理操作是根据服务器中存储的数据和终端中的数据库文件, 进行添加、 删除和 /或修改等操作, 从而将服务器中存储的数据全部添加到终端中的数 据库文件中, 并删除重复的数据, 从而形成一个同步数据库文件。 具体地, 添加操作 是将服务器中的数据全部添加到数据库文件中, 删除操作是指删除一些重复的数据文 件, 修改操作是指将一些同类的文件根据日期等修改合并。
根据本发明的实施方式, 还提供了一种存储在非易失性机器可读介质上的程序产 品, 用于数据同步, 所述程序产品包括用于使计算机系统执行以下步骤的机器可执行 指令: 当接收到数据同步请求时, 获取终端中的数据库文件; 将所述数据同步请求和 所述数据库文件发送至所述服务器, 以供所述服务器根据所述数据同步请求获取所述 服务器中存储的数据, 并根据所述数据库文件和所述服务器中存储的数据生成与所述 数据同步请求对应的同步数据库文件, 并发送所述同步数据库文件至所述终端; 接收 所述服务器发送的所述同步数据库文件; 使用所述同步数据库文件替换所述数据库文
件, 以实现将所述服务器中存储的数据同步至所述终端。
根据本发明的实施方式, 还提供了一种非易失机器可读介质, 存储有用于数据同 步的程序产品, 所述程序产品包括用于使计算机系统执行以下步骤的机器可执行指 令: 当接收到数据同步请求时, 获取所述终端中的数据库文件; 将所述数据同步请求 和所述数据库文件发送至所述服务器, 以供所述服务器根据所述数据同步请求获取所 述服务器中存储的数据, 并根据所述数据库文件和所述服务器中存储的数据生成与所 述数据同步请求对应的同步数据库文件, 并发送所述同步数据库文件至所述终端; 接 收所述服务器发送的所述同步数据库文件; 使用所述同步数据库文件替换所述数据库 文件, 以实现将所述服务器中存储的数据同步至所述终端。
根据本发明的实施方式, 还提供了一种机器可读程序, 所述程序使机器执行如上 所述技术方案中任一所述的数据同步方法。
根据本发明的实施方式, 还提供了一种存储有机器可读程序的存储介质, 其中, 所述机器可读程序使得机器执行如上所述技术方案中任一所述的数据同步方法。
根据本发明的实施方式, 还提供了一种存储在非易失性机器可读介质上的程序产 品, 用于数据同步, 所述程序产品包括用于使计算机系统执行以下步骤的机器可执行 指令: 接收终端发送的数据同步请求和数据库文件; 根据所述数据同步请求获取所述 服务器中存储的数据; 读取所述数据库文件中的数据, 并将所述数据库文件中的数据 与所述服务器中存储的数据进行对比, 以得到数据差异信息; 根据所述数据差异信息 对所述数据库文件进行处理操作, 以生成同步数据库文件; 将所述同步数据库文件发 送至所述终端, 以供所述终端使用所述同步数据库文件替换所述数据库文件, 以实现 将所述服务器中存储的数据同步至所述终端。
根据本发明的实施方式, 还提供了一种非易失机器可读介质, 存储有用于数据同 步的程序产品, 所述程序产品包括用于使计算机系统执行以下步骤的机器可执行指 令: 接收终端发送的数据同步请求和数据库文件; 根据所述数据同步请求获取所述服 务器中存储的数据; 读取所述数据库文件中的数据, 并将所述数据库文件中的数据与 所述服务器中存储的数据进行对比, 以得到数据差异信息; 根据所述数据差异信息对 所述数据库文件进行处理操作, 以生成同步数据库文件; 将所述同步数据库文件发送 至所述终端, 以供所述终端使用所述同步数据库文件替换所述数据库文件, 以实现将 所述服务器中存储的数据同步至所述终端。
根据本发明的实施方式, 还提供了一种机器可读程序, 所述程序使机器执行如上 所述技术方案中任一所述的数据同步方法。
根据本发明的实施方式, 还提供了一种存储有机器可读程序的存储介质, 其中, 所述机器可读程序使得机器执行如上所述技术方案中任一所述的数据同步方法。
通过以上技术方案, 在恢复数据到终端时, 由服务器进行恢复过程中的数据处 理, 利用了服务器的强大的计算和处理能力, 从而大大减少了终端云数据恢复时间, 提高了用户体验。 同时由于复杂的数据操作由服务器完成, 更加节省了终端的电量。 附图说明
图 1示出了根据本发明的实施例的终端侧数据同步装置的框图;
图 2示出了根据本发明的实施例的服务器侧数据同步装置的框图;
图 3示出了根据本发明的实施例的终端侧数据同步方法的流程图;
图 4示出了根据本发明的实施例的服务器侧数据同步方法的流程图;
图 5示出了根据本发明的实施例的数据同步方法的具体流程图。 具体实施方式
为了能够更清楚地理解本发明的上述目的、 特征和优点, 下面结合附图和具体实 施方式对本发明进行进一步的详细描述。 需要说明的是, 在不冲突的情况下, 本申请 的实施例及实施例中的特征可以相互组合。
在下面的描述中阐述了很多具体细节以便于充分理解本发明, 但是, 本发明还可 以釆用其他不同于在此描述的其他方式来实施, 因此, 本发明的保护范围并不受下面 公开的具体实施例的限制。
图 1示出了根据本发明的实施例的终端侧数据同步装置的框图。
如图 1 所示, 根据本发明的实施例的终端侧数据同步装置 100 , 用于实现终端和 服务器之间的数据同步, 包括: 获取单元 102 , 当接收到数据同步请求时, 获取所述 终端中的数据库文件; 发送单元 104 , 将所述数据同步请求和所述数据库文件发送至 所述服务器, 以供所述服务器根据所述数据同步请求获取所述服务器中存储的数据, 并根据所述数据库文件和所述服务器中存储的数据生成与所述数据同步请求对应的同 步数据库文件, 并发送所述同步数据库文件至所述终端; 接收单元 106 , 接收所述服
务器发送的所述同步数据库文件; 替换单元 108 , 使用所述同步数据库文件替换所述 数据库文件, 以实现将所述服务器中存储的数据同步至所述终端。
在该技术方案中, 当想要将服务器中的数据同步到终端时, 获取终端中的数据库 文件, 将数据库文件发送给服务器, 这样, 由服务器根据数据库文件和本地存储的数 据进行相应的处理, 得到同步数据库文件, 并直接将该同步数据库文件发给终端, 这 样, 终端只需要用同步数据库文件替换数据库文件后, 就完成了数据的同步, 不需要 终端再进行同步处理操作, 并且由于服务器的强大的计算和处理能力, 从而大大减少 了数据同步的时间, 提高了用户体验, 同时由于复杂的数据操作都由服务器来完成, 节省了终端的电量。
其中, 同步数据库文件是指将服务器中的数据同步到终端中的数据库文件之后生 成的一个文件。
在上述技术方案中, 优选地, 所述获取单元 102还用于: 在接收到所述数据同步 请求时, 获取所述服务器中存储的数据的数量, 在所述数量超过预设数量时, 获取所 述终端中的数据库文件。
在该技术方案中, 当服务器中存储的数据的数量超过预设数量, 即需要同步的数 据超过预设值时, 再将数据库文件发送至服务器, 通过服务器处理同步数据, 从而达 到在处理大容量的数据时, 减少数据处理时间的目的, 而当需要同步的数据较少时, 则可以釆用正常的数据同步方法, 即由终端进行同步数据处理。
在上述技术方案中, 优选地, 所述获取单元 102还用于: 获取与所述数据库文件 对应的版本信息, 其中, 所述版本信息包括数据库版本信息和业务逻辑版本信息; 所 述发送单元 104还用于: 发送所述版本信息至所述服务器。
在该技术方案中, 终端将数据库版本信息和业务逻辑版本信息发送至服务器, 这 样, 服务器可以根据数据库版本信息和业务逻辑版本信息模拟终端处理数据的环境, 进而对需要同步的数据进行处理。
在上述技术方案中, 优选地, 还包括: 第一文件处理单元 1 10 , 对所述获取单元 获取的所述数据库文件进行压缩和加密处理, 以得到处理后的数据库文件; 所述发送 单元 104还用于: 发送所述处理后的数据库文件至所述服务器。
在该技术方案中, 为了保证数据库文件在传输过程中的安全和传输速度, 可以将 数据库文件进行压缩和加密, 并在传输完成后进行解压和解密。
在上述技术方案中, 优选地, 所述接收单元 106还用于: 接收所述服务器发送的 处理后的同步数据库文件; 还包括: 第二文件处理单元 1 12 , 对所述处理后的同步数 据库文件进行解密和解压缩处理, 以得到所述同步数据库文件。
在该技术方案中, 为了保证同步后的数据库文件在传输过程中的安全和保证传输 速度, 还可以对已同步数据库文件进行压缩和加密, 以及在传输完成后进行解压和解 密。
图 2示出了根据本发明的实施例的服务器侧数据同步装置的框图。
如图 2 所示, 根据本发明的实施例的服务器侧数据同步装置 200 , 用于实现终端 和服务器之间的数据同步, 包括: 接收单元 202 , 接收终端发送的数据同步请求和数 据库文件; 获取单元 204 , 根据所述数据同步请求获取所述服务器中存储的数据; 对 比单元 206 , 读取所述数据库文件中的数据, 并将所述数据库文件中的数据与所述服 务器中存储的数据进行对比, 以得到数据差异信息; 生成单元 208 , 根据所述数据差 异信息对所述数据库文件进行处理操作, 以生成同步数据库文件; 发送单元 210 , 将 所述同步数据库文件发送至所述终端, 以供所述终端使用所述同步数据库文件替换所 述数据库文件, 以实现将所述服务器中存储的数据同步至所述终端。
在该技术方案中, 当想要将服务器中的数据同步到终端时, 获取终端中的数据库 文件, 将数据库文件发送给服务器, 这样, 由服务器根据数据库文件和本地存储的数 据进行相应的处理, 得到同步数据库文件, 并直接将该同步数据库文件发给终端, 这 样, 终端只需要用同步数据库文件替换数据库文件后, 就完成了数据的同步, 不需要 终端再进行同步处理操作, 并且由于服务器的强大的计算和处理能力, 从而大大减少 了数据同步的时间, 提高了用户体验, 同时由于复杂的数据操作都由服务器来完成, 节省了终端的电量。
其中, 同步数据库文件是指将服务器中的数据同步到终端中的数据库文件之后生 成的一个文件。
在上述技术方案中, 优选地, 所述接收单元还用于: 接收所述终端发送的与所述 数据库文件对应的版本信息; 所述生成单元还用于: 根据所述版本信息和所述数据差 异信息对所述数据库文件进行处理操作, 以生成所述同步数据库文件。
在该技术方案中, 终端将数据库版本信息和业务逻辑版本信息发送至服务器, 这 样, 服务器可以根据数据库版本信息和业务逻辑版本信息模拟终端处理数据的环境,
进而对需要同步的数据进行处理。
在上述技术方案中, 优选地, 所述接收单元 202还用于: 接收所述终端发送的处 理后的数据库文件; 还包括: 解压单元 212 , 对所述处理后的数据库文件进行解压缩 和解密处理, 以得到所述数据库文件。
在该技术方案中, 为了保证数据库文件在传输过程中的安全和传输速度, 可以将 数据库文件进行压缩和加密, 并在传输完成后进行解压和解密。
在上述技术方案中, 优选地, 还包括: 加密单元 214 , 对所述同步数据库文件进 行加密和压缩处理, 以得到处理后的同步数据库文件; 所述发送单元 208还用于: 将 所述处理后的同步数据库文件发送至所述终端。
在该技术方案中, 为了保证同步后的数据库文件在传输过程中的安全和保证传输 速度, 还可以对已同步数据库文件进行压缩和加密, 以及在传输完成后进行解压和解 密。
在上述技术方案中, 优选地, 所述处理操作包括: 增加操作、 删除操作和 /或修改 操作。
在该技术方案中, 处理操作是根据服务器中存储的数据和终端中的数据库文件, 进行添加、 删除和 /或修改等操作, 从而将服务器中存储的数据全部添加到终端中的数 据库文件中, 并删除重复的数据, 从而形成一个同步数据库文件。 具体地, 添加操作 是将服务器中的数据全部添加到数据库文件中, 删除操作是指删除一些重复的数据文 件, 修改操作是指将一些同类的文件根据日期等修改合并。
图 3示出了根据本发明的实施例的数据存储方法的流程图。
如图 3 所示, 根据本发明的实施例的终端侧数据同步方法, 用于实现终端和服务 器之间的数据同步, 包括: 步骤 302 , 当接收到数据同步请求时, 获取所述终端中的 数据库文件; 步骤 304 , 将所述数据同步请求和所述数据库文件发送至所述服务器, 以供所述服务器根据所述数据同步请求获取所述服务器中存储的数据, 并根据所述数 据库文件和所述服务器中存储的数据生成与所述数据同步请求对应的同步数据库文 件, 并发送所述同步数据库文件至所述终端; 步骤 306 , 接收所述服务器发送的所述 同步数据库文件; 步骤 308 , 使用所述同步数据库文件替换所述数据库文件, 以实现 将所述服务器中存储的数据同步至所述终端。
在该技术方案中, 当想要将服务器中的数据同步到终端时, 获取终端中的数据库
文件, 将数据库文件发送给服务器, 这样, 由服务器根据数据库文件和本地存储的数 据进行相应的处理, 得到同步数据库文件, 并直接将该同步数据库文件发给终端, 这 样, 终端只需要用同步数据库文件替换数据库文件后, 就完成了数据的同步, 不需要 终端再进行同步处理操作, 并且由于服务器的强大的计算和处理能力, 从而大大减少 了数据同步的时间, 提高了用户体验, 同时由于复杂的数据操作都由服务器来完成, 节省了终端的电量。
其中, 同步数据库文件是指将服务器中的数据同步到终端中的数据库文件之后生 成的一个文件。
在上述技术方案中, 优选地, 在所述步骤 302之前还包括: 在接收到所述数据同 步请求时, 获取所述服务器中存储的数据的数量, 在所述数量超过预设数量时, 获取 所述终端中的数据库文件。
在该技术方案中, 当服务器中存储的数据的数量超过预设数量, 即需要同步的数 据超过预设值时, 再将数据库文件发送至服务器, 通过服务器处理同步数据, 从而达 到在处理大容量的数据时, 减少数据处理时间的目的, 而当需要同步的数据较少时, 则可以釆用正常的数据同步方法, 即由终端进行同步数据处理。
在上述技术方案中, 优选地, 所述步骤 302还包括: 获取与所述数据库文件对应 的版本信息, 其中, 所述版本信息包括数据库版本信息和业务逻辑版本信息; 以及发 送所述版本信息至所述服务器。
在该技术方案中, 终端将数据库版本信息和业务逻辑版本信息发送至服务器, 这 样, 服务器可以根据数据库版本信息和业务逻辑版本信息模拟终端处理数据的环境, 进而对需要同步的数据进行处理。
在上述技术方案中, 优选地, 所述步骤 302还包括: 对获取的所述数据库文件进 行压缩和加密处理, 以得到处理后的数据库文件; 发送所述处理后的数据库文件至所 述服务器。
在该技术方案中, 为了保证数据库文件在传输过程中的安全和传输速度, 可以将 数据库文件进行压缩和加密, 并在传输完成后进行解压和解密。
在上述技术方案中, 优选地, 所述步骤 306还包括: 接收所述服务器发送的处理 后的同步数据库文件; 对所述处理后的同步数据库文件进行解密和解压缩处理, 以得 到所述同步数据库文件。
在该技术方案中, 为了保证同步后的数据库文件在传输过程中的安全和保证传输 速度, 还可以对已同步数据库文件进行压缩和加密, 以及在传输完成后进行解压和解 密。
图 4示出了根据本发明的实施例的数据同步方法的流程图。
如图 4 所示, 根据本发明的实施例的服务器侧数据同步方法, 用于实现终端和服 务器之间的数据同步, 包括: 步骤 402 , 接收终端发送的数据同步请求和数据库文 件; 步骤 404 , 根据所述数据同步请求获取所述服务器中存储的数据; 步骤 406 , 读 取所述数据库文件中的数据, 并将所述数据库文件中的数据与所述服务器中存储的数 据进行对比, 以得到数据差异信息; 步骤 408 , 根据所述数据差异信息对所述数据库 文件进行处理操作, 以生成同步数据库文件; 步骤 410 , 将所述同步数据库文件发送 至所述终端, 以供所述终端使用所述同步数据库文件替换所述数据库文件, 以实现将 所述服务器中存储的数据同步至所述终端。
在该技术方案中, 当想要将服务器中的数据同步到终端时, 获取终端中的数据库 文件, 将数据库文件发送给服务器, 这样, 由服务器根据数据库文件和本地存储的数 据进行相应的处理, 得到同步数据库文件, 并直接将该同步数据库文件发给终端, 这 样, 终端只需要用同步数据库文件替换数据库文件后, 就完成了数据的同步, 不需要 终端再进行同步处理操作, 并且由于服务器的强大的计算和处理能力, 从而大大减少 了数据同步的时间, 提高了用户体验, 同时由于复杂的数据操作都由服务器来完成, 节省了终端的电量。
其中, 同步数据库文件是指将服务器中的数据同步到终端中的数据库文件之后生 成的一个文件。
在上述技术方案中, 优选地, 所述步骤 402还包括: 接收所述终端发送的与所述 数据库文件对应的版本信息; 根据所述版本信息和所述数据差异信息对所述数据库文 件进行处理操作, 以生成所述同步数据库文件。
在该技术方案中, 终端将数据库版本信息和业务逻辑版本信息发送至服务器, 这 样, 服务器可以根据数据库版本信息和业务逻辑版本信息模拟终端处理数据的环境, 进而对需要同步的数据进行处理。
在上述技术方案中, 优选地, 所述步骤 402还包括: 接收所述终端发送的处理后 的数据库文件; 对所述处理后的数据库文件进行解压缩和解密处理, 以得到所述数据
库文件。
在该技术方案中, 为了保证数据库文件在传输过程中的安全和传输速度, 可以将 数据库文件进行压缩和加密, 并在传输完成后进行解压和解密。
在上述技术方案中, 优选地, 所述步骤 410还包括: 对所述同步数据库文件进行 加密和压缩处理, 以得到处理后的同步数据库文件; 将所述处理后的同步数据库文件 发送至所述终端。
在该技术方案中, 为了保证同步后的数据库文件在传输过程中的安全和保证传输 速度, 还可以对已同步数据库文件进行压缩和加密, 以及在传输完成后进行解压和解 密。
在上述技术方案中, 优选地, 所述处理操作包括: 增加操作、 删除操作和 /或修改 操作。
在该技术方案中, 处理操作是根据服务器中存储的数据和终端中的数据库文件, 进行添加、 删除和 /或修改等操作, 从而将服务器中存储的数据全部添加到终端中的数 据库文件中, 并删除重复的数据, 从而形成一个同步数据库文件。 具体地, 添加操作 是将服务器中的数据全部添加到数据库文件中, 删除操作是指删除一些重复的数据文 件, 修改操作是指将一些同类的文件根据日期等修改合并。
图 5示出了根据本发明的实施例的数据同步方法的具体流程图。
如图 5所示, 根据本发明的实施例的数据同步方法的具体流程如下:
步骤 502 , 终端根据服务器存储的数据的数量来确定是否釆用快速云恢复的方式 进行恢复, 如果服务器中需要恢复的数量大于已设定的阈值则进行快速云恢复, 否则 釆用普通恢复模式。
步骤 504 , 进入快速云恢复后, 终端上传压缩后的应用 DB (即数据库) 文件到 服务器。
步骤 506 , 终端把 DB的 ContentProvider版本号、 手机生产厂商、 ROM版本号等 相关信息上传到服务器。
步骤 508 , 服务器对比终端上传的数据库文件中的数据和服务器存储数据的差 异, 生成数据差异同步表。
步骤 510 , 服务器根据 DB的 ContentProvider版本号、 手机生产厂商、 ROM版本 号等相关信息确定相关的数据同步业务处理引擎, 服务器根据数据差异同步表和待同
步 DB 文件调用业务处理引擎模拟终端进行增、 删、 改操作, 生成同步后的 DB 文 件。
步骤 512, 服务器把同步后的 DB文件压缩后, 发给终端。
步骤 514 , 终端接收到 DB 文件后, 覆盖应用的 DB 文件, 然后重启该应用的 ContentProvider月艮务。
以上结合附图详细说明了本发明的技术方案, 通过本发明的技术方案, 在服务器 端模拟终端的相关环境, 在服务器中生成已同步的 DB 文件, 发送给终端, 终端接收 到同步后的 DB , 直接覆盖本地的 DB文件, 重启 ContentProvider服务。 这样原来需 要花几分钟、 几十分钟才能完成的同步工作, 釆用本发明只需要花几秒到几十秒的时 间, 大大提高了用户体验。
根据本发明的实施方式, 还提供了一种存储在非易失性机器可读介质上的程序产 品, 用于数据同步, 所述程序产品包括用于使计算机系统执行以下步骤的机器可执行 指令: 当接收到数据同步请求时, 获取终端中的数据库文件; 将所述数据同步请求和 所述数据库文件发送至所述服务器, 以供所述服务器根据所述数据同步请求获取所述 服务器中存储的数据, 并根据所述数据库文件和所述服务器中存储的数据生成与所述 数据同步请求对应的同步数据库文件, 并发送所述同步数据库文件至所述终端; 接收 所述服务器发送的所述同步数据库文件; 使用所述同步数据库文件替换所述数据库文 件, 以实现将所述服务器中存储的数据同步至所述终端。
根据本发明的实施方式, 还提供了一种非易失机器可读介质, 存储有用于数据同 步的程序产品, 所述程序产品包括用于使计算机系统执行以下步骤的机器可执行指 令: 当接收到数据同步请求时, 获取所述终端中的数据库文件; 将所述数据同步请求 和所述数据库文件发送至所述服务器, 以供所述服务器根据所述数据同步请求获取所 述服务器中存储的数据, 并根据所述数据库文件和所述服务器中存储的数据生成与所 述数据同步请求对应的同步数据库文件, 并发送所述同步数据库文件至所述终端; 接 收所述服务器发送的所述同步数据库文件; 使用所述同步数据库文件替换所述数据库 文件, 以实现将所述服务器中存储的数据同步至所述终端。
根据本发明的实施方式, 还提供了一种机器可读程序, 所述程序使机器执行如上 所述技术方案中任一所述的数据同步方法。
根据本发明的实施方式, 还提供了一种存储有机器可读程序的存储介质, 其中,
所述机器可读程序使得机器执行如上所述技术方案中任一所述的数据同步方法。
根据本发明的实施方式, 还提供了一种存储在非易失性机器可读介质上的程序产 品, 用于数据同步, 所述程序产品包括用于使计算机系统执行以下步骤的机器可执行 指令: 接收终端发送的数据同步请求和数据库文件; 根据所述数据同步请求获取所述 服务器中存储的数据; 读取所述数据库文件中的数据, 并将所述数据库文件中的数据 与所述服务器中存储的数据进行对比, 以得到数据差异信息; 根据所述数据差异信息 对所述数据库文件进行处理操作, 以生成同步数据库文件; 将所述同步数据库文件发 送至所述终端, 以供所述终端使用所述同步数据库文件替换所述数据库文件, 以实现 将所述服务器中存储的数据同步至所述终端。
根据本发明的实施方式, 还提供了一种非易失机器可读介质, 存储有用于数据同 步的程序产品, 所述程序产品包括用于使计算机系统执行以下步骤的机器可执行指 令: 接收终端发送的数据同步请求和数据库文件; 根据所述数据同步请求获取所述服 务器中存储的数据; 读取所述数据库文件中的数据, 并将所述数据库文件中的数据与 所述服务器中存储的数据进行对比, 以得到数据差异信息; 根据所述数据差异信息对 所述数据库文件进行处理操作, 以生成同步数据库文件; 将所述同步数据库文件发送 至所述终端, 以供所述终端使用所述同步数据库文件替换所述数据库文件, 以实现将 所述服务器中存储的数据同步至所述终端。
根据本发明的实施方式, 还提供了一种机器可读程序, 所述程序使机器执行如上 所述技术方案中任一所述的数据同步方法。
根据本发明的实施方式, 还提供了一种存储有机器可读程序的存储介质, 其中, 所述机器可读程序使得机器执行如上所述技术方案中任一所述的数据同步方法。
以上所述仅为本发明的优选实施例而已, 并不用于限制本发明, 对于本领域的技 术人员来说, 本发明可以有各种更改和变化。 凡在本发明的精神和原则之内, 所作的 任何修改、 等同替换、 改进等, 均应包含在本发明的保护范围之内。
Claims
1. 一种终端侧数据同步装置, 用于实现终端和服务器之间的数据同步, 其特征 在于, 包括:
获取单元, 当接收到数据同步请求时, 获取所述终端中的数据库文件; 发送单元, 将所述数据同步请求和所述数据库文件发送至所述服务器, 以供所述 服务器根据所述数据同步请求获取所述服务器中存储的数据, 并根据所述数据库文件 和所述服务器中存储的数据生成与所述数据同步请求对应的同步数据库文件, 并发送 所述同步数据库文件至所述终端;
接收单元, 接收所述服务器发送的所述同步数据库文件;
替换单元, 使用所述同步数据库文件替换所述数据库文件, 以实现将所述服务器 中存储的数据同步至所述终端。
2. 根据权利要求 1 所述的终端侧数据同步装置, 其特征在于, 所述获取单元还 用于:
在接收到所述数据同步请求时, 获取所述服务器中存储的数据的数量, 在所述数 量超过预设数量时, 获取所述终端中的数据库文件。
3. 根据权利要求 1所述的终端侧数据同步装置, 其特征在于,
所述获取单元还用于:
获取与所述数据库文件对应的版本信息, 其中, 所述版本信息包括数据库版本信 息和业务逻辑版本信息;
所述发送单元还用于:
发送所述版本信息至所述服务器。
4. 根据权利要求 1所述的终端侧数据同步装置, 其特征在于, 还包括: 第一文件处理单元, 对所述获取单元获取的所述数据库文件进行压缩和加密处 理, 以得到处理后的数据库文件;
所述发送单元还用于:
发送所述处理后的数据库文件至所述服务器。
5. 根据权利要求 1至 4中任一项所述的终端侧数据同步装置, 其特征在于, 所述接收单元还用于:
接收所述服务器发送的处理后的同步数据库文件;
还包括:
第二文件处理单元, 对所述处理后的同步数据库文件进行解密和解压缩处理, 以 得到所述同步数据库文件。
6. 一种服务器侧数据同步装置, 用于实现终端和服务器之间的数据同步, 其特 征在于, 包括:
接收单元, 接收终端发送的数据同步请求和数据库文件;
获取单元, 根据所述数据同步请求获取所述服务器中存储的数据;
对比单元, 读取所述数据库文件中的数据, 并将所述数据库文件中的数据与所述 服务器中存储的数据进行对比, 以得到数据差异信息;
生成单元, 根据所述数据差异信息对所述数据库文件进行处理操作, 以生成同步 数据库文件;
发送单元, 将所述同步数据库文件发送至所述终端, 以供所述终端使用所述同步 数据库文件替换所述数据库文件, 以实现将所述服务器中存储的数据同步至所述终 端。
7. 根据权利要求 6 所述的服务器侧数据同步装置, 其特征在于, 所述接收单元 还用于:
接收所述终端发送的与所述数据库文件对应的版本信息;
所述生成单元还用于:
根据所述版本信息和所述数据差异信息对所述数据库文件进行处理操作, 以生成 所述同步数据库文件。
8. 根据权利要求 6所述的服务器侧数据同步装置, 其特征在于,
所述接收单元还用于:
接收所述终端发送的处理后的数据库文件;
还包括:
解压单元, 对所述处理后的数据库文件进行解压缩和解密处理, 以得到所述数据 库文件。
9. 根据权利要求 6所述的服务器侧数据同步装置, 其特征在于, 还包括: 加密单元, 对所述同步数据库文件进行加密和压缩处理, 以得到处理后的同步数
据库文件;
所述发送单元还用于:
将所述处理后的同步数据库文件发送至所述终端。
10. 根据权利要求 6至 9中任一项所述的服务器侧数据同步装置, 其特征在于, 所述处理操作包括: 增加操作、 删除操作和 /或修改操作。
1 1. 一种终端侧数据同步方法, 用于实现终端和服务器之间的数据同步, 其特征 在于, 包括:
当接收到数据同步请求时, 获取所述终端中的数据库文件;
将所述数据同步请求和所述数据库文件发送至所述服务器, 以供所述服务器根据 所述数据同步请求获取所述服务器中存储的数据, 并根据所述数据库文件和所述服务 器中存储的数据生成与所述数据同步请求对应的同步数据库文件, 并发送所述同步数 据库文件至所述终端;
接收所述服务器发送的所述同步数据库文件;
使用所述同步数据库文件替换所述数据库文件, 以实现将所述服务器中存储的数 据同步至所述终端。
12. 根据权利要求 1 1所述的终端侧数据同步方法, 其特征在于, 还包括: 在接收到所述数据同步请求时, 获取所述服务器中存储的数据的数量, 在所述数 量超过预设数量时, 获取所述终端中的数据库文件。
13. 根据权利要求 1 1所述的终端侧数据同步方法, 其特征在于, 还包括: 获取与所述数据库文件对应的版本信息, 其中, 所述版本信息包括数据库版本信 息和业务逻辑版本信息; 以及
发送所述版本信息至所述服务器。
14. 根据权利要求 1 1所述的终端侧数据同步方法, 其特征在于, 还包括: 对获取的所述数据库文件进行压缩和加密处理, 以得到处理后的数据库文件; 发送所述处理后的数据库文件至所述服务器。
15. 根据权利要求 1 1至 14中任一项所述的终端侧数据同步方法, 其特征在于, 还包括:
接收所述服务器发送的处理后的同步数据库文件;
对所述处理后的同步数据库文件进行解密和解压缩处理, 以得到所述同步数据库
文件。
16. 一种服务器侧数据同步方法, 用于实现终端和服务器之间的数据同步, 其特 征在于, 包括:
接收终端发送的数据同步请求和数据库文件;
根据所述数据同步请求获取所述服务器中存储的数据;
读取所述数据库文件中的数据, 并将所述数据库文件中的数据与所述服务器中存 储的数据进行对比, 以得到数据差异信息;
根据所述数据差异信息对所述数据库文件进行处理操作, 以生成同步数据库文 件;
将所述同步数据库文件发送至所述终端, 以供所述终端使用所述同步数据库文件 替换所述数据库文件, 以实现将所述服务器中存储的数据同步至所述终端。
17. 根据权利要求 16所述的服务器侧数据同步方法, 其特征在于, 还包括: 接收所述终端发送的与所述数据库文件对应的版本信息;
根据所述版本信息和所述数据差异信息对所述数据库文件进行处理操作, 以生成 所述同步数据库文件。
18. 根据权利要求 16所述的服务器侧数据同步方法, 其特征在于, 还包括: 接收所述终端发送的处理后的数据库文件;
对所述处理后的数据库文件进行解压缩和解密处理, 以得到所述数据库文件。
19. 根据权利要求 16所述的服务器侧数据同步方法, 其特征在于, 还包括: 对所述同步数据库文件进行加密和压缩处理, 以得到处理后的同步数据库文件; 将所述处理后的同步数据库文件发送至所述终端。
20. 根据权利要求 16 至 19 中任一项所述的服务器侧数据同步方法, 其特征在 于, 所述处理操作包括: 增加操作、 删除操作和 /或修改操作。
Priority Applications (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| PCT/CN2014/072576 WO2015127607A1 (zh) | 2014-02-26 | 2014-02-26 | 终端侧和服务器侧数据同步装置及方法 |
Applications Claiming Priority (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| PCT/CN2014/072576 WO2015127607A1 (zh) | 2014-02-26 | 2014-02-26 | 终端侧和服务器侧数据同步装置及方法 |
Publications (1)
| Publication Number | Publication Date |
|---|---|
| WO2015127607A1 true WO2015127607A1 (zh) | 2015-09-03 |
Family
ID=54008127
Family Applications (1)
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| PCT/CN2014/072576 Ceased WO2015127607A1 (zh) | 2014-02-26 | 2014-02-26 | 终端侧和服务器侧数据同步装置及方法 |
Country Status (1)
| Country | Link |
|---|---|
| WO (1) | WO2015127607A1 (zh) |
Citations (3)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN1968076A (zh) * | 2006-04-28 | 2007-05-23 | 华为技术有限公司 | 设备间数据同步的方法 |
| CN101000619A (zh) * | 2006-12-25 | 2007-07-18 | 华为技术有限公司 | 基于sql的数据同步方法及装置 |
| CN101243426A (zh) * | 2005-08-12 | 2008-08-13 | 微软公司 | 媒体播放器服务库 |
-
2014
- 2014-02-26 WO PCT/CN2014/072576 patent/WO2015127607A1/zh not_active Ceased
Patent Citations (3)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN101243426A (zh) * | 2005-08-12 | 2008-08-13 | 微软公司 | 媒体播放器服务库 |
| CN1968076A (zh) * | 2006-04-28 | 2007-05-23 | 华为技术有限公司 | 设备间数据同步的方法 |
| CN101000619A (zh) * | 2006-12-25 | 2007-07-18 | 华为技术有限公司 | 基于sql的数据同步方法及装置 |
Similar Documents
| Publication | Publication Date | Title |
|---|---|---|
| US11126590B2 (en) | Data processing method and device | |
| CN113273163A (zh) | 文件上传方法、文件下载方法和文件管理装置 | |
| US20160330611A1 (en) | Methods for sending and receiving user data and terminal devices | |
| CN107302706B (zh) | 图像防盗链方法、装置及电子设备 | |
| CN105279047B (zh) | 数据备份装置、方法及数据恢复装置、方法 | |
| TW201901473A (zh) | 資料備份方法、裝置、存儲介質及伺服器 | |
| CN112714359B (zh) | 视频推荐方法、装置、计算机设备及存储介质 | |
| CN106201783B (zh) | 一种数据恢复方法和装置 | |
| CN106453572B (zh) | 基于云服务器同步图像的方法及系统 | |
| CN113987563B (zh) | 数据处理方法、系统、产品、设备及存储介质 | |
| CN104268033A (zh) | 终端数据的存储方法、恢复终端默认设置的方法及装置 | |
| CN103823726A (zh) | Sim卡数据备份方法及终端 | |
| CN102495772A (zh) | 一种基于特征的终端程序云备份及恢复方法 | |
| US9332405B2 (en) | Short message backup method, mobile terminal, and server | |
| CN105760772A (zh) | 用于管理数据的方法和电子设备 | |
| CN110460660B (zh) | 一种联系人信息的同步方法和装置 | |
| CN108337208B (zh) | 基于云存储的数据保护方法、替换装置以及云存储系统 | |
| CN108009053A (zh) | 智能手机核心数据管理和克隆方法 | |
| TW201317823A (zh) | 一種雲端安全儲存系統 | |
| CN109032694A (zh) | 一种数据加载方法及终端 | |
| CN104917819B (zh) | 一种实现数据同步的方法及系统 | |
| US11442892B2 (en) | File and data migration to storage system | |
| CN106909474A (zh) | 一种移动终端上系统应用的恢复方法及装置 | |
| CN106648671A (zh) | 一种应用升级方法及终端 | |
| WO2015127607A1 (zh) | 终端侧和服务器侧数据同步装置及方法 |
Legal Events
| Date | Code | Title | Description |
|---|---|---|---|
| 121 | Ep: the epo has been informed by wipo that ep was designated in this application |
Ref document number: 14883881 Country of ref document: EP Kind code of ref document: A1 |
|
| NENP | Non-entry into the national phase |
Ref country code: DE |
|
| 32PN | Ep: public notification in the ep bulletin as address of the adressee cannot be established |
Free format text: NOTING OF LOSS OF RIGHTS PURSUANT TO RULE 112(1) EPC (EPO FORM 1205N DATED 06.02.2017) |
|
| 122 | Ep: pct application non-entry in european phase |
Ref document number: 14883881 Country of ref document: EP Kind code of ref document: A1 |