Method, apparatus, electronic device and readable medium for data synchronization

By obtaining and updating file information, only the file content selected by the user is synchronized, the slow response speed and user operation blockage caused by the large amount of data during the draft data synchronization process is solved, and the user experience is improved.

CN114385570BActive Publication Date: 2025-07-22FUTU NETWORK TECH (SHENZHEN) CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202111647526.5
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-12-29
Publication Date
2025-07-22
Estimated Expiration
2041-12-29

AI Technical Summary

Technical Problem

In the prior art, the draft data synchronization process requires the transmission and reception of a large amount of data, which can easily cause the synchronization process to block user operations and affect response speed and user experience.

Method used

By obtaining remote and local files information, updating file information, displaying update files and obtaining file selection messages to be synchronized, only the file contents selected by the user are synchronized, and synchronizing using version information.

Benefits of technology

The data volume of data in the data synchronization process is reduced, the response speed is improved, the synchronization process is prevented from blocking user operations, and the user experience is improved.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114385570B_ABST
    Figure CN114385570B_ABST
Patent Text Reader

Abstract

The present application provides a method, apparatus, electronic device, and readable medium for data synchronization. The method includes: obtaining file information of each remote file, where the file information includes version information; updating the file information of each local file according to the matching result between the file information of each remote file and the file information of each local file stored locally, to obtain each updated file; displaying each updated file, and obtaining a message for selecting files to be synchronized, where the message for selecting files to be synchronized includes the files to be synchronized determined from each updated file; synchronizing the files to be synchronized with the remote files according to the version information of the files to be synchronized. This method can synchronize only the file content of the files to be synchronized that need to be edited, thereby reducing the amount of data in the data synchronization process of the draft, improving the response speed, and further being able to avoid blocking user operations during the synchronization process and improving the user experience.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of computer technology, and particularly to a method, apparatus, electronic device, and readable medium for data synchronization. Background Art

[0002] Currently, with the development of cloud technology, various local functions of software have been transferred to the cloud for execution. In various content publishing platforms, functions related to draft editing and saving have also been transferred to the cloud for execution.

[0003] In the related art, drafts edited by users in local applications are synchronized to the cloud. When the user logs in on other devices, the unfinished drafts are retrieved from the cloud to continue editing.

[0004] However, in the above solution, the data synchronization process of drafts requires the draft data in the cloud and local applications to be consistent, and the amount of data to be transmitted and received is large, which is likely to cause the synchronization process to block user operations, thereby reducing the response speed and affecting the user experience. Summary of the Invention

[0005] Based on the above technical problems, this application provides a method, apparatus, electronic device, and readable medium for data synchronization, which can synchronize only the file content of the files to be synchronized for editing, thereby reducing the amount of data in the draft data synchronization process, improving the response speed, and further avoiding blocking user operations during the synchronization process and improving the user experience.

[0006] Other features and advantages of this application will become apparent through the following detailed description, or be learned in part through the practice of this application.

[0007] According to one aspect of the embodiments of this application, a method for data synchronization is provided, including:

[0008] Obtain the file information of each remote file, where the file information includes version information;

[0009] Update the file information of each local file according to the matching result of the file information of each remote file and the file information of each local file stored locally, to obtain each updated file;

[0010] Display each updated file, and obtain a message for selecting a file to be synchronized, where the message for selecting a file to be synchronized includes the file to be synchronized determined from each updated file;

[0011] Synchronize the file to be synchronized with the remote file according to the version information of the file to be synchronized.

[0012] In some embodiments of the present application, based on the above technical solutions, according to one aspect of the embodiments of the present application, a data synchronization device is provided, including:

[0013] An information acquisition module, configured to acquire file information of each remote file, where the file information includes version information;

[0014] An information update module, configured to update the file information of each local file according to the matching result between the file information of each remote file and the file information of each local file stored locally, to obtain each updated file;

[0015] A message acquisition module, configured to display each updated file and acquire a message for selecting a file to be synchronized, where the message for selecting a file to be synchronized includes a file to be synchronized determined from each updated file;

[0016] A file synchronization module, configured to synchronize the file to be synchronized with the remote file according to the version information of the file to be synchronized.

[0017] In some embodiments of the present application, based on the above technical solutions, the file information includes description information and a file identifier; the information update module includes:

[0018] A relationship determination unit, configured to determine the corresponding relationship between the remote file and the local file according to the file identifier of each remote file and the file identifier of each local file;

[0019] A description information synchronization unit, configured to, for a local file with a corresponding remote file, synchronize the description information of the remote file with the description information of the local file according to the comparison result between the version information of the local file and the version information of the corresponding remote file;

[0020] A local file generation unit, configured to, for a remote file without a corresponding local file, generate a corresponding local file according to the file information of the remote file;

[0021] A file update unit, configured to determine the generated local file and the updated local file as updated files.

[0022] In some embodiments of the present application, based on the above technical solutions, the description information synchronization unit includes:

[0023] A status setting subunit, configured to, if the version information of the local file is greater than the version information of the corresponding remote file, set the synchronization status of the local file to a status to be uploaded, so as to trigger a synchronization operation for updating the corresponding remote file according to the local file;

[0024] A description information update subunit, configured to update the description information of the file to be synchronized according to the description information of the remote file if the version information of the local file is less than the version information of the corresponding remote file.

[0025] In some embodiments of the present application, based on the above technical solution, the description information update subunit is further configured to, if the synchronization status of the local file is in a to-be-uploaded state, copy the local file to generate a file copy of the local file, and replace the description information of the local file with the description information of the remote file.

[0026] In some embodiments of the present application, based on the above technical solution, the file synchronization module includes:

[0027] A status check unit, configured to check the synchronization status of the target file if the version information of the file to be synchronized is less than the version information of the remote file;

[0028] A content replacement unit, configured to replace the file content of the file to be synchronized with the file content of the remote file if the synchronization status of the file to be synchronized is in an uploaded state;

[0029] A copy sending unit, configured to copy the file to be synchronized to generate a file copy of the file to be synchronized and send the file copy of the file to be synchronized to the server for data synchronization if the synchronization status of the file to be synchronized is in a to-be-uploaded state.

[0030] In some embodiments of the present application, based on the above technical solution, the data synchronization device further includes:

[0031] A file acquisition module, configured to acquire the to-be-uploaded files in a to-be-uploaded state from the respective updated files;

[0032] A description information generation module, configured to generate and replace the description information of the to-be-uploaded file according to the file content of the to-be-uploaded file;

[0033] A file upload module, configured to send the to-be-uploaded file to the server so that the server performs data synchronization according to the to-be-uploaded file.

[0034] In some embodiments of the present application, based on the above technical solution, the description information generation module includes:

[0035] A content acquisition unit, configured to acquire the file content of the to-be-uploaded file;

[0036] A text truncation unit, configured to truncate at least one line of text data in the file content if the file content includes two or more lines of text content;

[0037] A description information replacement unit, configured to use at least one line of intercepted text data as the description information of the file to be uploaded and replace the description information of the file to be uploaded.

[0038] In some embodiments of the present application, based on the above technical solutions, the data synchronization device further includes:

[0039] A weight calculation module, configured to calculate the priority weights of each local file based on the modification history of the local file, where the modification history includes at least one of the following information: modification time, modification frequency, and number of modifications;

[0040] A sequence determination module, configured to determine the upload sequence of each local file according to the priority weights of the local files;

[0041] A file synchronization module, configured to synchronize each local file with the corresponding remote file according to the upload sequence.

[0042] According to one aspect of the embodiments of the present application, there is provided an electronic device, which includes: a processor; and a memory for storing executable instructions of the processor; wherein, the processor is configured to execute the data synchronization method in the above technical solutions by executing the executable instructions.

[0043] According to one aspect of the embodiments of the present application, there is provided a computer-readable storage medium, on which a computer program is stored, and when the computer program is executed by a processor, the data synchronization method in the above technical solutions is implemented.

[0044] In the embodiments of the present application, when performing draft synchronization, first synchronize the file information of each draft, and then according to the files to be synchronized selected by the user, it is possible to synchronize only the file content of the files to be synchronized to be edited, thereby reducing the amount of data in the draft data synchronization process, improving the response speed, and further being able to avoid blocking the user operation during the synchronization process and improving the user experience.

[0045] It should be understood that the above general description and the following detailed description are only exemplary and explanatory, and cannot limit the present application. BRIEF DESCRIPTION OF THE DRAWINGS

[0046] The accompanying drawings here are incorporated into the specification and constitute a part of the specification, showing embodiments consistent with the present application, and are used together with the specification to explain the principles of the present application. Obviously, the accompanying drawings in the following description are only some embodiments of the present application, and those of ordinary skill in the art can obtain other drawings based on these drawings without creative efforts.

[0047] In the drawings:

[0048] Figure 1 It is a schematic diagram of an exemplary system architecture in an application scenario of the technical solution of this application;

[0049] Figure 2 It is a flowchart of a data synchronization method provided by an embodiment of this application;

[0050] Figure 3 It is a schematic flowchart of the cloud draft list synchronization solution in an embodiment of this application;

[0051] Figure 4 It is a schematic flowchart of the cloud draft file synchronization solution in an embodiment of this application;

[0052] Figure 5 It schematically shows a block diagram of the composition of a data synchronization device in an embodiment of this application;

[0053] Figure 6 It shows a schematic diagram of the structure of a computer system of an electronic device suitable for implementing an embodiment of this application. Detailed implementation manners

[0054] Now, example embodiments will be described more fully with reference to the accompanying drawings. However, the example embodiments can be implemented in various forms and should not be construed as limited to the examples set forth herein; rather, these embodiments are provided so that this application will be more complete and comprehensive, and will fully convey the concept of the example embodiments to those skilled in the art.

[0055] In addition, the described features, structures, or characteristics can be combined in any suitable manner in one or more embodiments. In the following description, numerous specific details are provided to give a thorough understanding of the embodiments of this application. However, those skilled in the art will realize that the technical solutions of this application can be practiced without one or more of the specific details, or other methods, components, devices, steps, etc. can be adopted. In other cases, well-known methods, devices, implementations, or operations are not shown or described in detail to avoid obscuring aspects of this application.

[0056] The block diagrams shown in the drawings are only functional entities and do not necessarily correspond to physically independent entities. That is, these functional entities can be implemented in software form, or implemented in one or more hardware modules or integrated circuits, or implemented in different networks and / or processor devices and / or microcontroller devices.

[0057] The flowcharts shown in the accompanying drawings are merely illustrative and not necessarily include all content and operations / steps, nor are they necessarily executed in the described order. For example, some operations / steps can be decomposed, while some operations / steps can be combined or partially combined. Therefore, the actual execution order may change according to the actual situation.

[0058] It should be understood that this application can be applied to social platforms, various information, article, or media information publishing platforms, and various platforms with content publishing functions. In such platforms, the draft files edited by users in the client can be synchronized to the cloud for storage and downloaded from the cloud for continued editing when the user logs in to another device. However, when the user has a large number of saved drafts, the client needs to first synchronize the content in each draft with the server before allowing the client to edit the draft. Through the solution of this application, when synchronizing drafts, the client will first only synchronize the file information of the draft, such as the abstract of the draft, and display it to the user. When the user selects a specific draft to edit, the client will continue to synchronize the specific content of the draft, thereby reducing the amount of data in the synchronization process and improving the response speed.

[0059] The following takes a social platform as an example to introduce the application scenario of this application. Please refer to Figure 1 , Figure 1 which is a schematic diagram of an exemplary system architecture of the technical solution of this application in an application scenario.

[0060] As Figure 1 shown, in this system architecture, it includes a terminal 110, a cloud server 120, and a terminal 130. The terminal 110 and the terminal 130 are connected to the cloud server 120 through a network.

[0061] Both the terminal 110 and the terminal 130 can be a smart phone, a tablet computer, a notebook computer, a desktop computer, a smart speaker, a smart watch, etc., but are not limited thereto. The terminal 110 is installed with and runs a client for information publishing, such as functions like dynamic publishing or article publishing, or accesses a corresponding website through a network browsing application such as a browser. The cloud server 120 can be an independent physical server, a server cluster or a distributed system composed of multiple physical servers, or a cloud server providing basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, CDN (Content Delivery Network), and big data and artificial intelligence platforms. The order server 120 is used to provide background services for the clients running on the terminal 110 and the terminal 130.

[0062] The cloud server 120 can be a server that provides cloud drafts for users. First, a user can edit draft A on the terminal 110. Draft A will be uploaded to the cloud server 120. When the user logs in on another terminal 130, the terminal will communicate with the cloud server 120 to obtain draft A uploaded through the terminal 110. It can be understood that drafts previously created may already be stored on the terminal 130. During the synchronization process, the drafts already stored on the terminal 130 will update the local drafts according to the status of the drafts on the cloud server 120. The user can edit the synchronized draft A on the terminal 130 to obtain draft A', and synchronize it with the cloud server 120 to update and replace draft A on the cloud server 120 with draft A'. When the user logs in on the terminal 110 again, the terminal 110 will synchronize with the cloud server 120 to replace the local draft A with draft A' edited and uploaded by the terminal 130.

[0063] The above terminal 110 and terminal 130 can be directly or indirectly connected to the cloud server 120 through wired or wireless communication methods, and the embodiments of the present application do not limit this.

[0064] Those skilled in the art can know that the number of the above terminals can be more or less. For example, there can be only one of the above terminals, or there can be dozens or hundreds of the above terminals, or even more. The embodiments of the present application do not limit the number and device type of the terminals. The technical solutions provided by the present application will be described in detail below in conjunction with specific embodiments.

[0065] For the convenience of introduction, please refer to Figure 2 , Figure 2 is a flowchart of a data synchronization method provided by an embodiment of the present application. This method can be applied to the above terminal. In the embodiments of the present application, taking the computer device of the terminal as the execution subject, this data synchronization method will be introduced. This data synchronization method can include the following steps S210 to step S240:

[0066] Step S210, obtain the file information of each remote file, and the file information includes version information.

[0067] A remote file refers to a file that is synchronized by the terminal to the cloud server for storage, such as a draft file. File information refers to the file description content other than the content of the remote file itself. For example, the name of the file, file description information, and a brief introduction to the file content, etc. The obtaining process can be executed page by page. The client obtains the file information of the corresponding number of remote files from the server according to the number required for each page in the paged display, and loops until there are no more files in the cloud.

[0068] Step S220: Update the file information of each local file according to the matching results between the file information of each remote file and the file information of each local file stored locally, to obtain each updated file.

[0069] A local file is a file stored in the computer device of the client. The matching remote file and local file can be the same version or different versions of the same draft file. The matching process can be determined based on the file name or number of the file, etc. For the matching remote file and local file, the file information of the local file needs to be updated correspondingly so that the file information of the local file can correspond to the most recent version of the file, to obtain the updated file. When the version of the remote file is later than that of the local file, the updated file will include the file information of the remote file and the file content of the local file, even if they do not match exactly. The updated file can be displayed to the user, and the content displayed mainly includes the content in the file information, such as name, abstract, update time, etc. The user can then select the file to be edited according to the file information of the displayed updated file, and further update the specific content of the file.

[0070] Step S230: Obtain a message for selecting a file to be synchronized, where the message for selecting a file to be synchronized includes the file to be synchronized determined from each updated file.

[0071] The message for selecting a file to be synchronized is a message generated according to the user's selection. After the list composed of each updated file is displayed to the user, the user can select one file from it as the file to be synchronized for editing. The client will then obtain the file selected by the user according to the user's selection operation to generate a message for selecting a file to be synchronized, so as to trigger the subsequent process.

[0072] Step S240: Synchronize the file to be synchronized with the remote file according to the version information of the file to be synchronized.

[0073] After determining the file to be synchronized selected by the user, synchronization can be performed according to the version information of the file to be synchronized. If the version of the file to be synchronized is the initial version, or if there is no corresponding remote file for the file to be synchronized, the synchronization process can be skipped. If there is a corresponding remote file, it is necessary to determine which file among the file to be synchronized and the remote file is the most recently updated file according to the version information, and update the file content of the other party according to the most recently updated file. In addition, according to whether the file to be synchronized has been uploaded to the server, before synchronization or overwriting, the content that has not been uploaded needs to be saved to prevent the content edited by the user from being lost.

[0074] In an embodiment of the present application, when synchronizing drafts, first synchronize the file information of each draft, and then, according to the files to be synchronized selected by the user, it is possible to synchronize only the file content of the files to be synchronized to be edited, thereby reducing the amount of data in the data synchronization process of the drafts, improving the response speed, and further being able to avoid blocking the user operation during the synchronization process and improving the user experience.

[0075] In one embodiment, based on the above solution, the file information includes description information and a file identifier; in step S220 above, according to the matching result of the file information of each remote file and the file information of each local file stored locally, update the file information of each local file to obtain each updated file, including the following steps:

[0076] Determine the corresponding relationship between the remote file and the local file according to the file identifier of each remote file and the file identifier of each local file;

[0077] For a local file with a corresponding remote file, synchronize the description information of the remote file with the description information of the local file according to the comparison result of the version information of the local file and the version information of the corresponding remote file;

[0078] For a remote file without a corresponding local file, generate a corresponding local file according to the file information of the remote file;

[0079] Determine the generated local file and the updated local file as the updated files.

[0080] Specifically, a corresponding relationship can be established between a remote file and a local file with the same file identifier, and they are the same or different versions of the same file. Each remote file corresponds to a local file. However, not every remote file necessarily has a corresponding local file, nor does every local file necessarily have a corresponding remote file. For example, a local file created by the terminal when not connected to the network may not have a corresponding remote file, and a remote file uploaded by another device may also not have a corresponding local file on the current device.

[0081] For a local file with a corresponding remote file, compare the version information of the local file with the version information of the corresponding remote file, and determine which file has the latest version according to the comparison result, so as to synchronize the description information of the remote file with the description information of the local file. It should be noted that the synchronization process can be to overwrite the description information of the local file with the description information of the remote file, or vice versa, overwrite the description information of the remote file with the description information of the local file. It should be noted that the updated part only involves the description information of the file, and the file content of the file is not updated. In one embodiment, all the file information of the file can be synchronized according to the comparison result.

[0082] For a remote file that has no corresponding local file, the file information of the remote file can be directly downloaded and a local file can be generated. At this time, the file content of the generated local file is empty.

[0083] Both the generated local file and the updated local file are determined to be updated files. They together constitute a file list to be presented to the user, and are presented to the user to allow the user to select the files to be synchronized that they want to edit.

[0084] In one embodiment, based on the above solution, in the above steps, according to the comparison result of the version information of the local file and the version information of the corresponding remote file, synchronizing the description information of the remote file with the description information of the local file includes the following steps:

[0085] If the version information of the local file is greater than the version information of the corresponding remote file, set the synchronization status of the local file to the to-be-uploaded status, so as to trigger the synchronization operation of updating the corresponding remote file according to the local file;

[0086] If the version information of the file to be synchronized is less than the version information of the corresponding remote file, update the description information of the file to be synchronized according to the description information of the remote file.

[0087] Specifically, the version information of the local file being greater than the version information of the corresponding remote file indicates that the version of the local file is the latest version, so there is no need to update the description information of the local file. Set the synchronization status of the local file to the to-be-uploaded status, so as to trigger the synchronization operation of updating the corresponding remote file according to the local file. During the operation of the client, the synchronization operation will be triggered automatically and according to the user's operation. In the synchronization operation, all the local files in the to-be-uploaded status will be synchronized to the server. Multiple local files can be synchronized and uploaded during the synchronization process.

[0088] The version information of the file to be synchronized being less than the version information of the corresponding remote file indicates that the version of the remote file is the latest version, so the description information of the local file needs to be updated to the description information of the remote file.

[0089] For the case where the version information of the local file is equal to the version information of the corresponding remote file, no processing is required and the synchronization process of this file can be directly skipped.

[0090] In one embodiment, based on the above solution, in the above steps, updating the description information of the local file according to the description information of the remote file includes the following steps:

[0091] If the synchronization status of the local file is in the to-be-uploaded state, copy the local file to generate a file copy of the local file, and replace the description information of the local file with the description information of the remote file.

[0092] When the synchronization status of the local file is in the to-be-uploaded state, it means that although there is an updated version of the file on the server, the file has also been edited locally. Therefore, a copy of the local file can be made to become a file copy, so as to retain the content edited locally, and then update the description information of the original local file to the description information of the remote file.

[0093] In one embodiment, based on the above solution, the above step S240 of synchronizing the file to be synchronized with the remote file according to the version information of the file to be synchronized includes:

[0094] If the version information of the file to be synchronized is less than the version information of the remote file, check the synchronization status of the target file;

[0095] If the synchronization status of the file to be synchronized is in the uploaded state, replace the file content of the file to be synchronized with the file content of the remote file;

[0096] If the synchronization status of the file to be synchronized is in the to-be-uploaded state, copy the file to be synchronized to generate a file copy of the file to be synchronized, and send the file copy of the file to be synchronized to the server for data synchronization.

[0097] If the version information of the file to be synchronized is less than the version information of the remote file, check the synchronization status of the target file. If the version information of the file to be synchronized is greater than or equal to the version information of the remote file, there is no need to synchronize the file content, and the synchronization process can be directly ended. If the synchronization status of the file to be synchronized is in the uploaded state, replace the file content of the file to be synchronized with the file content of the remote file. At this time, the process of completely synchronizing the file to be synchronized with the remote file is completed, and the content modified locally will not be lost. If the synchronization status of the file to be synchronized is in the to-be-uploaded state, it means that the local file contains content that has not been uploaded. At this time, both the remote file and the file to be synchronized contain content that needs to be synchronized. Copy the file to be synchronized to generate a file copy of the file to be synchronized to save the local modified content, and send the file copy of the file to be synchronized to the server for data synchronization, so as to save the content edited locally on the server.

[0098] In one embodiment, based on the above solution, before the above step S230 of obtaining the file selection message to be synchronized, the method further includes the following steps:

[0099] Obtain the to-be-uploaded files in the to-be-uploaded state from each updated file;

[0100] Generate and replace the description information of the file to be uploaded according to the file content of the file to be uploaded;

[0101] Send the file to be uploaded to the server so that the server synchronizes data according to the file to be uploaded.

[0102] Specifically, after synchronizing the description information of each local file, the terminal can first synchronize the local files in the to-be-uploaded state to the server. First, obtain the files to be uploaded in the to-be-uploaded state from each updated file. Such files can be understood as files edited when the terminal is in the offline state, or local files that failed to be uploaded due to a previous failure. Subsequently, generate and replace the description information of the file to be uploaded according to the file content of the file to be uploaded. Update the description information before uploading to ensure that the description information matches the file content. After that, send the file to be uploaded to the server so that the server synchronizes data according to the file to be uploaded. Specifically, when sending the file to be uploaded, the version information of the file can be incremented by accumulation. The files to be uploaded that need to be synchronized can be the historical stock drafts of the old versions in each file. These drafts check the historical versions of all local files before obtaining the files to be uploaded, and set all the un-uploaded historical files to the to-be-uploaded state, thus becoming the files to be uploaded.

[0103] In one embodiment, based on the above solution, the above step of generating and replacing the description information of the file to be uploaded according to the file content of the file to be uploaded may include: obtaining the file content of the file to be uploaded; if the file content includes two or more lines of text content, intercept at least one line of text data in the file content. When the file content contains more than two lines of content, usually the first line in the file content is intercepted. Use the at least one line of text data intercepted as the description information of the file to be uploaded and replace the description information of the file to be uploaded.

[0104] In one embodiment, based on the above solution, the above method further includes:

[0105] Based on the modification history of the local files, calculate the priority weights of each local file, where the modification history includes at least one of the following information: modification time, modification frequency, and number of modifications; determine the upload sequence of each local file according to the priority weights of the local files; synchronize each local file with the corresponding remote file according to the upload sequence. Specifically, in calculating the priority weights, first determine the weight values of each calculation parameter. For the modification time, the most recent modification times of each local file can be sorted in descending order, and the closer the modification time, the higher the weight value. For the modification frequency, the weight value can be determined by sorting according to the magnitude of the modification frequency within a predetermined time period. For the number of modifications, the corresponding weight value can also be determined according to the magnitude of the number of modifications within a predetermined time period. In the process of determining the weight values, unit unification can be carried out in a normalized manner. Specifically, the priority weight can be calculated using the following formula:

[0106]

[0107] where P is the priority weight, S is the number of local files, m i is the order of the i-th local file in the modification time sorting, n i is the modification frequency of the i-th local file, h i is the number of modifications of the i-th local file. According to the priority weights, the upload times of the local files can be determined, so that the local files with recent modification time, high frequency, and large number of modifications are preferentially uploaded to the server. The following takes a draft as an example to introduce the specific solution of this application. For the convenience of introduction, please refer to Figure 3 , Figure 3 which is the flow diagram of the cloud draft list synchronization solution in the embodiment of this application. As shown in Figure 3As shown, the software program organizes and displays drafts in the form of a list. First, when the user enters the draft function in the software program, the software program incrementally obtains the cloud draft list from the server's cloud based on the draft list stored locally in the program. After the acquisition is successful, it will first determine whether the draft in the returned cloud draft list already exists in the local list. For drafts that do not exist, the software will create a local draft according to the cloud draft. For files that already exist in the cloud draft list, it will check whether the local draft has been uploaded to the server. If the local draft has not been uploaded to the server, the versions of the local draft and the cloud draft will be compared. If the local version is equal to or greater than the cloud version, no additional operation is required. If the local version is smaller than the cloud version, a copy of the local draft is copied and the local draft is overwritten with the cloud draft. If the local draft has been uploaded to the server, the versions of the local draft and the cloud draft are also compared. If the local version is equal to the cloud version, no additional operation is required. If the local version is greater than the cloud version, the local draft is set to the sent state. If the local version is smaller than the cloud version, the local draft is updated. At this point, the cloud list is obtained. Finally, start processing the drafts that have not been sent to the remote end. Check whether there are old versions of the existing drafts in the drafts. If so, convert the existing drafts to the state of not being uploaded to the cloud. After checking all the drafts in a loop, start checking whether there are drafts that are not uploaded to the cloud. If so, upload the drafts that are not uploaded to the cloud until all the drafts are uploaded.

[0108] The following is a detailed description of the synchronization process for a single draft. For ease of introduction, see Figure 4 , Figure 4 The following is a flowchart of the cloud draft file synchronization solution in the embodiment of the present application. After the above process is completed, a draft list will be displayed. The user can select the draft he wants to edit in the draft list and click it to trigger the synchronization process of a single cloud draft file. Figure 4As shown, the application will enter the cloud draft details page according to the user's click, and then check whether the cloud draft has been uploaded to the cloud. If the cloud draft has not been uploaded to the cloud, the application will upload the draft to the cloud. After the cloud receives the draft, it will check the drafts stored in the cloud. If the draft exists, it will send the draft in the cloud to the terminal. The terminal will then compare the local version and the cloud version. If the local version is greater than the cloud version, it will directly display the draft details. Otherwise, if the local version is equal to or less than the cloud version, it will copy the local draft copy. Subsequently, it will obtain the draft details in the cloud and overwrite the local cloud draft, and upload the copied draft copy. After that, it can display the overwritten cloud draft and the draft copy to the user. If the cloud draft has been uploaded to the cloud, the terminal will obtain the draft details of the cloud draft and compare the local version and the cloud version. If the local version is less than the cloud version, it will set the local draft to the un-uploaded state. Otherwise, it will overwrite the local draft with the cloud draft.

[0109] It should be noted that although the steps of the method in this application are described in a specific order in the accompanying drawings, this does not require or imply that these steps must be executed in that specific order, or that all the steps shown must be executed to achieve the desired result. Additionally or alternatively, some steps may be omitted, multiple steps may be combined into one step for execution, and / or one step may be decomposed into multiple steps for execution, etc.

[0110] The following introduces the device implementation of this application, which can be used to execute the data synchronization method in the above embodiments of this application. Figure 5 Schematically shows the block diagram of the composition of the data synchronization device in the embodiments of this application. As Figure 5 shown, the data synchronization device 500 mainly may include:

[0111] An information acquisition module 510, configured to acquire file information of each remote file, where the file information includes version information;

[0112] An information update module 520, configured to update the file information of each local file according to the matching result between the file information of each remote file and the file information of each local file stored locally, to obtain each updated file;

[0113] A message acquisition module 530, configured to display each updated file and acquire a message for selecting a file to be synchronized, where the message for selecting a file to be synchronized includes the file to be synchronized determined from each updated file;

[0114] A file synchronization module 540, configured to synchronize the file to be synchronized with the remote file according to the version information of the file to be synchronized.

[0115] In some embodiments of the present application, based on the above technical solutions, the file information includes description information and a file identifier; the information update module 520 includes:

[0116] A relationship determination unit, configured to determine the corresponding relationship between the remote file and the local file according to the file identifiers of each remote file and the file identifiers of each local file;

[0117] A description information synchronization unit, configured to, for a local file with a corresponding remote file, synchronize the description information of the remote file with the description information of the local file according to the comparison result of the version information of the local file and the version information of the corresponding remote file;

[0118] A local file generation unit, configured to, for a remote file without a corresponding local file, generate a corresponding local file according to the file information of the remote file;

[0119] A file update unit, configured to determine the generated local file and the updated local file as updated files.

[0120] In some embodiments of the present application, based on the above technical solutions, the description information synchronization unit includes:

[0121] A status setting subunit, configured to, if the version information of the local file is greater than the version information of the corresponding remote file, set the synchronization status of the local file to the to-be-uploaded status, so as to trigger the synchronization operation of updating the corresponding remote file according to the local file;

[0122] A description information update subunit, configured to, if the version information of the local file is less than the version information of the corresponding remote file, update the description information of the file to be synchronized according to the description information of the remote file.

[0123] In some embodiments of the present application, based on the above technical solutions, the description information update subunit is further configured to, if the synchronization status of the local file is in the to-be-uploaded status, copy the local file to generate a file copy of the local file, and replace the description information of the local file with the description information of the remote file.

[0124] In some embodiments of the present application, based on the above technical solutions, the file synchronization module 540 includes:

[0125] A status check unit, configured to, if the version information of the file to be synchronized is less than the version information of the remote file, check the synchronization status of the target file;

[0126] A content replacement unit, configured to, if the synchronization status of the file to be synchronized is in the uploaded status, replace the file content of the file to be synchronized with the file content of the remote file;

[0127] A copy sending unit, configured to, if the synchronization status of a file to be synchronized is in a to-be-uploaded state, copy the file to be synchronized to generate a file copy of the file to be synchronized, and send the file copy of the file to be synchronized to a server for data synchronization.

[0128] In some embodiments of the present application, based on the above technical solution, the data synchronization device 500 further includes:

[0129] A file acquisition module, configured to acquire to-be-uploaded files in a to-be-uploaded state from each updated file;

[0130] A description information generation module, configured to generate and replace the description information of the to-be-uploaded file according to the file content of the to-be-uploaded file;

[0131] A file upload module, configured to send the to-be-uploaded file to a server so that the server performs data synchronization according to the to-be-uploaded file.

[0132] In some embodiments of the present application, based on the above technical solution, the description information generation module includes:

[0133] A content acquisition unit, configured to acquire the file content of the to-be-uploaded file;

[0134] A text truncation unit, configured to, if the file content includes two or more lines of text content, truncate at least one line of text data in the file content;

[0135] A description information replacement unit, configured to use the at least one line of text data truncated as the description information of the to-be-uploaded file and replace the description information of the to-be-uploaded file.

[0136] In some embodiments of the present application, based on the above technical solution, the data synchronization device 500 further includes:

[0137] A weight calculation module, configured to calculate the priority weights of each local file based on the modification history of the local file, where the modification history includes at least one of the following information: modification time, modification frequency, and number of modifications;

[0138] A sequence determination module, configured to determine the upload sequence of each local file according to the priority weights of the local file;

[0139] A file synchronization module, configured to synchronize each local file with a corresponding remote file according to the upload sequence.

[0140] It should be noted that the device provided in the above embodiment and the method provided in the above embodiment belong to the same concept. The specific manners in which each module performs operations have been described in detail in the method embodiment, and will not be elaborated herein.

[0141] Figure 6 The figure shows a schematic structural diagram of a computer system of an electronic device suitable for implementing the embodiments of the present application.

[0142] It should be noted that Figure 6 The computer system 600 of the shown electronic device is only an example, and should not impose any restrictions on the functions and usage scope of the embodiments of the present application.

[0143] As Figure 6 shown, the computer system 600 includes a central processing unit (CPU) 601, which can perform various appropriate actions and processes according to the program stored in the read-only memory (ROM) 602 or the program loaded from the storage section 608 into the random access memory (RAM) 603. In the RAM 603, various programs and data required for system operation are also stored. The CPU 601, ROM 602, and RAM 603 are connected to each other via a bus 604. The input / output (I / O) interface 605 is also connected to the bus 604.

[0144] The following components are connected to the I / O interface 605: an input section 606 including a keyboard, a mouse, etc.; an output section 607 including, for example, a cathode ray tube (CRT), a liquid crystal display (LCD), etc., and a speaker, etc.; a storage section 608 including a hard disk, etc.; and a communication section 609 including a network interface card such as a LAN (Local Area Network) card, a modem, etc. The communication section 609 performs communication processing via a network such as the Internet. A drive 610 is also connected to the I / O interface 605 as needed. A removable medium 611, such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, etc., is installed on the drive 610 as needed, so that the computer program read from it can be installed into the storage section 608 as needed.

[0145] In particular, according to the embodiments of the present application, the processes described in each method flow chart can be implemented as computer software programs. For example, embodiments of the present application include a computer program product that includes a computer program carried on a computer-readable medium, and the computer program contains program code for performing the methods shown in the flow charts. In such an embodiment, the computer program can be downloaded and installed from a network through the communication section 609, and / or installed from the removable medium 611. When the computer program is executed by the central processing unit (CPU) 601, various functions defined in the system of the present application are executed.

[0146] It should be noted that the computer-readable medium shown in the embodiments of the present application can be a computer-readable signal medium, a computer-readable storage medium, or any combination of the two. A computer-readable storage medium can be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination of the above. More specific examples of the computer-readable storage medium can include, but are not limited to: an electrical connection having one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM), a flash memory, an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In the present application, the computer-readable storage medium can be any tangible medium that contains or stores a program that can be used by or in conjunction with an instruction execution system, apparatus, or device. In the present application, a computer-readable signal medium can include a data signal propagated in a baseband or as part of a carrier wave, which carries computer-readable program code. Such a propagated data signal can take various forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. A computer-readable signal medium can also be any computer-readable medium other than a computer-readable storage medium, which can send, propagate, or transmit a program for use by or in conjunction with an instruction execution system, apparatus, or device. The program code contained on the computer-readable medium can be transmitted by any appropriate medium, including but not limited to: wireless, wired, etc., or any suitable combination of the above.

[0147] The flowcharts and block diagrams in the accompanying drawings illustrate the possible architectures, functions, and operations of systems, methods, and computer program products according to various embodiments of the present application. In this regard, each block in the flowchart or block diagram may represent a module, a segment of a program, or a part of code, and the above-mentioned module, segment of a program, or part of code includes one or more executable instructions for implementing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the blocks may occur in a different order than that marked in the accompanying drawings. For example, two consecutive blocks shown may actually be executed substantially in parallel, and they may sometimes be executed in the reverse order, depending on the functions involved. It should also be noted that each block in the block diagram or flowchart, as well as the combination of blocks in the block diagram or flowchart, can be implemented by a dedicated hardware-based system for performing the specified functions or operations, or can be implemented by a combination of dedicated hardware and computer instructions.

[0148] It should be noted that although several modules or units of devices for action execution are mentioned in the above detailed description, this division is not mandatory. In fact, according to the embodiments of the present application, the features and functions of the two or more modules or units described above can be embodied in one module or unit. Conversely, the features and functions of one module or unit described above can be further divided and embodied by multiple modules or units.

[0149] From the description of the above embodiments, those skilled in the art can easily understand that the example embodiments described herein can be implemented by software, or can be implemented by a combination of software and necessary hardware. Therefore, the technical solutions according to the embodiments of the present application can be embodied in the form of a software product, which can be stored in a non-volatile storage medium (which can be a CD-ROM, a USB flash drive, a portable hard disk, etc.) or on a network, and includes several instructions to enable a computing device (which can be a personal computer, a server, a touch terminal, or a network device, etc.) to execute the method according to the embodiments of the present application.

[0150] After considering the specification and practicing the invention disclosed herein, those skilled in the art will readily conceive of other embodiments of the present application. The present application is intended to cover any variations, uses, or adaptations of the present application, which follow the general principles of the present application and include common general knowledge or conventional technical means in the technical field not disclosed in the present application.

[0151] It should be understood that the present application is not limited to the exact structures described above and shown in the accompanying drawings, and various modifications and changes can be made without departing from its scope. The scope of the present application is only limited by the appended claims.

Claims

1. A method for data synchronization, characterized in that, Including: Obtaining file information of each remote file, where the file information is file description information including version information and does not include the file content of the corresponding remote file; Updating the file information of each local file according to the matching result of the file information of each remote file and the file information of each local file stored locally, to obtain each updated file, where the updated file includes the file information of the remote file and the file content of the local file; Obtaining the files to be uploaded in a to-be-uploaded state from each of the updated files; Generating and replacing the description information of the file to be uploaded according to the file content of the file to be uploaded; Sending the file to be uploaded to the server so that the server performs data synchronization according to the file to be uploaded; Displaying each of the updated files and obtaining a file selection message for synchronization, where the file selection message for synchronization includes the files to be synchronized determined from each of the updated files; Synchronizing the file content of the file to be synchronized with the file content of the remote file according to the version information of the file to be synchronized.

2. The method according to claim 1, wherein The file information further includes description information and a file identifier; the updating the file information of each local file according to the matching result of the file information of each remote file and the file information of each local file stored locally to obtain each updated file includes: Determining the corresponding relationship between the remote file and the local file according to the file identifier of each remote file and the file identifier of each local file; For a local file with a corresponding remote file, synchronizing the description information of the remote file with the description information of the local file according to the comparison result of the version information of the local file and the version information of the corresponding remote file; For a remote file without a corresponding local file, generating a corresponding local file according to the file information of the remote file; Determining the generated local file and the updated local file as updated files.

3. The method according to claim 2, wherein The synchronizing the description information of the remote file with the description information of the local file according to the comparison result of the version information of the local file and the version information of the corresponding remote file includes: If the version information of the local file is greater than the version information of the corresponding remote file, setting the synchronization status of the local file to the to-be-uploaded state to facilitate triggering a synchronization operation for updating the corresponding remote file according to the local file; If the version information of the local file is less than the version information of the corresponding remote file, updating the description information of the file to be synchronized according to the description information of the remote file.

4. The method according to claim 3, characterized in that, The updating the description information of the file to be synchronized according to the description information of the remote file includes: If the synchronization status of the local file is in the to-be-uploaded state, copying the local file to generate a file copy of the local file and replacing the description information of the local file with the description information of the remote file.

5. The method according to claim 1, wherein The synchronizing the file to be synchronized with the remote file according to the version information of the file to be synchronized includes: If the version information of the file to be synchronized is less than the version information of the remote file, check the synchronization status of the file to be synchronized; If the synchronization status of the file to be synchronized is in the uploaded state, replace the file content of the file to be synchronized with the file content of the remote file; If the synchronization status of the file to be synchronized is in the to-be-uploaded state, copy the file to be synchronized to generate a file copy of the file to be synchronized, and send the file copy of the file to be synchronized to the server for data synchronization.

6. The method according to claim 1, wherein The method further includes: Based on the modification history of the local file, calculate the priority weights of each local file, where the modification history includes at least one of the following information: modification time, modification frequency, and number of modifications; Determine the upload sequence of each local file according to the priority weight of the local file; Synchronize each local file with the corresponding remote file according to the upload sequence.

7. A data synchronization device, characterized in that, Includes: An information acquisition module, configured to acquire the file information of each remote file, where the file information is file description information including version information and the file information does not include the file content of the corresponding remote file; An information update module, configured to update the file information of each local file according to the matching result between the file information of each remote file and the file information of each local file stored locally, to obtain each updated file, where the updated file includes the file information of the remote file and the file content of the local file; A file acquisition module, configured to acquire the to-be-uploaded files in the to-be-uploaded state from each updated file; A description information generation module, configured to generate and replace the description information of the to-be-uploaded file according to the file content of the to-be-uploaded file; A file upload module, configured to send the to-be-uploaded file to the server so that the server performs data synchronization according to the to-be-uploaded file; A message acquisition module, configured to display each updated file and acquire a to-be-synchronized file selection message, where the to-be-synchronized file selection message includes the to-be-synchronized file determined from each updated file; A file synchronization module, configured to synchronize the file content of the to-be-synchronized file with the file content of the remote file according to the version information of the to-be-synchronized file.

8. An electronic device, characterized in that, Includes: A processor; A memory, configured to store the executable instructions of the processor; Wherein, the processor is configured to execute the data synchronization method according to any one of claims 1 to 6 by executing the executable instructions.

9. A computer-readable medium having a computer program stored thereon, characterized in that, When the computer program is executed by the processor, it implements the data synchronization method according to any one of claims 1 to 6.

Citation Information

Patent Citations

  • File synchronization method, client, server side and equipment

    CN103327123A

  • Version history management

    US20180189369A1