WO2015157904A1 - 一种文件同步方法、服务器及终端 - Google Patents
一种文件同步方法、服务器及终端 Download PDFInfo
- Publication number
- WO2015157904A1 WO2015157904A1 PCT/CN2014/075349 CN2014075349W WO2015157904A1 WO 2015157904 A1 WO2015157904 A1 WO 2015157904A1 CN 2014075349 W CN2014075349 W CN 2014075349W WO 2015157904 A1 WO2015157904 A1 WO 2015157904A1
- Authority
- WO
- WIPO (PCT)
- Prior art keywords
- file
- terminal
- record data
- record
- version number
- Prior art date
Links
- 238000000034 method Methods 0.000 title claims abstract description 47
- 230000004044 response Effects 0.000 claims abstract description 16
- 230000001360 synchronised effect Effects 0.000 claims description 135
- 238000012217 deletion Methods 0.000 claims description 6
- 230000037430 deletion Effects 0.000 claims description 6
- 238000010586 diagram Methods 0.000 description 12
- 230000005540 biological transmission Effects 0.000 description 8
- 230000003993 interaction Effects 0.000 description 5
- 230000009471 action Effects 0.000 description 4
- 238000013523 data management Methods 0.000 description 4
- 238000004364 calculation method Methods 0.000 description 3
- 238000005516 engineering process Methods 0.000 description 3
- 238000012986 modification Methods 0.000 description 3
- 230000004048 modification Effects 0.000 description 3
- 230000008859 change Effects 0.000 description 2
- 238000004904 shortening Methods 0.000 description 2
- 230000006872 improvement Effects 0.000 description 1
- 230000009467 reduction Effects 0.000 description 1
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/10—File systems; File servers
- G06F16/17—Details of further file system functions
- G06F16/178—Techniques for file synchronisation in file systems
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L67/00—Network arrangements or protocols for supporting network services or applications
- H04L67/01—Protocols
- H04L67/10—Protocols in which an application is distributed across nodes in the network
- H04L67/1095—Replication or mirroring of data, e.g. scheduling or transport for data synchronisation between network nodes
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L65/00—Network arrangements, protocols or services for supporting real-time applications in data packet communication
- H04L65/40—Support for services or applications
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L67/00—Network arrangements or protocols for supporting network services or applications
- H04L67/01—Protocols
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L67/00—Network arrangements or protocols for supporting network services or applications
- H04L67/01—Protocols
- H04L67/06—Protocols specially adapted for file transfer, e.g. file transfer protocol [FTP]
Definitions
- the present application relates to the field of data synchronization technologies, and in particular, to a file synchronization method, a server, and a terminal.
- file data synchronization usually adopts two methods. One way is: the terminal queries the server side for the directory structure of the file data, compares the directory structure of the file data saved by the terminal and the server end, and updates the terminal according to the difference between the two directory structures.
- the file data is as follows: the terminal downloads the directory structure of the file data saved by the server, and the terminal compares the directory structure of the file data saved by the terminal with the server, and updates the file data on the terminal according to the difference of the directory structure of the two parties.
- each time the terminal synchronizes the file data it needs to perform multiple interactions with the server side, traverse each layer directory, sub-directory and sub-file of the file data saved by the server, and then save the file data with the terminal.
- the directory structure is compared, so synchronization takes a long time.
- the terminal downloads the directory structure of the file data saved by the server to the local.
- the download directory structure not only increases the bandwidth pressure, but also consumes a long time. , affecting the efficiency of synchronization. Summary of the invention
- the application provides a file synchronization method, a server and a terminal, which can improve the synchronization efficiency of file data, and reduce network resource consumption and bandwidth pressure when synchronizing file data.
- the first aspect of the present application provides a file synchronization method, including:
- the file synchronization request includes a version number of the file that is last synchronized by the terminal and a highest version number of the current synchronization
- the first record data includes all operation records generated by the predetermined version of the file after the terminal last synchronizes the file, wherein the version number of the predetermined version is higher than the last time the terminal synchronizes the file.
- the version number which is lower than or equal to the highest version number of this synchronization.
- the file synchronization request includes a version number and a quantity threshold of the file that the terminal most recently synchronizes
- the first record data includes a predetermined number of operation records sequentially generated by the predetermined version of the file after the terminal last synchronizes the file, wherein a version number of the predetermined version is higher than a last synchronization of the terminal
- the version number of the file, the predetermined number of values being equal to the number threshold.
- the method further includes :
- the deletion is received in the version data of the file saved by the server.
- the previously generated operational record of the file synchronization request is received in the version data of the file saved by the server.
- a second aspect of the present application provides a file synchronization method, including:
- Finding second record data the second record data including an operation record performed by the terminal on the file after the file was last synchronized
- the first Recording data includes an operation record generated by the file of a predetermined version in each version data of the file saved by the server after the terminal last synchronizes the file;
- the searching for the second record data includes:
- the second record data is obtained by splitting or merging each of the operation records according to the operation path.
- the first record data includes at least one operation record
- a third aspect of the present application provides a server, including:
- a first receiving module configured to receive a file synchronization request sent by the terminal
- a searching module configured to search for first record data from each version data of the file saved by the server, in response to the file synchronization request, where the first record data includes a predetermined version of the file at the terminal last time An operation record generated after synchronizing the files;
- a sending module configured to send the first record data to the terminal, so that the terminal obtains an operation that the terminal should perform according to the first record data and the second record data on the terminal, where The second record data includes an operation record performed by the terminal on the file after the file was last synchronized.
- the file synchronization request includes a version number of the file that the terminal last synchronizes and a highest version number of the current synchronization
- the first record data includes all operation records generated by the predetermined version of the file after the terminal last synchronizes the file, wherein the version number of the predetermined version is higher than the last time the terminal synchronizes the file.
- the version number which is lower than or equal to the highest version number of this synchronization.
- the file synchronization request includes a version number and a quantity threshold of the file that the terminal most recently synchronizes
- the first record data includes a predetermined number of operation records sequentially generated by the predetermined version of the file after the terminal last synchronizes the file, wherein a version number of the predetermined version is higher than a last synchronization of the terminal
- the version number of the file, the predetermined number of values being equal to the number threshold.
- the server further includes:
- a second receiving module configured to receive identifier information of the terminal sent by the terminal, a version number of the file that the terminal synchronizes with the current time, and a user identifier of the terminal;
- An update module configured to update a synchronization record of the user to the terminal according to the identifier information of the terminal, the version number of the file that the terminal synchronizes with the current time, and the user identifier of the terminal;
- the version deletion module that synchronizes the last time the other terminal of the user synchronizes the file, and is used to synchronize the version of the file with the latest version of the file whose version number is lower than the other terminal of the user.
- a fourth aspect of the present application provides a computer storage medium storing a program, which comprises all or part of the steps of the file synchronization method provided by the first aspect of the present application when the program is executed.
- a fifth aspect of the present application provides a server, including: an input device, an output device, and a processor, The input device, the output device, and the processor are connected by a bus, wherein: the input device is configured to receive a file synchronization request sent by the terminal;
- the processor in response to the file synchronization request, searching for first record data from each version data of the file saved by the server, where the first record data includes a predetermined version of the file being recently synchronized at the terminal An operation record generated after the file;
- the output device is configured to send the first record data to the terminal, so that the terminal obtains an operation that the terminal should perform according to the first record data and the second record data on the terminal,
- the second record data includes an operation record performed by the terminal on the file after the file was last synchronized.
- the file synchronization request includes a version number of the file that the terminal last synchronizes and a highest version number of the current synchronization
- the first record data includes all operation records generated by the predetermined version of the file after the terminal last synchronizes the file, wherein the version number of the predetermined version is higher than the last time the terminal synchronizes the file.
- the version number which is lower than or equal to the highest version number of this synchronization.
- the file synchronization request includes a version number and a quantity threshold of the file that the terminal most recently synchronizes
- the first record data includes a predetermined number of operation records sequentially generated by the predetermined version of the file after the terminal last synchronizes the file, wherein a version number of the predetermined version is higher than a last synchronization of the terminal
- the version number of the file, the predetermined number of values being equal to the number threshold.
- the input device is further configured to receive the identifier information of the terminal sent by the terminal And the terminal synchronizes the version number of the file and the user identifier of the terminal; the processor is further configured to:
- a sixth aspect of the present application provides a terminal, including:
- a first sending module configured to send a file synchronization request to the server
- a search module configured to search for second record data, where the second record data includes an operation record performed by the terminal on the file after the file is last synchronized;
- a receiving module configured to receive first record data sent by the server in response to the file synchronization request, where the first record data includes a file of a predetermined version of each version data of the file saved by the server An operation record generated after the terminal synchronizes the file last time; an execution module, configured to obtain an operation that the terminal should perform according to the first record data and the second record data, and perform the operation.
- the searching module includes: a searching unit, configured to search for each operation record performed by the terminal on the file after the file is last synchronized;
- a first simplification unit configured to split or merge the operation records according to the operation path to obtain the second record data.
- the first record data includes at least one operation record
- the execution module includes:
- a second simplification unit configured to split or merge the at least one operation record according to an operation path, to simplify the first record data
- an execution unit configured to obtain an operation that the terminal should perform according to the simplified first record data and the second record data, and perform the operation.
- the terminal further includes:
- a recording module configured to record a highest version number of the file in the first record data as a version number of the file that the terminal synchronizes this time
- a second sending module configured to send the identifier information of the terminal, the version number of the file that the terminal synchronizes with the current time, and the user identifier of the terminal to the server, so that the server updates the user pair Synchronous recording of the terminal.
- a seventh aspect of the present application provides a computer storage medium, where the computer storage medium stores a program, and when the program is executed, all or part of the file synchronization method provided by the second aspect of the present application is included. Step.
- An eighth aspect of the present application provides a terminal, including: an input device, an output device, and a processor, wherein the input device, the output device, and the processor are connected by a bus, where:
- the output device is configured to send a file synchronization request to the server
- the input device is configured to receive first record data sent by the server in response to the file synchronization request, where the first record data includes the predetermined version of each version data of the file saved by the server An operation record generated after the file is last synchronized by the terminal; the processor is configured to:
- Finding second record data the second record data including an operation record performed by the terminal on the file after the most recent synchronization of the file
- the second record data is obtained by splitting or merging each of the operation records according to the operation path.
- the first record data includes at least one operation record
- the processor obtains, according to the first record data and the second record data, an operation that the terminal should perform, and performs the operation, the specific steps are:
- the processor is further configured to record a highest version number of the file in the first record data as a version number of the file that the terminal synchronizes at a time;
- the output device is further configured to send identifier information of the terminal, and the terminal synchronizes the current time. A version number of the file, and a user identifier of the terminal to the server, to cause the server to update the user's synchronized record of the terminal.
- the server after receiving the file synchronization request sent by the terminal, the server searches for the operation record generated by the file after the last synchronization of the file from the saved version data of the file, and sends the operation record to the terminal, without
- the terminal performs multiple interactions, and the operation records of the file are smaller than the entire directory structure of the file, which not only saves time but also reduces user network resource consumption.
- the terminal can combine the operation record sent by the server and the operation record performed by the terminal itself on the file after the file is last synchronized, determine the operation to be performed, and do not need to traverse the file directory on the server layer by layer and compare with the file directory of the terminal. Therefore, the synchronization time can be effectively reduced, and the synchronization efficiency is improved.
- FIG. 1 is a schematic flow chart of an embodiment of a file synchronization method provided by the present application.
- FIG. 2 is a schematic flowchart of another embodiment of a file synchronization method provided by the present application
- FIG. 3 is a schematic flowchart of another embodiment of a file synchronization method provided by the present application
- FIG. 4 is an embodiment of a server provided by the present application. Schematic diagram of the structure
- FIG. 5 is a schematic structural diagram of another embodiment of a server provided by the present application.
- FIG. 6 is a schematic structural diagram of still another embodiment of a server provided by the present application.
- FIG. 7 is a schematic structural diagram of an embodiment of a terminal provided by the present application.
- FIG. 8 is a schematic structural diagram of another embodiment of a terminal provided by the present application.
- FIG. 9 is a schematic structural diagram of still another embodiment of a terminal provided by the present application. detailed description
- the present application provides a file synchronization method, a server, and a terminal, which can reduce synchronization time, improve synchronization efficiency, and reduce network resource consumption.
- FIG. 1 is a schematic flowchart diagram of an embodiment of a file synchronization method provided by the present application.
- the file synchronization method shown in FIG. 1 may be specifically implemented by a server.
- the file synchronization method may include the following steps:
- Step S101 Receive a file synchronization request sent by the terminal.
- the server receives a file synchronization request sent by the terminal, where the file synchronization request may indicate a file to be synchronized by the terminal, a time when the terminal synchronizes the file last time, a version number of the file that the terminal last synchronized, and / or the terminal synchronizes the file this time with the data provided by the server (including directory structure and / or operation records, etc.)
- Step S102 in response to the file synchronization request, searching for first record data from each version data of the file saved by the server, where the first record data includes a predetermined version of the file, the last synchronization of the file at the terminal The operation record generated after the file.
- the first record data is in each version data of the file sent by the other terminal or the data management application to the server, and after the terminal synchronizes the file last time, the predetermined version of the file is operated by various modifications, such as An operation record generated by inserting, adding, deleting, etc.
- the predetermined version described above is determined by a file synchronization request sent by the terminal.
- the file synchronization request may include the version number of the file that the terminal last synchronized and the highest version number of the current synchronization.
- the first record data includes all operation records generated by the predetermined version of the file after the terminal synchronizes the file last time, wherein the predetermined version is the version number of the latest synchronization of the file and the current version of the file. All versions between the highest version number (including the highest version number of this synchronization), specifically, the highest version number of this synchronization may be the highest version number of the current file, or any one that is more recent than the last one.
- the version number with a higher version number depends on the current network status of the terminal.
- the highest version number of the synchronization may be The highest version number of the current file; when the network resources of the terminal are scarce (such as when in the mobile network state), the highest version number of this synchronization may be higher than the version of the file that the terminal last synchronized. Number, and is lower than the current version number of the file. For example, the last time the terminal synchronizes the file with the version number is V1.0, the time is 2014-2-25, 9:00:00, and the highest version number of the file is V9.0 so far, but the terminal is in the mobile network.
- the highest version number of this synchronization may be V4.0, the above predetermined version is V2.0 to V4.0, and the first record data includes the file of V2.0 to V4.0 version. Operational records generated after 2014-2-25, 9:00:00.
- the file synchronization request may include the version number and the number threshold for which the terminal last synchronized the file.
- the first record data may include a predetermined number of operation records sequentially generated by the predetermined version of the file after the terminal has recently synchronized the file, wherein the version number of the predetermined version is higher than the version of the file that the terminal last synchronized. Number, the predetermined number of values is equal to the number threshold.
- the file data of the version number of the file that is last synchronized by the terminal is found in the version data of the file saved by the server, and then the time point at which the terminal last synchronized the file is Starting point, an operation record of a predetermined number (the predetermined number of values equal to the number threshold in the file synchronization request) is filtered out from the found file data in the order of the operation time from the first to the last, as the first record data.
- Step S103 Send the first record data to the terminal, so that the terminal obtains an operation that the terminal should perform according to the first record data and the second record data on the terminal, where the second The record data includes an operation record performed by the terminal on the file after the file was last synchronized.
- the first record data found in step S102 is composed of at least one operation record.
- the server may directly send the found at least one operation record to the terminal to slow down the computing pressure of the server.
- the at least one operation record may be split or merged according to the operation path. For example; 'MOVE A, fl to f2" can be split into “DELETE A, fl” and D ADD A, f2" "; ADD B, fl” ADD C, fl”" DELETE B, fl” can be merged into ADD C , fl'O
- the file synchronization method may further include:
- the deletion is generated from the version data of the file saved by the server before receiving the file synchronization request. Operational record.
- the synchronization record of the terminal to the terminal may include the identification information of the terminal, the user identifier of the terminal, the time and version number of synchronizing the file, and the like.
- the operation record generated by the server before the time point of the synchronization start may be deleted to reduce the redundancy of the server. Storage, slowing down storage pressure on the server.
- the server searches for the operation record generated by the file after the terminal last synchronizes the file from the saved version data of the file, and Sending to the terminal does not require multiple interactions with the terminal, and the operation records of the file are smaller than the entire directory structure of the file, and the transmission not only saves time, but also reduces the network resource consumption of the user.
- the terminal can combine the operation record sent by the server and the operation record performed by the terminal itself on the file after the file is last synchronized, determine the operation to be performed, and do not need to traverse the file directory on the server layer by layer and compare with the file directory of the terminal. Therefore, the synchronization time can be effectively reduced, and the synchronization efficiency is improved.
- FIG. 2 is a schematic flow chart of another embodiment of a file synchronization method provided by the present application.
- the file synchronization method shown in FIG. 2 may be specifically implemented by a terminal.
- the file synchronization method can include the following steps:
- the terminal sends a file synchronization request to the server, where the file synchronization request may indicate the file to be synchronized by the terminal, the time when the terminal last synchronized the file, the version number of the file that the terminal last synchronized, and/or this time. Synchronizing this file requires data provided by the server (including directory structure and / or operation records, etc.)
- the terminal may include two types: one is a terminal that can directly obtain an operation record of the file, and the terminal generally includes an input device and a processor, and can independently operate the file, such as a computer, a tablet, etc.
- the other is a terminal that cannot directly obtain the operation record of the file, such as a synchronous USB flash drive.
- the terminal also has a different implementation for finding the second recorded data.
- the step of searching for the second record data may include: first, searching for the file executed by the terminal after the file is last synchronized. Each operation record; then, the operation records are split or merged according to the operation path to obtain the second record data.
- splitting refers to splitting an operation record involving multiple paths into multiple basic operation records involving only one path, such as "MOVE A, fl to f2" can be split into “DELETE A, fl"Wo[J' ADD A, f2" 0
- merging refers to merging multiple operation records with the same operation path into a smaller number of operation records, such as " ADD B, fl", “ ADD C, fl” and “ DELETE B , fl” can be merged into "ADD C, fl'O split and merge operation, which can simplify the data needed for synchronization and eliminate redundant data, thus shortening the synchronization time and improving the synchronization efficiency.
- the step of searching for the second record data may include: first, the file that the terminal obtains and saves after the most recent synchronization of the file. Directory information; then, the directory information of the file obtained after the most recent synchronization of the file is compared with the directory information of the file currently stored locally by the terminal, and the terminal can be obtained after the last synchronization of the file.
- the operation record of the file execution including the added data and/or the deleted data, etc., which are the second record data.
- S203 Receive first record data sent by the server in response to the file synchronization request, where the first record data includes a predetermined version of each version data of the file saved by the server.
- the file is an operation record generated after the terminal last synchronized the file.
- the first record data also has several different situations.
- the file synchronization request may include the version number of the file that the terminal last synchronized and the highest version number of the current synchronization.
- the first record data includes all operation records generated by the predetermined version of the file after the terminal synchronizes the file last time, wherein the predetermined version is the version number of the latest synchronization of the file and the current version of the file. All versions between the highest version number (including the highest version number of this synchronization), specifically, the highest version number of this synchronization may be the highest version number of the current file, or any one that is more recent than the last one.
- the version number with a higher version number depends on the current network status of the terminal.
- the file synchronization request may include the version number and the number threshold for which the terminal last synchronized the file.
- the first record data may include a predetermined number of operation records sequentially generated by the predetermined version of the file after the terminal has recently synchronized the file, wherein the version number of the predetermined version is higher than the version of the file that the terminal last synchronized. Number, the predetermined number of values is equal to the number threshold.
- the synchronization terminal can be calculated.
- the operations that need to be performed such as the data to be added, the data to be deleted, and so on.
- the first record data sent by the server is a plurality of operation records that are directly processed by the server from the version data of the file and are not simplified, and according to the first record data and the first
- the operation of the second record data obtaining terminal may include the following steps: First, the plurality of operation records are split or merged according to the operation path to simplify the first record data.
- splitting refers to splitting an operation record involving multiple paths into multiple basic operation records involving only one path
- merging refers to merging operation records with the same operation path into a small number of operations.
- the example sister 'MOVE A, fl to f2" can be split into 'DELETE A, fl" and P" ADD A, f2"' ⁇ ; ADD B, fl""ADD C, fl"" DELETE B, "Can Merged into ADD C, fl'O
- the split merge operation simplifies the data required for synchronization and removes redundant data, thereby reducing synchronization time and improving synchronization efficiency.
- the operation records in the first record data and the second record data are all basic operation records related to only one operation path, and the operations to be performed by the terminal are obtained according to the first record data and the second record data, which may be specifically: Starting from the time point when the terminal last synchronized the file, the operation records with the same operation path in the first record data and the second record data are merged in the order of the operation time from the first to the last, according to the merged operation record.
- the operation that the terminal should perform can be obtained. For example, the operation record for the disk l ( fl ) is in turn?
- the file synchronization method may further include:
- the synchronization record of the terminal to the terminal may include the identification information of the terminal, the user identifier of the terminal, the time and version number of synchronizing the file, and the like.
- the terminal sends a file synchronization request to the server, then searches for the second record data, and receives the first record data sent by the server, without having to interact with the server multiple times, and does not need to traverse the server layer by layer.
- the file directory on the file record, and the first record data is composed of the operation record generated by the file after the terminal last synchronized the file, and the amount of data is small compared with the entire directory structure of the file, which not only saves time but also reduces time during transmission. User's network resource consumption.
- the second record data is an operation record performed by the terminal on the file after the file is last synchronized. The terminal may split the first record data and combine the second record data to obtain an operation that the terminal should perform, not only Reduce redundant data and the amount of calculations during synchronization, alleviate the computing pressure of the terminal, and improve synchronization efficiency.
- FIG. 3 is a schematic flowchart diagram of still another embodiment of a file synchronization method provided by the present application.
- the file synchronization method shown in FIG. 3 may be implemented by an interaction between a server and a terminal.
- Figure 3 As shown, the file synchronization method can include the following steps:
- the terminal sends a file synchronization request to the server.
- the terminal sends a file synchronization request to the server, where the file synchronization request may indicate the file to be synchronized by the terminal, the time when the terminal last synchronized the file, the version number of the file that the terminal last synchronized, and/or this time. Synchronizing this file requires data provided by the server (including directory structure and / or operation records, etc.)
- the terminal searches for the second record data.
- the second record data includes an operation record performed by the terminal on the file after the file was last synchronized.
- the terminal may include two types: one is a terminal that can directly obtain an operation record of the file, and the terminal generally includes an input device and a processor, and can independently operate the file, such as a computer, a tablet, etc.; A terminal that cannot directly obtain an operation record of a file, such as a synchronous USB flash drive.
- the terminal also has a different implementation for finding the second recorded data.
- the step of searching for the second record data may include: first, searching for the file after the last time the file is last synchronized. Each operation record is executed; then, the operation records are split or merged according to the operation path to obtain the second record data.
- the step of searching for the second record data may include: first, the file that the terminal obtains and saves after the most recent synchronization of the file. Directory information; then, the directory information of the file obtained after the most recent synchronization of the file is compared with the directory information of the file currently stored locally by the terminal, and the terminal can be obtained after the file is last synchronized.
- the operation record of the execution including the added data and/or the deleted data, etc., which are the second record data.
- Step S303 the server searches for the first record data.
- the first record data is in each version data of the file sent by the other terminal or the data management application to the server, and after the terminal synchronizes the file last time, the predetermined version of the file is operated by various modifications, such as An operation record generated by inserting, adding, deleting, etc.
- the predetermined version described above is determined by a file synchronization request sent by the terminal.
- the file synchronization request may include the terminal synchronizing the file last time.
- the first record data includes all operation records generated by the predetermined version of the file after the terminal synchronizes the file last time, wherein the predetermined version is the version number of the latest synchronization of the file and the current version of the file. All versions between the highest version number (including the highest version number of this synchronization), specifically, the highest version number of this synchronization may be the highest version number of the current file, or any one that is more recent than the last one.
- the version number with a higher version number depends on the current network status of the terminal.
- the file synchronization request may include the version number and the number threshold for which the terminal last synchronized the file.
- the first record data may include a predetermined number of operation records sequentially generated by the predetermined version of the file after the terminal has recently synchronized the file, wherein the version number of the predetermined version is higher than the version of the file that the terminal last synchronized. Number, the predetermined number of values is equal to the number threshold.
- the file data of the version number of the file that is last synchronized by the terminal is found in the version data of the file saved by the server, and then the time point at which the terminal last synchronized the file is Starting point, an operation record of a predetermined number (the predetermined number of values equal to the number threshold in the file synchronization request) is filtered out from the found file data in the order of the operation time from the first to the last, as the first record data.
- Step S304 the server sends the first record data to the terminal.
- the first record data includes at least one operation record.
- the server may directly send the found at least one operation record to the terminal to slow down. The computing pressure of the server.
- the at least one operation record may be split or merged according to the operation path.
- Step S305 the terminal determines an operation that should be performed.
- the terminal combines the first record data and the second record data to calculate operations that need to be performed in the current synchronization, such as data to be added, data to be deleted, and the like.
- the first record data is a plurality of operation records that are not directly processed by the server and are directly processed from the version data of the file.
- the operations that the terminal should perform include the following steps:
- splitting refers to splitting an operation record involving multiple paths into multiple basic operation records involving only one path
- merging refers to merging operation records with the same operation path into a small number of operations. recording.
- the operation records in the first record data and the second record data are all basic operation records related to only one operation path, and the operations to be performed by the terminal are obtained according to the first record data and the second record data, which may be specifically: Starting from the time point when the terminal last synchronized the file, the operation records with the same operation path in the first record data and the second record data are merged in the order of the operation time from the first to the last, according to the merged operation record. The operation that the terminal should perform can be obtained.
- Step S306 the terminal performs the above-mentioned operations to be performed.
- Step S307 The terminal records the version number of the file that is synchronized this time, specifically, records the highest version number of the file in the first record data as the version number of the file that the terminal synchronizes this time.
- Step S308 The terminal sends the identifier information of the terminal, the version number of the file that the terminal synchronizes this time, and the user identifier of the terminal to the server.
- Step S309 the server updates the synchronization record of the user to the terminal according to the identification information of the terminal, the version number of the file that the terminal synchronizes with the current time, and the user identifier of the terminal.
- the synchronization record of the terminal to the terminal may include the identifier information of the terminal, the user identifier of the terminal, the synchronization time, the version number of the synchronization, and the like.
- Step S310 the server queries the other terminal of the user to synchronize the version number of the file.
- step S311 the server deletes the redundant operation record. Specifically, if the version number of the file synchronized by the terminal is lower than the version number of the file that is last synchronized by the other terminal of the user, the file synchronization is deleted from the version data of the file saved by the server. Request the operation records generated before, to reduce the redundant storage of the server and slow down the storage pressure of the server.
- the server and the terminal do not need to perform multiple interactions, and there is no need to traverse the file directory on the server layer by layer, which can reduce the time consumption of synchronization; the terminal simplifies the operation record and then synchronizes, which can be reduced. Redundant data further reduces the time-consuming synchronization and improves synchronization efficiency.
- the present application also provides servers and terminals that can be used to implement embodiments of the methods of the present application.
- Apparatus Embodiments The structural components of the server and the terminal of the present application are exemplified below with reference to the accompanying drawings.
- FIG. 4 is a schematic structural diagram of an embodiment of a server provided by the present application.
- the server may include: a first receiving module 401, a searching module 402, and a sending module 403.
- the server may further include a second receiving module 404, an update module 405, and a query.
- the first receiving module 401 is configured to receive a file synchronization request sent by the terminal.
- the searching module 402 is configured to: in response to the file synchronization request, search for first record data from each version data of the file saved by the server, where the first record data includes a predetermined version of the file at the terminal last time An operation record generated after the file is synchronized.
- a sending module 403 configured to send the first record data to the terminal, so that the terminal obtains an operation that the terminal should perform according to the first record data and the second record data on the terminal, where
- the second record data includes an operation record performed by the terminal on the file after the file was last synchronized.
- the server receives a file synchronization request sent by the terminal, where the file synchronization request may indicate a file to be synchronized by the terminal, a time when the terminal synchronizes the file last time, a version number of the file that the terminal last synchronized, and / or the terminal synchronizes the file this time with the data provided by the server (including directory structure and / or operation records, etc.)
- the first record data is in each version data of the file sent by the other terminal or the data management application to the server, and after the terminal synchronizes the file last time, the predetermined version of the file is operated by various modifications, such as An operation record generated by inserting, adding, deleting, etc.
- the predetermined version described above is determined by a file synchronization request sent by the terminal.
- the file synchronization request may include the version number of the file that the terminal last synchronized and the highest version number of the current synchronization.
- the first record data includes all operation records generated by the predetermined version of the file after the terminal synchronizes the file last time, wherein the predetermined version is the version number of the latest synchronization of the file and the current version of the file. All versions between the highest version number (including the highest version number of this synchronization), specifically, the highest version number of this synchronization may be the highest version number of the current file, or any one that is more recent than the last one. Version The higher version number depends on the current network status of the terminal.
- the highest version number of this synchronization may be current.
- the highest version number of the file when the network resources of the terminal are scarce (such as when in the mobile network state), the highest version number of this synchronization may be higher than the version number of the file that the terminal last synchronized, and is lower than the current file.
- the highest version number when the network resources of the terminal are sufficient (such as when it is in a broadband network connection or a wireless network connection state), the highest version number of this synchronization may be current.
- the highest version number of the file when the network resources of the terminal are scarce (such as when in the mobile network state), the highest version number of this synchronization may be higher than the version number of the file that the terminal last synchronized, and is lower than the current file.
- the highest version number when the network resources of the terminal are sufficient (such as when it is in a broadband network connection or a wireless network connection state), the highest version number of this synchronization may be current.
- the highest version number of the file when the network resources of the terminal are scarce (
- the file synchronization request may include the version number and the number threshold for which the terminal last synchronized the file.
- the first record data may include a predetermined number of operation records sequentially generated by the predetermined version of the file after the terminal has recently synchronized the file, and the version number of the predetermined version is higher than the version number of the file that the terminal last synchronized.
- the predetermined number of values is equal to the number threshold.
- the searching module 402 may first search for the file data whose version number is higher than the version number of the last synchronization of the file from the version data of the file saved by the server, and then synchronize the file with the last time the terminal synchronizes the file.
- the time point is a starting point, and an operation record of a predetermined number (the predetermined number of values is equal to a quantity threshold in the file synchronization request) is filtered out from the searched file data in order from the first to the last, as the first record data. .
- the first record data found by the lookup module 402 is composed of at least one operation record.
- the sending module 403 can directly send the found at least one operation record to the terminal to slow down the computing pressure of the server.
- the at least one operation record may be split according to the operation path or merge. For example: 'MOVE A, fl to f2" can be split into “DELETE A, fl” and "ADD A, f2" ' ADD B, fl", “ ADD C, fl” " DELETE B, fl” can be merged into " ADD C, fl”.
- the at least one operation record may be converted into an ADD or DELETE two basic operation records involving only one path; and the basic operation records obtained by combining the splits according to the operation path may be used to remove the redundancy Data, visually presenting the final change of the file caused by the first recorded data, thereby reducing network resource consumption and data transmission time
- the server may further include at least one of a second receiving module 404, an updating module 405, a querying module 406, and a deleting module 407, where:
- the second receiving module 404 is configured to receive the identifier information of the terminal that is sent by the terminal, the version number of the file that the terminal synchronizes with the current time, and the user identifier of the terminal.
- the update module 405 is configured to update the synchronization record of the user to the terminal according to the identifier information of the terminal, the version number of the file that the terminal synchronizes with the terminal, and the user identifier of the terminal.
- the query module 406 is configured to query the version number of the file that the other terminal of the user last synchronizes.
- the deleting module 407 is configured to delete, in the version data of the file saved by the server, when the version number of the file that is synchronized by the terminal is lower than the version number of the file that is last synchronized by the other terminal of the user The operation record generated before receiving the file synchronization request.
- the synchronization record of the terminal to the terminal may include the identification information of the terminal, the user identifier of the terminal, the time and version number of synchronizing the file, and the like.
- the operation record generated by the server before the time point of the synchronization start may be deleted to reduce the redundancy of the server. Storage, slowing down storage pressure on the server.
- the searching module searches for the version data of the file saved by the server, and searches for the file after the terminal last synchronizes the file.
- the terminal can combine the operation record sent by the server and the operation record performed by the terminal itself on the file after the file is last synchronized, and obtain the operation to be performed without traversing the file directory on the server layer by layer and comparing with the file directory of the terminal. Therefore, the synchronization time can be effectively reduced, and the synchronization efficiency is improved.
- FIG. 6 is a schematic structural diagram of still another embodiment of a server provided by the present application.
- the server may include an input device 601, an output device 602, and a processor 603.
- the input device 601 and the processor 603, the output device 602, and the processor 603 may be connected by a bus or other means, wherein the bus connection is taken as an example in FIG.
- the input device 601 is configured to receive a file synchronization request sent by the terminal.
- a processor 603 configured to respond to the file synchronization request, each of the files saved from a server
- the first record data is searched for in the version data, the first record data including an operation record generated by the predetermined version of the file after the terminal last synchronized the file.
- the output device 602 is configured to send the first record data to the terminal, so that the terminal obtains an operation that the terminal should perform according to the first record data and the second record data on the terminal, where
- the second record data includes an operation record performed by the terminal on the file after the file was last synchronized.
- the file synchronization request includes a version number of the file that is last synchronized by the terminal and a highest version number of the current synchronization; at this time, the first record data includes a predetermined version of the file that is most recently synchronized in the terminal. All operation records generated after the file, wherein the version number of the predetermined version is higher than the version number of the file that the terminal last synchronized, and is lower than or equal to the highest version number of the current synchronization.
- the file synchronization request includes a version number and a quantity threshold of the last synchronization of the file by the terminal; at this time, the first record data includes the predetermined version of the file, and the file is sequentially after the terminal synchronizes the file.
- a predetermined number of operational records are generated, wherein the version number of the predetermined version is higher than a version number of the file that the terminal most recently synchronized, the predetermined number of values being equal to the number threshold.
- the first record data includes at least one operation record.
- the at least one operation record may be split according to the operation path. After the merge, it is sent to the terminal.
- the input device 601 is further configured to receive the identification information of the terminal sent by the terminal, the version number of the file that the terminal synchronizes the current time, and the user identifier of the terminal.
- the processor 603 is also used to:
- the version data of the file saved by the server is deleted from the version data of the file that was generated before the file synchronization request is received. Operational record.
- the server does not need to interact with the terminal multiple times, and there is no need to layer by layer. Traversing the file directory on the server and comparing it with the file directory of the terminal. In addition, compared with the entire directory structure of the file, the amount of operation record data generated after the terminal synchronizes the file last time is small, and the data transmission is not shortened during synchronization. Time can also reduce the user's network resource consumption, thereby improving synchronization efficiency.
- FIG. 7 is a schematic structural diagram of an embodiment of a terminal provided by the present application.
- the terminal may include: a first sending module 701, a searching module 702, a receiving module 703, and an executing module 704, where:
- the first sending module 701 is configured to send a file synchronization request to the server.
- the search module 702 is configured to search for second record data, the second record data including an operation record performed by the terminal on the file after the file is most recently synchronized.
- the receiving module 703 is configured to receive first record data that is sent by the server in response to the file synchronization request, where the first record data includes the file of a predetermined version in each version data of the file saved by the server. An operation record generated after the terminal has recently synchronized the file.
- the executing module 704 is configured to obtain an operation that the terminal should perform according to the first record data and the second record data, and perform the operation.
- the terminal sends a file synchronization request to the server, where the file synchronization request may indicate the file to be synchronized by the terminal, the time when the terminal last synchronized the file, the version number of the file that the terminal last synchronized, and/or this time. Synchronizing this file requires data provided by the server (including directory structure and / or operation records, etc.)
- the terminal may include two types: one is a terminal that can directly obtain an operation record of the file, and the terminal generally includes an input device and a processor, and can independently operate the file, such as a computer, a tablet, etc.
- the other is a terminal that cannot directly obtain the operation record of the file, such as a synchronous USB flash drive.
- the lookup module 702 looks for the second record data and also has a different implementation.
- the searching module 702 can further include the following units (not shown):
- the operation records are split or merged according to the operation path to obtain the second record data.
- splitting refers to splitting an operation record involving multiple paths into multiple basic operation records involving only one path, such as "MOVE A, fl to f2" can be split into “DELETE A, fl"Wo[J' ADD A, f2" 0
- merging refers to merging multiple operation records with the same operation path into a smaller number of operation records, such as " ADD B, fl", “ ADD C, fl” and “ DELETE B , fl” can be merged into "ADD C, fl'O split and merge operation, which can simplify the data needed for synchronization and eliminate redundant data, thus shortening the synchronization time and improving the synchronization efficiency.
- the step of the searching module 702 searching for the second record data may include: first, the read terminal obtains and saves after the file is last synchronized. The directory information of the file; then, comparing the directory information of the file obtained after the most recent synchronization of the file with the directory information of the file currently stored locally by the terminal, the terminal can be synchronized recently.
- the operation record performed on the file, including the added data and/or the deleted data, etc., is the second record data.
- the first recorded data also has several different situations.
- the file synchronization request may include the version number of the file that the terminal last synchronized and the highest version number of the current synchronization.
- the first record data includes all operation records generated by the predetermined version of the file after the terminal last synchronizes the file, wherein the predetermined version is the version number of the last synchronization file of the terminal and the current synchronization. All versions between the highest version number (including the highest version number of this synchronization), specifically, the highest version number of this synchronization can be the highest version number of the current file, or any version that is more recent than the latest one. The higher version number depends on the current network status of the terminal.
- the file synchronization request may include the version number and the number threshold for which the terminal last synchronized the file.
- the first record data may include a predetermined number of operation records sequentially generated by the predetermined version of the file, wherein the version number of the predetermined version is higher than the version number of the file that the terminal last synchronized, the predetermined number of values. Equal to the number threshold.
- the execution module 704 can calculate the current Synchronize the actions that need to be performed, such as the number to be added According to the data that needs to be deleted.
- the first record data sent by the server is a plurality of operation records that are not directly processed by the server and are directly processed from the version data of the file.
- the execution module 704 may include the following units. (not shown):
- splitting refers to splitting an operation record involving multiple paths into multiple basic operation records involving only one path
- merging refers to merging operation records with the same operation path into a small number of operations. recording.
- the split merge operation simplifies the data required for synchronization and removes redundant data, thereby reducing synchronization time and improving synchronization efficiency.
- an execution unit configured to obtain an operation that the terminal should perform according to the simplified first record data and the second record data, and perform the operation.
- the operation records in the first record data and the second record data are all basic operation records related to only one operation path, and the operations to be performed by the terminal are obtained according to the first record data and the second record data, which may be specifically: Taking the time point when the terminal last synchronizes the file as a starting point, the operation records with the same operation path in the first record data and the second record data are merged in order from the first to the last according to the operation time, according to the merged operation record. You can get the operation that the terminal should perform.
- the operation record of the disk 1 ( fl ) is ' ADD A, fl ”, “ ADD B, fl”, “ ADD C, fl” and “ DELETE B, fl”.
- the above four operation records can be When merged into "ADD AB, fl", the terminal should perform the operation of adding " ⁇ " to disk 1.
- the terminal may further include at least one of a recording module 705 and a second sending module 706, where:
- a recording module 705, configured to: after the execution module 704 obtains an operation that the terminal should perform and perform the operation, record a highest version number of the file in the first record data as a version of the file that the terminal synchronizes at the current time number.
- the second sending module 706 is configured to send the identifier information of the terminal, the version number of the file that the terminal synchronizes the current time, and the user identifier of the terminal to the server, so that the server updates the user. Synchronous recording of the terminal.
- the synchronization record of the terminal to the terminal may include the identifier information of the terminal, the user identifier of the terminal, the time and version number of synchronizing the file, and the like.
- the first sending module sends a file synchronization request to the server;
- the searching module searches the operation record that the terminal has performed on the file after the file is last synchronized, as The second record data;
- the receiving module receives the first record data sent by the server, the terminal does not need to interact with the server multiple times, and does not need to traverse the file directory on the server layer by layer, and the first record data is composed of some operation records, and the file Compared with the entire directory structure, the amount of data is small, and the transmission not only saves time, but also reduces the user's network resource consumption.
- the execution module may first split and merge the first record data before obtaining the operation that the terminal should perform according to the first record data and the second record data, so as to reduce redundant data and calculation amount during synchronization, and alleviate terminal calculation. Pressure while improving synchronization efficiency.
- FIG. 9 is a schematic structural diagram of still another embodiment of a terminal provided by the present application.
- the terminal may include an input device 901, an output device 902, and a processor 903.
- the input device 901 and the processor 903, the output device 902, and the processor 903 may be connected by a bus or other means, wherein the bus connection is taken as an example in FIG.
- the output device 902 is configured to send a file synchronization request to the server.
- the input device 901 is configured to receive first record data sent by the server in response to the file synchronization request, where the first record data includes the file of a predetermined version in each version data of the file saved by the server An operation record generated after the terminal has recently synchronized the file.
- the processor 903 is used to:
- Finding second record data the second record data including an operation record performed by the terminal on the file after the file is last synchronized
- the processor 903 searches for the second record data
- the specific steps are: searching for each operation record that the terminal performs on the file after the file is last synchronized;
- the second record data is obtained by splitting or merging each of the operation records according to the operation path.
- the first record data includes at least one operation record; the processor obtains an operation that the terminal should perform according to the first record data and the second record data, and executes the When describing the operation, the specific steps are:
- the processor 903 is further configured to record the highest version number of the file in the first record data as the version number of the file that the terminal synchronizes this time.
- the output device 902 is further configured to send the identifier information of the terminal, the version number of the file that the terminal synchronizes the current time, and the user identifier of the terminal to the server, so that the server updates the user The synchronous recording of the terminal.
- the terminal does not need to interact with the server multiple times, and there is no need to traverse the file directory on the server layer by layer and compare it with the file directory of the terminal, and in addition to the entire directory structure of the file, at the terminal.
- the amount of operation record data generated after the most recent synchronization of the file is small, and the synchronization not only shortens the data transmission time, but also reduces the user's network resource consumption, thereby improving the synchronization efficiency.
- the program may be stored in a computer readable storage medium, and the storage medium may include: Flash drive, read-only memory (Read-Only Memory, ROM random access memory, RAM disk or CD, etc.).
Landscapes
- Engineering & Computer Science (AREA)
- Computer Networks & Wireless Communication (AREA)
- Signal Processing (AREA)
- Theoretical Computer Science (AREA)
- Data Mining & Analysis (AREA)
- Databases & Information Systems (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Multimedia (AREA)
- Information Transfer Between Computers (AREA)
- Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
Abstract
本申请提供了一种文件同步方法、服务器及终端,其中方法包括:接收终端发送的文件同步请求;响应所述文件同步请求,从服务器保存的所述文件的各版本数据中查找第一记录数据,所述第一记录数据包括预定版本的所述文件在所述终端最近一次同步所述文件之后产生的操作记录;发送所述第一记录数据至所述终端,以使所述终端根据所述第一记录数据及所述终端上的第二记录数据得到所述终端应执行的操作,所述第二记录数据包括所述终端在最近一次同步所述文件之后对所述文件执行的操作记录。本申请可以缩短文件同步的时间,减少网络资源消耗、提高同步的效率。
Description
一种文件同步方法、 服务器及终端 技术领域
本申请涉及数据同步技术领域,尤其涉及一种文件同步方法、 服务器及终
背景技术
随着互联网技术的发展和信息化程度的提高,为了提高数据管理的便捷性 和安全性,终端用户可凭借数据同步技术,将一台终端上的文件数据同步备份 到其他终端,实现在不同终端上管理同一份文件数据。 目前,文件数据同步通 常采用两种方式,其中,方式一是:终端向服务器端查询文件数据的目录结构, 对比终端与服务器端各自保存的文件数据的目录结构,根据双方目录结构的差 异更新终端上的文件数据;方式二是:终端下载服务器端所保存的文件数据的 目录结构,终端对比其与服务器端各自保存的文件数据的目录结构,根据双方 目录结构的差异更新终端上的文件数据。
在方式一中,终端每次同步文件数据,都需要与服务器端进行多次交互, 遍历服务器端所保存的文件数据的每一层目录、 子目录及子文件,然后与终端 保存的文件数据的目录结构进行比较,因此同步时耗时较长。 在方式二中,终 端在同步前,要将服务器端保存的文件数据的目录结构下载到本地,当文件数 据的目录结构较大时,下载目录结构不仅会增加带宽压力,也会消耗较长时间, 影响同步的效率。 发明内容
本申请提供了一种文件同步方法、 服务器及终端,可提高文件数据的同步 效率,同时減少同步文件数据时的网络资源消耗和带宽压力。
本申请第一方面提供一种文件同步方法,包括:
接收终端发送的文件同步请求;
响应所述文件同步请求,从服务器保存的所述文件的各版本数据中查找第 一记录数据,所述第一记录数据包括预定版本的所述文件在所述终端最近一次 同步所述文件之后产生的操作记录;
发送所述第一记录数据至所述终端,以使所述终端根据所述第一记录数据 及所述终端上的第二记录数据得到所述终端应执行的操作,所述第二记录数据 包括所述终端在最近一次同步所述文件之后对所述文件执行的操作记录。
结合第一方面,在第一种可能的实现方式中,所述文件同步请求包括所述 终端最近一次同步所述文件的版本号以及本次同步的最高版本号;
所述第一记录数据包括预定版本的所述文件在所述终端最近一次同步所 述文件之后产生的全部操作记录,其中所述预定版本的版本号高于所述终端最 近一次同步所述文件的版本号,且低于或等于本次同步的最高版本号。
结合第一方面,在第二种可行的实施方式中,所述文件同步请求包括所述 终端最近一次同步所述文件的版本号以及数量阈值;
所述第一记录数据包括预定版本的所述文件在所述终端最近一次同步所 述文件之后依次产生的预定数量的操作记录,其中所述预定版本的版本号高于 所述终端最近一次同步所述文件的版本号,所述预定数量的值等于所述数量阈 值。
结合第一方面以及第一方面的第一和第二种可行的实施方式,在第三种可 行的实施方式中,所述发送所述第一记录数据至所述终端之后,所述方法还包 括:
接收所述终端发送的所述终端的标识信息、所述终端本次同步所述文件的 版本号、 以及所述终端的用户标识;
根据所述终端的标识信息、 所述终端本次同步所述文件的版本号、 以及所 述终端的用户标识,更新所述用户对所述终端的同步记录;
查询所述用户的其他终端最近一次同步所述文件的版本号;
若所述终端本次同步所述文件的版本号低于所述用户的其他终端最近一 次同步所述文件的版本号,则从所述服务器保存的所述文件的各版本数据中, 删除在接收所述文件同步请求的之前产生的操作记录。
本申请第二方面提供一种文件同步方法,包括:
发送文件同步请求至服务器;
查找第二记录数据,所述第二记录数据包括终端在最近一次同步所述文件 之后对所述文件执行的操作记录;
接收所述服务器响应所述文件同步请求而发送的第一记录数据,所述第一
记录数据包括所述服务器保存的所述文件的各版本数据中预定版本的所述文 件在所述终端最近一次同步所述文件之后产生的操作记录;
根据所述第一记录数据和所述第二记录数据得到所述终端应执行的操作, 并执行所述操作。
结合第二方面,在第一种可行的实施方式中,所述查找第二记录数据,包 括:
查找所述终端在最近一次同步所述文件之后对所述文件执行的每一条操 作记录;
按照操作路径拆分或合并所述每一条操作记录,得到所述第二记录数据。 结合第二方面,在第二种可行的实施方式中,所述第一记录数据包括至少 一条操作记录;
所述根据所述第一记录数据和所述第二记录数据得到所述终端应执行的 操作,并执行所述操作,包括:
按照操作路径拆分或合并所述至少一条操作记录,以简化所述第一记录数 据;
根据简化后的第一记录数据和所述第二记录数据,得到所述终端应执行的 操作,并执行所述操作。
结合第二方面以及第二方面的第一和第二种可行的实施方式,在第三种可 行的实施方式中,所述根据所述第一记录数据和所述第二记录数据得到所述终 端应执行的操作,并执行所述操作之后,所述方法还包括:
将所述第一记录数据中所述文件的最高版本号记录为所述终端本次同步 所述文件的版本号;
发送所述终端的标识信息、 所述终端本次同步所述文件的版本号、 以及所 述终端的用户标识至所述服务器,以使所述服务器更新所述用户对所述终端的 同步记录。
本申请第三方面提供一种服务器,包括:
第一接收模块,用于接收终端发送的文件同步请求;
查找模块,用于响应所述文件同步请求,从服务器保存的所述文件的各版 本数据中查找第一记录数据,,所述第一记录数据包括预定版本的所述文件在 所述终端最近一次同步所述文件之后产生的操作记录;
发送模块,用于发送所述第一记录数据至所述终端,以使所述终端根据所 述第一记录数据及所述终端上的第二记录数据得到所述终端应执行的操作,所 述第二记录数据包括所述终端在最近一次同步所述文件之后对所述文件执行 的操作记录。
结合第三方面,在第一种可行的实施方式中,所述文件同步请求包括所述 终端最近一次同步所述文件的版本号以及本次同步的最高版本号;
所述第一记录数据包括预定版本的所述文件在所述终端最近一次同步所 述文件之后产生的全部操作记录,其中所述预定版本的版本号高于所述终端最 近一次同步所述文件的版本号,且低于或等于本次同步的最高版本号。
结合第三方面,在第二种可行的实施方式中,所述文件同步请求包括所述 终端最近一次同步所述文件的版本号以及数量阈值;
所述第一记录数据包括预定版本的所述文件在所述终端最近一次同步所 述文件之后依次产生的预定数量的操作记录,其中所述预定版本的版本号高于 所述终端最近一次同步所述文件的版本号,所述预定数量的值等于所述数量阈 值。
结合第三方面以及第三方面的第一和第二种可行的实施方式,在第三种可 行的实施方式中,所述服务器还包括:
第二接收模块,用于接收所述终端发送的所述终端的标识信息、 所述终端 本次同步所述文件的版本号、 以及所述终端的用户标识;
更新模块,用于根据所述终端的标识信息、 所述终端本次同步所述文件的 版本号、 以及所述终端的用户标识,更新所述用户对所述终端的同步记录; 查询模块,用于查询所述用户的其他终端最近一次同步所述文件的版本 删除模块,用于在所述终端本次同步所述文件的版本号低于所述用户的其 他终端最近一次同步所述文件的版本号时,从所述服务器保存的所述文件的各 版本数据中删除在接收所述文件同步请求的之前产生的操作记录。
本申请第四方面提供一种计算机存储介质,所述计算机存储介质存储有程 序,执行所述程序时包括本申请第一方面提供的文件同步方法的全部或部分步 骤。
本申请第五方面提供一种服务器,包括:输入装置、 输出装置和处理器,
所述输入装置、 所述输出装置和所述处理器通过总线相连接,其中: 所述输入装置,用于接收终端发送的文件同步请求;
所述处理器,响应所述文件同步请求,从服务器保存的所述文件的各版本 数据中查找第一记录数据,所述第一记录数据包括预定版本的所述文件在所述 终端最近一次同步所述文件之后产生的操作记录;
所述输出装置,用于发送所述第一记录数据至所述终端,以使所述终端根 据所述第一记录数据及所述终端上的第二记录数据得到所述终端应执行的操 作,所述第二记录数据包括所述终端在最近一次同步所述文件之后对所述文件 执行的操作记录。
结合第五方面,在第一种可行的实施方式中,所述文件同步请求包括所述 终端最近一次同步所述文件的版本号以及本次同步的最高版本号;
所述第一记录数据包括预定版本的所述文件在所述终端最近一次同步所 述文件之后产生的全部操作记录,其中所述预定版本的版本号高于所述终端最 近一次同步所述文件的版本号,且低于或等于本次同步的最高版本号。
结合第五方面,在第二种可行的实施方式中,所述文件同步请求包括所述 终端最近一次同步所述文件的版本号以及数量阈值;
所述第一记录数据包括预定版本的所述文件在所述终端最近一次同步所 述文件之后依次产生的预定数量的操作记录,其中所述预定版本的版本号高于 所述终端最近一次同步所述文件的版本号,所述预定数量的值等于所述数量阈 值。
结合第五方面以及第五方面的第一和第二种可行的实施方式,在第三种可 行的实施方式中,所述输入装置,还用于接收所述终端发送的所述终端的标识 信息、 所述终端本次同步所述文件的版本号、 以及所述终端的用户标识; 所述处理器还用于:
根据所述终端的标识信息、 所述终端本次同步所述文件的版本号、 以及所 述终端的用户标识,更新所述用户对所述终端的同步记录;
查询所述用户的其他终端最近一次同步所述文件的版本号;
若所述终端本次同步所述文件的版本号低于所述用户的其他终端最近一 次同步所述文件的版本号,则从所述服务器保存的所述文件的各版本数据中, 删除在接收所述文件同步请求之前产生的操作记录。
本申请第六方面提供一种终端,包括:
第一发送模块,用于发送文件同步请求至服务器;
查找模块,用于查找第二记录数据,所述第二记录数据包括终端在最近一 次同步所述文件之后对所述文件执行的操作记录;
接收模块,用于接收所述服务器响应所述文件同步请求而发送的第一记录 数据,所述第一记录数据包括所述服务器保存的所述文件的各版本数据中预定 版本的所述文件在所述终端最近一次同步所述文件之后产生的操作记录; 执行模块,用于根据所述第一记录数据和所述第二记录数据得到所述终端 应执行的操作,并执行所述操作。
结合第六方面,在第一种可行的实施方式中,所述查找模块,包括: 查找单元,用于查找所述终端在最近一次同步所述文件之后对所述文件执 行的每一条操作记录;
第一简化单元,用于按照操作路径拆分或合并所述每一条操作记录,得到 所述第二记录数据。
结合第六方面,在第二种可行的实施方式中,所述第一记录数据包括至少 一条操作记录;
所述执行模块,包括:
第二简化单元,用于按照操作路径拆分或合并所述至少一条操作记录,以 简化所述第一记录数据;
执行单元,用于根据简化后的第一记录数据和所述第二记录数据,得到所 述终端应执行的操作,并执行所述操作。
结合第六方面以及第六方面的第一和第二种可行的实施方式,在第三种可 行的实施方式中,所述终端还包括:
记录模块,用于将所述第一记录数据中所述文件的最高版本号记录为所述 终端本次同步所述文件的版本号;
第二发送模块,用于发送所述终端的标识信息、 所述终端本次同步所述文 件的版本号、 以及所述终端的用户标识至所述服务器,以使所述服务器更新所 述用户对所述终端的同步记录。
本申请第七方面提供一种计算机存储介质,所述计算机存储介质存储有程 序,执行所述程序时包括本申请第二方面提供的文件同步方法的全部或部分步
骤。
本申请第八方面提供一种终端,包括:输入装置、 输出装置和处理器,所 述输入装置、 所述输出装置和所述处理器通过总线相连接,其中:
所述输出装置,用于发送文件同步请求至服务器;
所述输入装置,用于接收所述服务器响应所述文件同步请求而发送的第一 记录数据,所述第一记录数据包括所述服务器保存的所述文件的各版本数据中 预定版本的所述文件在所述终端最近一次同步所述文件之后产生的操作记录; 所述处理器用于:
查找第二记录数据,所述第二记录数据包括所述终端在所述最近一次同步 所述文件之后对所述文件执行的操作记录;
根据所述第一记录数据和所述第二记录数据得到所述终端应执行的操作, 并执行所述操作。
结合第八方面,在第一种可行的实施方式中,所述处理器查找第二记录数 据时,具体步骤为:
查找所述终端在最近一次同步所述文件之后对所述文件执行的每一条操 作记录;
按照操作路径拆分或合并所述每一条操作记录,得到所述第二记录数据。 结合第八方面,在第二种可行的实施方式中,所述第一记录数据包括至少 一条操作记录;
所述处理器根据所述第一记录数据和所述第二记录数据得到所述终端应 执行的操作,并执行所述操作时,具体步骤为:
按照操作路径拆分或合并所述至少一条操作记录,以简化所述第一记录数 据;
根据简化后的第一记录数据和所述第二记录数据,得到所述终端应执行的 操作,并执行所述操作。
结合第八方面以及第八方面的第一和第二种可行的实施方式,在第三种可 行的实施方式中,
所述处理器,还用于将所述第一记录数据中所述文件的最高版本号记录为 所述终端本次同步所述文件的版本号;
所述输出装置,还用于发送所述终端的标识信息、 所述终端本次同步所述
文件的版本号、 以及所述终端的用户标识至所述服务器,以使所述服务器更新 所述用户对所述终端的同步记录。
本申请中,服务器接收到终端发送的文件同步请求之后,从保存的该文件 的各版本数据中查找在终端上次同步该文件之后,该文件产生的操作记录,并 发送给该终端,无需与终端进行多次交互,且该文件的这些操作记录与该文件 的整个目录结构相比,数据量较小,传输时不仅节约时间,还可減少用户的网 络资源消耗。终端可结合服务器发送的操作记录以及该终端本身在上次同步该 文件之后对该文件执行的操作记录,确定应执行的操作,无需逐层遍历服务器 上的文件目录并与终端的文件目录进行对比,从而可有效減少同步时间,提高 同步效率。 附图说明
为了更清楚地说明本申请中的技术方案,下面将对实施例中所需要使用的 附图作简单地介绍,显而易见地,下面描述中的附图仅仅是本申请的一些实施 例,对于本领域普通技术人员来讲,在不付出创造性劳动性的前提下,还可以 根据这些附图获得其他的附图。
图 1是本申请提供的文件同步方法的一实施例的流程示意图;
图 2是本申请提供的文件同步方法的另一实施例的流程示意图; 图 3是本申请提供的文件同步方法的又一实施例的流程示意图; 图 4是本申请提供的服务器的一实施例的结构示意图;
图 5是本申请提供的服务器的另一实施例的结构示意图;
图 6是本申请提供的服务器的又一实施例的结构示意图;
图 7是本申请提供的终端的一实施例的结构示意图;
图 8是本申请提供的终端的另一实施例的结构示意图;
图 9是本申请提供的终端的又一实施例的结构示意图。 具体实施方式
下面将结合本申请实施例中的附图,对本申请实施例中的技术方案进行清 楚、 完整地描述,显然,所描述的实施例仅仅是本申请一部分实施例,而不是
全部的实施例。基于本申请中的实施例,本领域普通技术人员在没有做出创造 性劳动前提下所获得的所有其他实施例,都属于本申请保护的范围。
本申请提供了一种文件同步方法、 服务器及终端,可以缩短同步时间、 提 高同步效率以及減少网络资源消耗。 以下结合附图分别进行详细说明。
请参阅图 1 ,图 1为本申请提供的文件同步方法的一实施例的流程示意图。 其中,图 1所示的文件同步方法具体可由服务器实现,如图 1所示,该文件同步 方法可以包括以下步骤:
步骤 S101 ,接收终端发送的文件同步请求。
本申请中,服务器接收终端发送的文件同步请求,该文件同步请求可指示 该终端本次要同步的文件、 该终端最近一次同步该文件的时间、 该终端最近一 次同步该文件的版本号、 和 /或该终端本次同步该文件需要服务器提供的数据 (包括目录结构和 /或操作记录等
步骤 S102 ,响应所述文件同步请求,从服务器保存的所述文件的各版本数 据中查找第一记录数据,所述第一记录数据包括预定版本的所述文件在所述终 端最近一次同步所述文件之后产生的操作记录。
具体实现中,第一记录数据为其他终端或数据管理应用发送给服务器的该 文件的各版本数据中,在该终端最近一次同步完该文件之后,预定版本的该文 件由于各种修改操作,如***、 添加、 删除等而产生的操作记录。 具体地,上 述的预定版本由终端发送的文件同步请求来确定。
作为一种可能的实施方式,文件同步请求可包括终端最近一次同步该文件 的版本号以及本次同步的最高版本号。此时,第一记录数据包括预定版本的该 文件在该终端最近一次同步该文件之后产生的全部操作记录,其中该预定版本 为版本号介于终端最近一次同步该文件的版本号和本次同步的最高版本号之 间(包括本次同步的最高版本号)的所有版本,具体地,本次同步的最高版本 号可以是当前该文件的最高版本号,也可以是任何一个比最近一次同步的版本 号更高的版本号,具体可视终端当前的网络状况而定,例如当终端的网络资源 充裕时(如处于宽带网络连接或无线网络连接状态时),本次同步的最高版本 号可以是当前该文件的最高版本号;当终端的网络资源匮乏时(如处于移动网 络状态时),本次同步的最高版本号可以高于终端最近一次同步该文件的版本
号,而且低于当前该文件的最高版本号。 举例来说,终端最近一次同步该文件 的版本号为 V1.0 ,时间是 2014-2-25 , 9:00:00 ,当前为止该文件的最高版本号 为 V9.0 ,然而终端处于移动网络状态且流量剩余不多,则本次同步的最高版本 号可以是 V4.0 ,上述的预定版本为 V2.0至 V4.0 ,第一记录数据包括 V2.0至 V4.0 版本的该文件在 2014-2-25 , 9:00:00之后产生的操作记录。
作为一种可能的实施方式,文件同步请求可包括该终端最近一次同步该文 件的版本号以及数量阈值。此时,第一记录数据可包括预定版本的该文件在该 终端最近一次同步完该文件之后依次产生的预定数量的操作记录,其中该预定 版本的版本号高于终端最近一次同步该文件的版本号,该预定数量的值等于该 数量阈值。具体实现中,可先从服务器保存的该文件的各版本数据中查找出版 本号高于终端最近一次同步该文件的版本号的文件数据,然后以该终端最近一 次同步完该文件的时间点为起始点,按照操作时间从先到后的顺序从查找出的 文件数据中筛选出预定数量(该预定数量的值等于文件同步请求中的数量阈 值)的操作记录,作为第一记录数据。
步骤 S103 ,发送所述第一记录数据至所述终端,以使所述终端根据所述第 一记录数据及所述终端上的第二记录数据得到所述终端应执行的操作,所述第 二记录数据包括所述终端在最近一次同步所述文件之后对所述文件执行的操 作记录。
具体实现中,在步骤 S102中查找到的第一记录数据是由至少一条操作记录 组成的。
作为一种可能的实施方式,若终端所处的环境网络资源充裕,服务器可直 接将查找到的至少一条操作记录发送给终端,以減缓服务器的计算压力。
作为另一种可能的实施方式,若终端处于移动网络环境或网络通道拥塞, 此时将第一记录数据发送给终端之前,可先将该至少一条操作记录按照操作路 径进行拆分或合并。 例如;' MOVE A, fl to f2" 可以拆分成" DELETE A, fl" 禾 D ADD A, f2" "; ADD B, fl" ADD C, fl"" DELETE B, fl"可以合并成 ADD C, fl'O
拆分该至少一条操作记录,可以将该至少一条操作记录转换成 ADD或 DELETE这两种只涉及一个路径的基础操作记录;按照操作路径合并这些拆分
后得到的基础操作记录,可去掉冗余数据,直观呈现第一记录数据导致的该文 件的最终变更,从而可以減少网络资源的消耗和数据传输时间。
在一些可行的实施方式中,发送第一记录数据给终端后,该文件同步方法 还可包括:
接收终端发送的该终端的标识信息、 该终端本次同步该文件的版本号、 以 及该终端的用户标识;
根据该终端的标识信息、 该终端本次同步该文件的版本号、 以及该终端的 用户标识,更新用户对该终端的同步记录;
查询该用户的其他终端最近一次同步该文件的版本号;
若该终端本次同步该文件的版本号低于该用户的其他终端最近一次同步 该文件的版本号,则从该服务器保存的该文件的各版本数据中,删除在接收该 文件同步请求之前产生的操作记录。
具体实现中,用户对该终端的同步记录可包括该终端的标识信息、 该终端 的用户标识、 同步该文件的时间和版本号等。
具体实现中,在同步结束后,若该终端上保存的是该文件的最低版本,则 可删除服务器保存的该文件在本次同步开始的时间点之前产生的操作记录,以 減少服务器的冗余存储,減缓服务器的存储压力。
在图 1所描述的文件同步方法中,服务器接收到终端发送的文件同步请求 之后,从保存的该文件的各版本数据中查找在终端上次同步该文件之后,该文 件产生的操作记录,并发送给该终端,无需与终端进行多次交互,且该文件的 这些操作记录与该文件的整个目录结构相比,数据量较小,传输时不仅节约时 间,还可減少用户的网络资源消耗。终端可结合服务器发送的操作记录以及该 终端本身在上次同步该文件之后对该文件执行的操作记录,确定应执行的操 作,无需逐层遍历服务器上的文件目录并与终端的文件目录进行对比,从而可 有效減少同步时间,提高同步效率。
请参阅图 2 ,图 2为本申请提供的文件同步方法的另一实施例的流程示意 图。 其中,图 2所示的文件同步方法具体可由终端实现。 如图 2所示,该文件同 步方法可以包括以下步骤:
S201 ,发送文件同步请求至服务器。
本申请中,终端向服务器发送文件同步请求,该文件同步请求可指示终端 本次要同步的文件、 终端最近一次同步该文件的时间、 终端最近一次同步该文 件的版本号、 和 /或本次同步该文件需要服务器提供的数据(包括目录结构和 / 或操作记录等
S202 ,查找第二记录数据,所述第二记录数据包括终端在最近一次同步所 述文件之后对所述文件执行的操作记录。
本申请中,终端可包括两种:一种是可直接获取到对该文件的操作记录的 终端,此类终端一般含有输入装置和处理器,可独立对文件进行操作,例如计 算机、 平板电脑等;另一种是无法直接获取到文件的操作记录的终端,例如同 步 U盘。
基于终端类型的不同,终端查找第二记录数据也有相应不同的实施方式。 作为一种可行的实施方式,当终端可以直接获取到对该文件的操作记录 时,查找第二记录数据的步骤可包括:首先,查找该终端在最近一次同步完该 文件之后对该文件执行的每一条操作记录;然后,按照操作路径拆分或合并这 些操作记录,得到第二记录数据。
具体地,拆分是指将一条涉及到多个路径的操作记录拆分成多条只涉及一 个路径的基础操作记录,如" MOVE A, fl to f2" 可以拆分成" DELETE A, fl" 禾 [J' ADD A, f2"0 合并是指将多条操作路径相同的操作记录合并成数量较少的 操作记录,例如" ADD B, fl"、" ADD C, fl" 禾口" DELETE B, fl" 可以合并成 " ADD C, fl'O拆分合并操作,可将同步时需要的数据简化,去掉冗余的数据, 从而缩短同步的时间,提高同步效率。
作为另一种可行的实施方式,当终端无法直接获取到文件的操作记录时, 查找第二记录数据的步骤可包括:首先,读取终端在最近一次同步完该文件后 得到并保存的该文件的目录信息;然后,将最近一次同步完该文件后得到的该 文件的目录信息与该终端当前本地存储的该文件的目录信息进行对比,可得到 该终端在最近一次同步完该文件之后对该文件执行的操作记录,包括添加的数 据和 /或删除的数据等,这些操作记录即为第二记录数据。
S203 ,接收所述服务器响应所述文件同步请求而发送的第一记录数据,所 述第一记录数据包括所述服务器保存的所述文件的各版本数据中预定版本的
所述文件在所述终端最近一次同步所述文件之后产生的操作记录。 具体实施中,基于文件同步请求的内容的不同,第一记录数据也相应有几 种不同的情况。
作为一种可能的实施方式,文件同步请求可包括终端最近一次同步该文件 的版本号以及本次同步的最高版本号。此时,第一记录数据包括预定版本的该 文件在该终端最近一次同步该文件之后产生的全部操作记录,其中该预定版本 为版本号介于终端最近一次同步该文件的版本号和本次同步的最高版本号之 间(包括本次同步的最高版本号)的所有版本,具体地,本次同步的最高版本 号可以是当前该文件的最高版本号,也可以是任何一个比最近一次同步的版本 号更高的版本号,具体可视终端当前的网络状况而定。
作为一种可能的实施方式,文件同步请求可包括该终端最近一次同步该文 件的版本号以及数量阈值。此时,第一记录数据可包括预定版本的该文件在该 终端最近一次同步完该文件之后依次产生的预定数量的操作记录,其中该预定 版本的版本号高于终端最近一次同步该文件的版本号,该预定数量的值等于该 数量阈值。
S204 ,根据所述第一记录数据和所述第二记录数据得到所述终端应执行的 操作,并执行所述操作。
具体实现中,结合在该终端最近一次同步完该文件的时间点之后之后,服 务器保存的预定版本的该文件产生的操作记录,以及终端对该文件执行的操作 记录,可计算得到本次同步终端需要执行的操作,如:需要添加的数据、 需要 删除的数据等。
作为一种可能的实施方式,服务器所发送的第一记录数据为服务器直接从 该文件的各版本数据中查找出来的未经过简化处理的多条操作记录,此时,根 据第一记录数据和第二记录数据得到终端应执行的操作可包括如下步骤: 首先,按照操作路径拆分或合并该多条操作记录,以简化第一记录数据。 具体地,拆分是指将一条涉及到多个路径的操作记录拆分成多条只涉及一个路 径的基础操作记录,合并是指将多条操作路径相同的操作记录合并成数量较少 的操作记录,例姐' MOVE A, fl to f2"可以拆分成' DELETE A, fl"禾 P" ADD A, f2" '■; ADD B, fl" " ADD C, fl" " DELETE B,『可以合并成 ADD C, fl'O
拆分合并操作,可将同步时需要的数据简化,去掉冗余的数据,从而缩短同步 的时间,提高同步效率。
然后,根据简化后的第一记录数据和第二记录数据,得到所述终端应执行 的操作,并执行所述操作。 此时,第一记录数据和第二记录数据中的操作记录 均为只涉及一个操作路径的基础操作记录,则根据第一记录数据和第二记录数 据得到终端应执行的操作,可具体为:以终端上次同步完该文件的时间点为起 始点,按照操作时间由先到后的顺序将第一记录数据和第二记录数据中操作路 径相同的操作记录合并,根据合并后的操作记录即可得到终端应执行的操作。 例如:操作路径为磁盘 l ( fl )的操作记录依次有? ADD A, fl'\" ADD B, fl"、 " ADD C, fl"和 DELETE B, fl" ,以上 4条操作记录可以合并成 ADD AB, fl" , 则终端应执行的操作为:在磁盘 1中添加" AB"。
作为一种可行的实施方式,在得到终端应执行的操作并执行该操作之后, 该文件同步方法还可包括:
将第一记录数据中该文件的最高版本号记录为该终端本次同步该文件的 版本号;发送该终端的标识信息、 该终端本次同步该文件的版本号、 以及该终 端的用户标识至服务器,以使服务器更新该用户对该终端的同步记录。
具体实现中,用户对该终端的同步记录可包括该终端的标识信息、 该终端 的用户标识、 同步该文件的时间和版本号等。
在图 2所描述的文件同步方法中,终端向服务器发送文件同步请求,然后 查找第二记录数据,并接收服务器发送的第一记录数据,无需与服务器进行多 次交互,也无需逐层遍历服务器上的文件目录,而且第一记录数据由终端上次 同步该文件之后该文件产生的操作记录组成,与该文件的整个目录结构相比, 数据量较小,传输时不仅节约时间,还可減少用户的网络资源消耗。 第二记录 数据为终端在上次同步完该文件之后对该文件执行过的操作记录,终端可将第 一记录数据进行拆分合并后结合第二记录数据,得到终端应执行的操作,不仅 可減少冗余数据以及同步时的计算量,缓解终端的计算压力,同时提高同步效 率。
请参阅图 3 ,图 3为本申请提供的文件同步方法的又一实施例的流程示意 图。 其中,图 3所示的文件同步方法具体可由服务器和终端交互实现。 如图 3
所示,该文件同步方法可以包括以下步骤:
5301 ,终端发送文件同步请求至服务器。
本申请中,终端向服务器发送文件同步请求,该文件同步请求可指示终端 本次要同步的文件、 终端最近一次同步该文件的时间、 终端最近一次同步该文 件的版本号、 和 /或本次同步该文件需要服务器提供的数据(包括目录结构和 / 或操作记录等
5302 ,终端查找第二记录数据。
本申请中,第二记录数据包括终端在上次同步完该文件之后对该文件执行 的操作记录。其中终端可包括两种:一种是可直接获取到对该文件的操作记录 的终端,此类终端一般含有输入装置和处理器,可独立对文件进行操作,例如 计算机、 平板电脑等;另一种是无法直接获取到文件的操作记录的终端,例如 同步 U盘。
基于终端类型的不同,终端查找第二记录数据也有相应不同的实施方式。 作为一种可行的实施方式,当终端可以直接获取到对该文件的操作记录 时,查找第二记录数据的步骤可包括:首先,查找该终端在最近一次同步完该 文件最近一次之后对该文件执行的每一条操作记录;然后,按照操作路径拆分 或合并这些操作记录,得到第二记录数据。
作为另一种可行的实施方式,当终端无法直接获取到文件的操作记录时, 查找第二记录数据的步骤可包括:首先,读取终端在最近一次同步完该文件后 得到并保存的该文件的目录信息;然后,将最近一次同步完该文件后得到的该 文件的目录信息与该终端当前本地存储的该文件的目录信息进行对比,可得到 终端在最近一次同步完该文件之后对该文件执行的操作记录,包括添加的数据 和 /或删除的数据等,这些操作记录即为第二记录数据。
步骤 S303 ,服务器查找第一记录数据。
具体实现中,第一记录数据为其他终端或数据管理应用发送给服务器的该 文件的各版本数据中,在该终端最近一次同步完该文件之后,预定版本的该文 件由于各种修改操作,如***、 添加、 删除等而产生的操作记录。 具体地,上 述的预定版本由终端发送的文件同步请求来确定。
作为一种可能的实施方式,文件同步请求可包括终端最近一次同步该文件
的版本号以及本次同步的最高版本号。此时,第一记录数据包括预定版本的该 文件在该终端最近一次同步该文件之后产生的全部操作记录,其中该预定版本 为版本号介于终端最近一次同步该文件的版本号和本次同步的最高版本号之 间(包括本次同步的最高版本号)的所有版本,具体地,本次同步的最高版本 号可以是当前该文件的最高版本号,也可以是任何一个比最近一次同步的版本 号更高的版本号,具体可视终端当前的网络状况而定。
作为一种可能的实施方式,文件同步请求可包括该终端最近一次同步该文 件的版本号以及数量阈值。此时,第一记录数据可包括预定版本的该文件在该 终端最近一次同步完该文件之后依次产生的预定数量的操作记录,其中该预定 版本的版本号高于终端最近一次同步该文件的版本号,该预定数量的值等于该 数量阈值。具体实现中,可先从服务器保存的该文件的各版本数据中查找出版 本号高于终端最近一次同步该文件的版本号的文件数据,然后以该终端最近一 次同步完该文件的时间点为起始点,按照操作时间从先到后的顺序从查找出的 文件数据中筛选出预定数量(该预定数量的值等于文件同步请求中的数量阈 值)的操作记录,作为第一记录数据。
步骤 S304 ,服务器将第一记录数据发送给终端。
具体实现中,第一记录数据包括至少一条操作记录,作为一种可能的实施 方式,若终端所处的环境网络资源充裕,服务器可直接将查找到的至少一条操 作记录发送给终端,以減缓服务器的计算压力。
作为另一种可能的实施方式,若终端处于移动网络环境或网络通道拥塞, 此时将第一记录数据发送给终端之前,可先将该至少一条操作记录按照操作路 径进行拆分或合并。
步骤 S305 ,终端确定应执行的操作。
具体实现中,终端结合第一记录数据和第二记录数据,可计算得到当前同 步需要执行的操作,如:需要添加的数据、 需要删除的数据等。
作为一种可能的实施方式,第一记录数据为服务器直接从该文件的各版本 数据中查找出来的未经过简化处理的多条操作记录,此时,根据第一记录数据 和第二记录数据得到终端应执行的操作,可包括如下步骤:
首先,按照操作路径拆分或合并该多条操作记录,以简化第一记录数据。
具体地,拆分是指将一条涉及到多个路径的操作记录拆分成多条只涉及一个路 径的基础操作记录,合并是指将多条操作路径相同的操作记录合并成数量较少 的操作记录。
然后,根据简化后的第一记录数据和所述第二记录数据,得到所述终端应 执行的操作,并执行所述操作。 此时,第一记录数据和第二记录数据中的操作 记录均为只涉及一个操作路径的基础操作记录,则根据第一记录数据和第二记 录数据得到终端应执行的操作,可具体为:以终端上次同步完该文件的时间点 为起始点,按照操作时间由先到后的顺序将第一记录数据和第二记录数据中操 作路径相同的操作记录合并,根据合并后的操作记录即可得到终端应执行的操 作。
步骤 S306 ,终端执行上述应执行的操作。
步骤 S307 ,终端记录本次同步该文件的版本号,具体为将第一记录数据中 该文件的最高版本号记录为该终端本次同步该文件的版本号。
步骤 S308 ,终端发送该终端的标识信息、该终端本次同步该文件的版本号、 以及该终端的用户标识至服务器。
步骤 S309 ,服务器根据该终端的标识信息、该终端本次同步该文件的版本 号、 以及该终端的用户标识,更新用户对该终端的同步记录。 具体实现中,用 户对该终端的同步记录可包括该终端的标识信息、 该终端的用户标识、 同步时 间、 同步的版本号等。
步骤 S310 ,服务器查询该用户的其他终端最近一次同步该文件的版本号。 步骤 S311 ,服务器删除冗余操作记录。 具体为,若该终端本次同步该文件 的版本号低于该用户的其他终端最近一次同步该文件的版本号,则从该服务器 保存的该文件的各版本数据中,删除在接收该文件同步请求之前产生的操作记 录,以減少服务器的冗余存储,減缓服务器的存储压力。
在图 3所描述的文件同步方法中,服务器与终端无需进行多次交互,也无 需逐层遍历服务器上的文件目录,可減少同步的时间消耗;终端将操作记录简 化后再进行同步,可減少冗余数据,进一步缩短同步的耗时,提高同步效率。
相应的,本申请还提供了可用于实施本申请方法实施例的服务器和终端的
装置实施例,下面结合附图对本申请的服务器和终端的结构组成进行举例说 明。
请参阅图 4 ,图 4为本申请提供的服务器的一实施例的结构示意图。 如图 4 所示,该服务器可包括:第一接收模块 401、 查找模块 402和发送模块 403;在 —些可能的实施方式中,该服务器还可包括第二接收模块 404、 更新模块 405、 查询模块 406以及删除模块 407中至少一种,其中:
第一接收模块 401 ,用于接收终端发送的文件同步请求。
查找模块 402 ,用于响应所述文件同步请求,从服务器保存的所述文件的 各版本数据中查找第一记录数据,所述第一记录数据包括预定版本的所述文件 在所述终端最近一次同步所述文件之后产生的操作记录。
发送模块 403 ,用于发送所述第一记录数据至所述终端,以使所述终端根 据所述第一记录数据及所述终端上的第二记录数据得到所述终端应执行的操 作,所述第二记录数据包括所述终端在最近一次同步所述文件之后对所述文件 执行的操作记录。
本申请中,服务器接收终端发送的文件同步请求,该文件同步请求可指示 该终端本次要同步的文件、 该终端最近一次同步该文件的时间、 该终端最近一 次同步该文件的版本号、 和 /或该终端本次同步该文件需要服务器提供的数据 (包括目录结构和 /或操作记录等
具体实现中,第一记录数据为其他终端或数据管理应用发送给服务器的该 文件的各版本数据中,在该终端最近一次同步完该文件之后,预定版本的该文 件由于各种修改操作,如***、 添加、 删除等而产生的操作记录。 具体地,上 述的预定版本由终端发送的文件同步请求来确定。
作为一种可能的实施方式,文件同步请求可包括终端最近一次同步该文件 的版本号以及本次同步的最高版本号。 此时,第一记录数据包括预定版本的该 文件在该终端最近一次同步该文件之后产生的全部操作记录,其中该预定版本 为版本号介于终端最近一次同步该文件的版本号和本次同步的最高版本号之 间(包括本次同步的最高版本号)的所有版本,具体地,本次同步的最高版本 号可以是当前该文件的最高版本号,也可以是任何一个比最近一次同步的版本
号更高的版本号,具体可视终端当前的网络状况而定,例如当终端的网络资源 充裕时(如处于宽带网络连接或无线网络连接状态时),本次同步的最高版本 号可以是当前该文件的最高版本号;当终端的网络资源匮乏时(如处于移动网 络状态时),本次同步的最高版本号可以高于终端最近一次同步该文件的版本 号,而且低于当前该文件的最高版本号。
作为一种可能的实施方式,文件同步请求可包括该终端最近一次同步该文 件的版本号以及数量阈值。此时,第一记录数据可包括预定版本的该文件在该 终端最近一次同步完该文件之后依次产生的预定数量的操作记录,该预定版本 的版本号高于终端最近一次同步该文件的版本号,该预定数量的值等于该数量 阈值。 具体实现中,查找模块 402可先从服务器保存的该文件的各版本数据中 查找出版本号高于终端最近一次同步该文件的版本号的文件数据,然后以该终 端最近一次同步完该文件的时间点为起始点,按照操作时间从先到后的顺序从 查找出的文件数据中筛选出预定数量(该预定数量的值等于文件同步请求中的 数量阈值)的操作记录,作为第一记录数据。
具体实现中,查找模块 402查找到的第一记录数据是由至少一条操作记录 组成的。
作为一种可能的实施方式 ,若终端所处的环境网络资源充裕,发送模块 403 可直接将查找到的至少一条操作记录发送给终端,以減缓服务器的计算压力。
作为另一种可能的实施方式,若终端处于移动网络环境或网络通道拥塞, 此时发送模块 403将第一记录数据发送给终端之前,可先将该至少一条操作记 录按照操作路径进行拆分或合并。 例如:' MOVE A, fl to f2" 可以拆分成 " DELETE A, fl" 禾口" ADD A, f2" ' ADD B, fl"、" ADD C, fl"" DELETE B, fl" 可以合并成" ADD C, fl"。
拆分该至少一条操作记录,可以将该至少一条操作记录转换成 ADD或 DELETE这两种只涉及一个路径的基础操作记录;按照操作路径合并这些拆分 后得到的基础操作记录,可去掉冗余数据,直观呈现第一记录数据导致的该文 件的最终变更,从而可以減少网络资源的消耗和数据传输时间
作为一种可行的实施方式,如图 5所示,该服务器还可包括第二接收模块 404、 更新模块 405、 查询模块 406、 删除模块 407中的至少一种,其中:
第二接收模块 404 ,用于接收所述终端发送的所述终端的标识信息、 所述 终端本次同步所述文件的版本号、 以及所述终端的用户标识。
更新模块 405 ,用于根据所述终端的标识信息、 所述终端本次同步所述文 件的版本号、以及所述终端的用户标识,更新所述用户对所述终端的同步记录。
查询模块 406 ,用于查询所述用户的其他终端最近一次同步所述文件的版 本号。
删除模块 407 ,用于在所述终端本次同步该文件的版本号低于该用户的其 他终端最近一次同步该文件的版本号时,从该服务器保存的该文件的各版本数 据中,删除在接收该文件同步请求之前产生的操作记录。
具体实现中,用户对该终端的同步记录可包括该终端的标识信息、 该终端 的用户标识、 同步该文件的时间和版本号等。
具体实现中,在同步结束后,若该终端上保存的是该文件的最低版本,则 可删除服务器保存的该文件在本次同步开始的时间点之前产生的操作记录,以 減少服务器的冗余存储,減缓服务器的存储压力。
在图 4或图 5所描述的服务器中,在第一接收模块接收到终端发送的文件同 步请求之后,查找模块从服务器保存的该文件的各版本数据中查找在该终端上 次同步该文件之后该文件产生的操作记录;发送模块将这些操作记录发送给该 终端,服务器无需与终端进行多次交互,且与该文件的整个目录结构相比,这 些操作记录的数据量较小,传输时不仅节约时间,还可減少用户的网络资源消 耗。终端可结合服务器发送的操作记录以及该终端本身在上次同步该文件之后 对该文件执行的操作记录,得到应执行的操作,无需逐层遍历服务器上的文件 目录并与终端的文件目录进行对比,从而可有效減少同步时间,提高同步效率。
请参阅图 6 ,图 6为本申请提供的服务器的又一实施例的结构示意图。 如 图 6所示,该服务器可包括:输入装置 601、 输出装置 602和处理器 603。 在 本申请的一些实施例中,输入装置 601和处理器 603之间、 输出装置 602和处 理器 603之间可以通过总线或其他方式连接,其中,图 6中以通过总线连接为 例。
其中,输入装置 601 ,用于接收终端发送的文件同步请求。
处理器 603 ,用于响应所述文件同步请求,从服务器保存的所述文件的各
版本数据中查找第一记录数据,所述第一记录数据包括预定版本的所述文件在 所述终端最近一次同步所述文件之后产生的操作记录。
输出装置 602 ,用于发送所述第一记录数据至所述终端,以使所述终端根 据所述第一记录数据及所述终端上的第二记录数据得到所述终端应执行的操 作,所述第二记录数据包括所述终端在最近一次同步所述文件之后对所述文件 执行的操作记录。
作为一种可能的实施方式,该文件同步请求包括该终端最近一次同步该文 件的版本号以及本次同步的最高版本号;此时第一记录数据包括预定版本的该 文件在该终端最近一次同步该文件之后产生的全部操作记录,其中该预定版本 的版本号高于该终端最近一次同步该文件的版本号,且低于或等于本次同步的 最高版本号。
作为一种可能的实施方式,文件同步请求包括该终端最近一次同步该文件 的版本号以及数量阈值;此时,第一记录数据包括预定版本的该文件在该终端 最近一次同步完该文件之后依次产生的预定数量的操作记录,其中该预定版本 的版本号高于终端最近一次同步该文件的版本号,该预定数量的值等于该数量 阈值。
作为一种可能的实施方式,第一记录数据中包括至少一条操作记录,此时 输出模块 602发送第一记录数据至该终端前,可先将其中的至少一条操作记录 按照操作路径进行拆分或合并后,再发送给该终端。
作为一种可能的实施方式,输入装置 601还用于接收该终端发送的该终端 的标识信息、 该终端本次同步该文件的版本号、 以及该终端的用户标识。
处理器 603还用于:
根据该终端的标识信息、 该终端本次同步该文件的版本号、 以及该终端的 用户标识,更新用户对该终端的同步记录;
查询该用户的其他终端最近一次同步该文件的版本号;
若该终端本次同步该文件的版本号低于该用户的其他终端最近一次同步 该文件的版本号,则从服务器保存的该文件的各版本数据中,删除在接收文件 同步请求的之前产生的操作记录。
在图 6所描述的服务器中,服务器无需与终端进行多次交互,且无需逐层
遍历服务器上的文件目录并与终端的文件目录进行对比,此外与该文件的整个 目录结构相比,在终端最近一次同步该文件的之后产生的操作记录数据量较 小,同步时不仅缩短数据传输时间,还可減少用户的网络资源消耗,从而提高 同步效率。
请参阅图 7 ,图 7为本申请提供的终端的一实施例的结构示意图。 如图 7 所示,该终端可包括:第一发送模块 701、 查找模块 702、 接收模块 703和执 行模块 704 ,其中:
第一发送模块 701 ,用于发送文件同步请求至服务器。
查找模块 702 ,用于查找第二记录数据,所述第二记录数据包括终端在最 近一次同步所述文件之后对所述文件执行的操作记录。
接收模块 703 ,用于接收所述服务器响应所述文件同步请求而发送的第一 记录数据,所述第一记录数据包括所述服务器保存的所述文件的各版本数据中 预定版本的所述文件在所述终端最近一次同步所述文件之后产生的操作记录。
执行模块 704 ,用于根据所述第一记录数据和所述第二记录数据得到所述 终端应执行的操作,并执行所述操作。
本申请中,终端向服务器发送文件同步请求,该文件同步请求可指示终端 本次要同步的文件、 终端最近一次同步该文件的时间、 终端最近一次同步该文 件的版本号、 和 /或本次同步该文件需要服务器提供的数据(包括目录结构和 / 或操作记录等
本申请中,终端可包括两种:一种是可直接获取到对该文件的操作记录的 终端,此类终端一般含有输入装置和处理器,可独立对文件进行操作,例如计 算机、 平板电脑等;另一种是无法直接获取到文件的操作记录的终端,例如同 步 U盘。
基于终端类型的不同,查找模块 702查找第二记录数据也有相应不同的实 施方式。
作为一种可行的实施方式,当终端可以直接获取到对该文件的操作记录 时,查找模块 702可进一步包括可包括以下单元(图中未示):
查找单元,用于查找该终端最近一次同步该文件之后对该文件执行的每一 条操作记录。
按照操作路径拆分或合并这些操作记录,得到第二记录数据。
具体地,拆分是指将一条涉及到多个路径的操作记录拆分成多条只涉及一 个路径的基础操作记录,如" MOVE A, fl to f2" 可以拆分成" DELETE A, fl" 禾 [J' ADD A, f2"0 合并是指将多条操作路径相同的操作记录合并成数量较少的 操作记录,例如" ADD B, fl"、" ADD C, fl" 禾口" DELETE B, fl" 可以合并成 " ADD C, fl'O拆分合并操作,可将同步时需要的数据简化,去掉冗余的数据, 从而缩短同步的时间,提高同步效率。
作为另一种可行的实施方式,当终端无法直接获取到文件的操作记录时, 查找模块 702查找第二记录数据的步骤可包括:首先,读取终端在最近一次同 步完该文件后得到并保存的该文件的目录信息;然后,将最近一次同步完该文 件后得到的该文件的目录信息与该终端当前本地存储的该文件的目录信息进 行对比,可得到该终端在最近一次同步完该文件之后对该文件执行的操作记 录,包括添加的数据和 /或删除的数据等,这些操作记录即为第二记录数据。
具体实施中,基于文件同步请求的内容的不同,第一记录数据也相应有几 种不同的情况。
在一种可能的实施方式中,文件同步请求可包括终端最近一次同步该文件 的版本号以及本次同步的最高版本号。此时,第一记录数据包括预定版本的该 文件在该终端最近一次同步该文件之后产生的全部操作记录,其中该预定版本 为版本号介于终端最近一次同步文件的版本号和本次同步的最高版本号之间 (包括本次同步的最高版本号)的所有版本,具体地,本次同步的最高版本号 可以是当前该文件的最高版本号,也可以是任何一个比最近一次同步的版本号 更高的版本号,具体可视终端当前的网络状况而定。
在一种可能的实施方式中,文件同步请求可包括该终端最近一次同步该文 件的版本号以及数量阈值。此时,第一记录数据可包括预定版本的该文件在该 之后依次产生的预定数量的操作记录,其中该预定版本的版本号高于终端最近 一次同步该文件的版本号,该预定数量的值等于该数量阈值。
具体实现中,结合在该终端最近一次同步完该文件的时间点之后之后,服 务器保存的预定版本的该文件产生的操作记录,以及终端对该文件执行的操作 记录,执行模块 704可计算得到当前同步需要执行的操作,如:需要添加的数
据、 需要删除的数据等。
作为一种可能的实施方式,服务器所发送的第一记录数据为服务器直接从 该文件的各版本数据中查找出来的未经过简化处理的多条操作记录,此时,执 行模块 704可包括以下单元(图中未示):
第二记录简化单元,用于按照操作路径拆分或合并该多条操作记录,以简 化第一记录数据。 具体地,拆分是指将一条涉及到多个路径的操作记录拆分 成多条只涉及一个路径的基础操作记录,合并是指将多条操作路径相同的操作 记录合并成数量较少的操作记录。拆分合并操作,可将同步时需要的数据简化, 去掉冗余的数据,从而缩短同步的时间,提高同步效率。
执行单元,用于根据简化后的第一记录数据和第二记录数据,得到所述终 端应执行的操作,并执行所述操作。 此时,第一记录数据和第二记录数据中的 操作记录均为只涉及一个操作路径的基础操作记录,则根据第一记录数据和第 二记录数据得到终端应执行的操作,可具体为:以该终端上次同步完该文件的 时间点为起始点,按照操作时间由先到后的顺序将第一记录数据和第二记录数 据中操作路径相同的操作记录合并,根据合并后的操作记录即可得到终端应执 行的操作。 例如:操作路径为磁盘 1 ( fl )的操作记录依次有 ' ADD A, fl"、 " ADD B, fl"、" ADD C, fl" 禾口" DELETE B, fl" ,以上 4条操作记录可以合 并成" ADD AB, fl" ,则终端应执行的操作为:在磁盘 1中添加" ΑΒ"。
在一些可行的实施方式中,如图 8 所示,该终端还可包括记录模块 705 和第二发送模块 706中至少一种,其中:
记录模块 705 ,用于在执行模块 704得到终端应执行的操作并执行该操作 之后,将所述第一记录数据中所述文件的最高版本号记录为所述终端本次同步 所述文件的版本号。
第二发送模块 706 ,用于发送所述终端的标识信息、 所述终端本次同步所 述文件的版本号、 以及所述终端的用户标识至所述服务器,以使所述服务器更 新所述用户对所述终端的同步记录。具体实现中,用户对该终端的同步记录可 包括该终端的标识信息、 该终端的用户标识、 同步该文件的时间和版本号等。
在图 7或图 8所描述的终端中第一发送模块向服务器发送文件同步请求; 查找模块查找终端在上次同步完该文件之后对该文件执行过的操作记录,作为
第二记录数据;接收模块接收服务器发送的第一记录数据,终端无需与服务器 进行多次交互,也无需逐层遍历服务器上的文件目录,而且第一记录数据由一 些操作记录组成,与该文件的整个目录结构相比,数据量较小,传输时不仅节 约时间,还可減少用户的网络资源消耗。执行模块可在根据第一记录数据和第 二记录数据得到终端应执行的操作之前,可先将第一记录数据进行拆分合并, 以減少冗余数据以及同步时的计算量,缓解终端的计算压力,同时提高同步效 率。
请参阅图 9 ,图 9为本申请提供的终端的又一实施例的结构示意图。 如图 9所示,该终端可包括:输入装置 901、 输出装置 902和处理器 903。 在本申 请的一些实施例中,输入装置 901和处理器 903之间、 输出装置 902和处理器 903之间可以通过总线或其他方式连接,其中,图 9中以通过总线连接为例。
其中,输出装置 902 ,用于发送文件同步请求至服务器。
输入装置 901 ,用于接收所述服务器响应所述文件同步请求而发送的第一 记录数据,所述第一记录数据包括所述服务器保存的所述文件的各版本数据中 预定版本的所述文件在所述终端最近一次同步所述文件之后产生的操作记录。
处理器 903用于:
查找第二记录数据,所述第二记录数据包括所述终端在最近一次同步所述 文件之后对所述文件执行的操作记录;
根据所述第一记录数据和所述第二记录数据得到所述终端应执行的操作, 并执行所述操作。
作为一种可能的实施方式 ,处理器 903查找第二记录数据时,具体步骤为: 查找所述终端在最近一次同步所述文件之后对所述文件执行的每一条操 作记录;
按照操作路径拆分或合并所述每一条操作记录,得到所述第二记录数据。 作为一种可能的实施方式,所述第一记录数据包括至少一条操作记录; 所述处理器根据所述第一记录数据和所述第二记录数据得到所述终端应 执行的操作,并执行所述操作时,具体步骤为:
按照操作路径拆分或合并所述至少一条操作记录,以简化所述第一记录数 据;
根据简化后的第一记录数据和所述第二记录数据,得到所述终端应执行的 操作,并执行所述操作。
作为一种可能的实施方式,处理器 903还用于将所述第一记录数据中所述 文件的最高版本号记录为所述终端本次同步所述文件的版本号。
输出装置 902还用于发送所述终端的标识信息、所述终端本次同步所述文 件的版本号、 以及所述终端的用户标识至所述服务器,以使所述服务器更新所 述用户对所述终端的同步记录。
在图 9所描述的终端中,终端无需与服务器进行多次交互,且无需逐层遍 历服务器上的文件目录并与终端的文件目录进行对比,此外与该文件的整个目 录结构相比,在终端最近一次同步该文件的之后产生的操作记录数据量较小, 同步时不仅缩短数据传输时间,还可減少用户的网络资源消耗,从而提高同步 效率。
需要说明的是,对于前述的各个方法实施例,为了简单描述,故将其都表 述为一系列的动作组合,但是本领域技术人员应该知悉,本申请并不受所描述 的动作顺序的限制,因为依据本申请,某一些步骤可以采用其他顺序或者同时 进行。 其次,本领域技术人员也应该知悉,说明书中所描述的实施例均属于优 选实施例,所涉及的动作和模块并不一定是本申请所必须的。
在上述实施例中,对各个实施例的描述都各有侧重,某个实施例中没有详 细描述的部分,可以参见其他实施例的相关描述。
本领域普通技术人员可以理解上述实施例的各种方法中的全部或部分步 骤是可以通过程序来指令相关的硬件来完成,该程序可以存储于一计算机可读 存储介质中,存储介质可以包括:闪存盘、 只读存储器( Read-Only Memory , ROM 随机存取器( Random Access Memory , RAM 磁盘或光盘等。
以上对本申请实施例所提供的文件同步方法、服务器及终端进行了详细介 绍,本文中应用了具体个例对本申请的原理及实施方式进行了阐述,以上实施 例的说明只是用于帮助理解本申请的方法及其核心思想;同时,对于本领域的 一般技术人员,依据本申请的思想,在具体实施方式及应用范围上均会有改变 之处,综上所述,本说明书内容不应理解为对本申请的限制。
Claims
1、 一种文件同步方法,其特征在于,包括:
接收终端发送的文件同步请求;
响应所述文件同步请求,从服务器保存的所述文件的各版本数据中查找第 一记录数据,所述第一记录数据包括预定版本的所述文件在所述终端最近一次 同步所述文件之后产生的操作记录;
发送所述第一记录数据至所述终端,以使所述终端根据所述第一记录数据 及所述终端上的第二记录数据得到所述终端应执行的操作,所述第二记录数据 包括所述终端在最近一次同步所述文件之后对所述文件执行的操作记录。
2、 根据权利要求 1所述的方法,其特征在于,所述文件同步请求包括所 述终端最近一次同步所述文件的版本号以及本次同步的最高版本号;
所述第一记录数据包括预定版本的所述文件在所述终端最近一次同步所 述文件之后产生的全部操作记录,其中所述预定版本的版本号高于所述终端最 近一次同步所述文件的版本号,且低于或等于本次同步的最高版本号。
3、 根据权利要求 1所述的方法,其特征在于,所述文件同步请求包括所 述终端最近一次同步所述文件的版本号以及数量阈值;
所述第一记录数据包括预定版本的所述文件在所述终端最近一次同步所 述文件之后依次产生的预定数量的操作记录,其中所述预定版本的版本号高于 所述终端最近一次同步所述文件的版本号,所述预定数量的值等于所述数量阈 值。
4、 根据权利要求 1-3任一项所述的方法,其特征在于,所述发送所述第 一记录数据至所述终端之后,所述方法还包括:
接收所述终端发送的所述终端的标识信息、所述终端本次同步所述文件的 版本号、 以及所述终端的用户标识;
根据所述终端的标识信息、 所述终端本次同步所述文件的版本号、 以及所
述终端的用户标识,更新所述用户对所述终端的同步记录;
查询所述用户的其他终端最近一次同步所述文件的版本号;
若所述终端本次同步所述文件的版本号低于所述用户的其他终端最近一 次同步所述文件的版本号,则从所述服务器保存的所述文件的各版本数据中, 删除在接收所述文件同步请求之前产生的操作记录。
5、 一种文件同步方法,其特征在于,包括:
发送文件同步请求至服务器;
查找第二记录数据,所述第二记录数据包括终端在最近一次同步所述文件 之后对所述文件执行的操作记录;
接收所述服务器响应所述文件同步请求而发送的第一记录数据,所述第一 记录数据包括所述服务器保存的所述文件的各版本数据中预定版本的所述文 件在所述终端最近一次同步所述文件之后产生的操作记录;
根据所述第一记录数据和所述第二记录数据得到所述终端应执行的操作, 并执行所述操作。
6、 根据权利要求 5所述的方法,其特征在于,所述查找第二记录数据, 包括:
查找所述终端在最近一次同步所述文件之后对所述文件执行的每一条操 作记录;
按照操作路径拆分或合并所述每一条操作记录,得到所述第二记录数据。
7、 根据权利要求 5所述的方法,其特征在于,所述第一记录数据包括至 少一条操作记录;
所述根据所述第一记录数据和所述第二记录数据得到所述终端应执行的 操作,并执行所述操作,包括:
按照操作路径拆分或合并所述至少一条操作记录,以简化所述第一记录数 据;
根据简化后的第一记录数据和所述第二记录数据,得到所述终端应执行的
操作,并执行所述操作。
8、 根据权利要求 5-7任一项所述的方法,其特征在于,所述根据所述第 一记录数据和所述第二记录数据得到所述终端应执行的操作,并执行所述操作 之后,所述方法还包括:
将所述第一记录数据中所述文件的最高版本号记录为所述终端本次同步 所述文件的版本号;
发送所述终端的标识信息、 所述终端本次同步所述文件的版本号、 以及所 述终端的用户标识至所述服务器,以使所述服务器更新所述用户对所述终端的 同步记录。
9、 一种服务器,其特征在于,包括:
第一接收模块,用于接收终端发送的文件同步请求;
查找模块,用于响应所述文件同步请求,从服务器保存的所述文件的各版 本数据中查找第一记录数据,所述第一记录数据包括预定版本的所述文件在所 述终端最近一次同步所述文件之后产生的操作记录;
发送模块,用于发送所述第一记录数据至所述终端,以使所述终端根据所 述第一记录数据及所述终端上的第二记录数据得到所述终端应执行的操作,所 述第二记录数据包括所述终端在最近一次同步所述文件之后对所述文件执行 的操作记录。
10、 根据权利要求 9所述的服务器,其特征在于,所述文件同步请求包括 所述终端最近一次同步所述文件的版本号以及本次同步的最高版本号;
所述第一记录数据包括预定版本的所述文件在所述终端最近一次同步所 述文件之后产生的全部操作记录,其中所述预定版本的版本号高于所述终端最 近一次同步所述文件的版本号,且低于或等于本次同步的最高版本号。
11、 根据权利要求 9所述的服务器,其特征在于,所述文件同步请求包括 所述终端最近一次同步所述文件的版本号以及数量阈值;
所述第一记录数据包括预定版本的所述文件在所述终端最近一次同步所 述文件之后依次产生的预定数量的操作记录,其中所述预定版本的版本号高于 所述终端最近一次同步所述文件的版本号,所述预定数量的值等于所述数量阈 值。
12、 根据权利要求 9-11任一项所述的服务器,其特征在于,所述服务器 还包括:
第二接收模块,用于接收所述终端发送的所述终端的标识信息、 所述终端 本次同步所述文件的版本号、 以及所述终端的用户标识;
更新模块,用于根据所述终端的标识信息、 所述终端本次同步所述文件的 版本号、 以及所述终端的用户标识,更新所述用户对所述终端的同步记录; 查询模块,用于查询所述用户的其他终端最近一次同步所述文件的版本 删除模块,用于在所述终端本次同步所述文件的版本号低于所述用户的其 他终端最近一次同步所述文件的版本号时,从所述服务器保存的所述文件的各 版本数据中删除在接收所述文件同步请求的之前产生的操作记录。
13、 一种计算机存储介质,其特征在于,
所述计算机存储介质存储有程序,执行所述程序时包括如权利要求 1至 4 任一项所述的步骤。
14、 一种服务器,其特征在于,包括:输入装置、 输出装置和处理器,所 述输入装置、 所述输出装置和所述处理器通过总线相连接,其中:
所述输入装置,用于接收终端发送的文件同步请求;
所述处理器,响应所述文件同步请求,从服务器保存的所述文件的各版本 数据中查找第一记录数据,所述第一记录数据包括预定版本的所述文件在所述 终端最近一次同步所述文件之后产生的操作记录;
所述输出装置,用于发送所述第一记录数据至所述终端,以使所述终端根 据所述第一记录数据及所述终端上的第二记录数据得到所述终端应执行的操
作,所述第二记录数据包括所述终端在最近一次同步所述文件之后对所述文件 执行的操作记录。
15、 根据权利要求 14所述的服务器,其特征在于,所述文件同步请求包 括所述终端最近一次同步所述文件的版本号以及本次同步的最高版本号; 所述第一记录数据包括预定版本的所述文件在所述终端最近一次同步所 述文件之后产生的全部操作记录,其中所述预定版本的版本号高于所述终端最 近一次同步所述文件的版本号,且低于或等于本次同步的最高版本号。
16、 根据权利要求 14所述的服务器,其特征在于,所述文件同步请求包 括所述终端最近一次同步所述文件的版本号以及数量阈值;
所述第一记录数据包括预定版本的所述文件在所述终端最近一次同步所 述文件之后依次产生的预定数量的操作记录,其中所述预定版本的版本号高于 所述终端最近一次同步所述文件的版本号,所述预定数量的值等于所述数量阈 值。
17、 根据权利要求 14-16任一项所述的服务器,其特征在于,
所述输入装置,还用于接收所述终端发送的所述终端的标识信息、 所述终 端本次同步所述文件的版本号、 以及所述终端的用户标识;
所述处理器还用于:
根据所述终端的标识信息、 所述终端本次同步所述文件的版本号、 以及所 述终端的用户标识,更新所述用户对所述终端的同步记录;
查询所述用户的其他终端最近一次同步所述文件的版本号;
若所述终端本次同步所述文件的版本号低于所述用户的其他终端最近一 次同步所述文件的版本号,则从所述服务器保存的所述文件的各版本数据中, 删除在接收所述文件同步请求之前产生的操作记录。
18、 一种终端,其特征在于,包括:
第一发送模块,用于发送文件同步请求至服务器
查找模块,用于查找第二记录数据,所述第二记录数据包括终端在最近一 次同步所述文件之后对所述文件执行的操作记录;
接收模块,用于接收所述服务器响应所述文件同步请求而发送的第一记录 数据,所述第一记录数据包括所述服务器保存的所述文件的各版本数据中预定 版本的所述文件在所述终端最近一次同步所述文件之后产生的操作记录; 执行模块,用于根据所述第一记录数据和所述第二记录数据得到所述终端 应执行的操作,并执行所述操作。
19、 根据权利要求 18所述的终端,其特征在于,所述查找模块,包括: 查找单元,用于查找所述终端在最近一次同步所述文件之后对所述文件执 行的每一条操作记录;
第一简化单元,用于按照操作路径拆分或合并所述每一条操作记录,得到 所述第二记录数据。
20、 根据权利要求 18所述的终端,其特征在于,所述第一记录数据包括 至少一条操作记录;
所述执行模块,包括:
第二简化单元,用于按照操作路径拆分或合并所述至少一条操作记录,以 简化所述第一记录数据;
执行单元,用于根据简化后的第一记录数据和所述第二记录数据,得到所 述终端应执行的操作,并执行所述操作。
21、 根据权利要求 18-20任一项所述的终端,其特征在于,所述终端还包 括:
记录模块,用于将所述第一记录数据中所述文件的最高版本号记录为所述 终端本次同步所述文件的版本号;
第二发送模块,用于发送所述终端的标识信息、 所述终端本次同步所述文 件的版本号、 以及所述终端的用户标识至所述服务器,以使所述服务器更新所 述用户对所述终端的同步记录。
22、 一种计算机存储介质,其特征在于,
所述计算机存储介质存储有程序,执行所述程序时包括如权利要求 5至 8 任一项所述的步骤。
23、 一种终端,其特征在于,包括:输入装置、 输出装置和处理器,所 述输入装置、 所述输出装置和所述处理器通过总线相连接,其中:
所述输出装置,用于发送文件同步请求至服务器;
所述输入装置,用于接收所述服务器响应所述文件同步请求而发送的第一 记录数据,所述第一记录数据包括所述服务器保存的所述文件的各版本数据中 预定版本的所述文件在所述终端最近一次同步所述文件之后产生的操作记录; 所述处理器用于:
查找第二记录数据,所述第二记录数据包括所述终端在最近一次同步所述 文件之后对所述文件执行的操作记录;
根据所述第一记录数据和所述第二记录数据得到所述终端应执行的操作, 并执行所述操作。
24、 根据权利要求 23所述的终端,其特征在于,所述处理器查找第二记 录数据时,具体步骤为:
查找所述终端在最近一次同步所述文件之后对所述文件执行的每一条操 作记录;
按照操作路径拆分或合并所述每一条操作记录,得到所述第二记录数据。
25、 根据权利要求 23所述的终端,其特征在于,所述第一记录数据包括 至少一条操作记录;
所述处理器根据所述第一记录数据和所述第二记录数据得到所述终端应 执行的操作,并执行所述操作时,具体步骤为:
按照操作路径拆分或合并所述至少一条操作记录,以简化所述第一记录数 据;
根据简化后的第一记录数据和所述第二记录数据,得到所述终端应执行的 操作,并执行所述操作。
26、 根据权利要求 23-25任一项所述的终端,其特征在于,
所述处理器,还用于将所述第一记录数据中所述文件的最高版本号记录为 所述终端本次同步所述文件的版本号;
所述输出装置,还用于发送所述终端的标识信息、 所述终端本次同步所述 文件的版本号、 以及所述终端的用户标识至所述服务器,以使所述服务器更新 所述用户对所述终端的同步记录。
Priority Applications (4)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
PCT/CN2014/075349 WO2015157904A1 (zh) | 2014-04-15 | 2014-04-15 | 一种文件同步方法、服务器及终端 |
EP14889469.4A EP3125501B1 (en) | 2014-04-15 | 2014-04-15 | File synchronization method, server, and terminal |
CN201480001814.5A CN104488248B (zh) | 2014-04-15 | 2014-04-15 | 一种文件同步方法、服务器及终端 |
US15/293,828 US20170031948A1 (en) | 2014-04-15 | 2016-10-14 | File synchronization method, server, and terminal |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
PCT/CN2014/075349 WO2015157904A1 (zh) | 2014-04-15 | 2014-04-15 | 一种文件同步方法、服务器及终端 |
Related Child Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
US15/293,828 Continuation US20170031948A1 (en) | 2014-04-15 | 2016-10-14 | File synchronization method, server, and terminal |
Publications (1)
Publication Number | Publication Date |
---|---|
WO2015157904A1 true WO2015157904A1 (zh) | 2015-10-22 |
Family
ID=52761440
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
PCT/CN2014/075349 WO2015157904A1 (zh) | 2014-04-15 | 2014-04-15 | 一种文件同步方法、服务器及终端 |
Country Status (4)
Country | Link |
---|---|
US (1) | US20170031948A1 (zh) |
EP (1) | EP3125501B1 (zh) |
CN (1) | CN104488248B (zh) |
WO (1) | WO2015157904A1 (zh) |
Families Citing this family (12)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JP6046665B2 (ja) * | 2014-06-10 | 2016-12-21 | トヨタ自動車株式会社 | 断熱膜の形成方法および断熱膜 |
CN104834749A (zh) * | 2015-05-27 | 2015-08-12 | 惠州Tcl移动通信有限公司 | 一种移动终端与pc端的文件同步方法及同步*** |
CN110572437A (zh) * | 2016-03-01 | 2019-12-13 | 张君 | 客户端与服务端在网与离网状态下数据交互方法、*** |
CN106101275A (zh) * | 2016-08-10 | 2016-11-09 | 东方网力科技股份有限公司 | 一种数据同步方法和主动方 |
CN109688176B (zh) * | 2017-10-18 | 2022-01-11 | 腾讯科技(深圳)有限公司 | 一种文件同步方法及终端、网络设备、存储介质 |
CN107798086B (zh) * | 2017-10-19 | 2021-07-23 | 福建中金在线信息科技有限公司 | 服务器信息更新方法、装置、***及电子设备 |
CN108259562B (zh) * | 2017-12-11 | 2022-02-25 | 杭州品茗安控信息技术股份有限公司 | 一种基于多端点的数据同步方法及装置 |
CN109840160A (zh) * | 2019-01-03 | 2019-06-04 | 深圳壹账通智能科技有限公司 | 一种基于数据迁移的异常供数检测方法、装置及终端设备 |
CN112416924A (zh) * | 2019-08-22 | 2021-02-26 | 富泰华工业(深圳)有限公司 | 数据同步查询方法、装置、计算机装置及存储介质 |
CN113704212A (zh) * | 2020-05-22 | 2021-11-26 | 深信服科技股份有限公司 | 服务器的数据同步方法、装置、设备及计算机存储介质 |
CN112035577B (zh) * | 2020-11-04 | 2021-02-02 | 华自科技股份有限公司 | 一种数据同步方法及数据同步*** |
CN113633981A (zh) * | 2021-08-12 | 2021-11-12 | 网易(杭州)网络有限公司 | 游戏应用中地图数据同步的方法、装置、设备及存储介质 |
Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20050138082A1 (en) * | 2003-12-18 | 2005-06-23 | Capricode Oy Et Al. | Method, data transfer arrangement, server and terminal device for updating information in a terminal device |
CN102404338A (zh) * | 2011-12-13 | 2012-04-04 | 华为技术有限公司 | 一种文件同步方法和装置 |
CN103220358A (zh) * | 2013-04-19 | 2013-07-24 | 李晶 | 一种多终端在线文件同步方法、***、服务器及终端设备 |
CN103457905A (zh) * | 2012-05-28 | 2013-12-18 | 腾讯科技(深圳)有限公司 | 数据同步方法、***及设备 |
CN103685385A (zh) * | 2012-09-12 | 2014-03-26 | ***通信集团公司 | 一种文件同步的方法、***和装置 |
Family Cites Families (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US9191443B2 (en) * | 1999-12-02 | 2015-11-17 | Western Digital Technologies, Inc. | Managed peer-to-peer applications, systems and methods for distributed data access and storage |
EP1130511A3 (en) * | 2000-01-25 | 2004-04-07 | FusionOne, Inc. | Data transfer and synchronization system |
US7228319B1 (en) * | 2002-12-30 | 2007-06-05 | Sap Aktiengesellschaft | File comparison of locally synched files |
US9244960B2 (en) * | 2013-03-15 | 2016-01-26 | International Business Machines Corporation | Metadata-driven version management service in pervasive environment |
-
2014
- 2014-04-15 EP EP14889469.4A patent/EP3125501B1/en active Active
- 2014-04-15 CN CN201480001814.5A patent/CN104488248B/zh active Active
- 2014-04-15 WO PCT/CN2014/075349 patent/WO2015157904A1/zh active Application Filing
-
2016
- 2016-10-14 US US15/293,828 patent/US20170031948A1/en not_active Abandoned
Patent Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20050138082A1 (en) * | 2003-12-18 | 2005-06-23 | Capricode Oy Et Al. | Method, data transfer arrangement, server and terminal device for updating information in a terminal device |
CN102404338A (zh) * | 2011-12-13 | 2012-04-04 | 华为技术有限公司 | 一种文件同步方法和装置 |
CN103457905A (zh) * | 2012-05-28 | 2013-12-18 | 腾讯科技(深圳)有限公司 | 数据同步方法、***及设备 |
CN103685385A (zh) * | 2012-09-12 | 2014-03-26 | ***通信集团公司 | 一种文件同步的方法、***和装置 |
CN103220358A (zh) * | 2013-04-19 | 2013-07-24 | 李晶 | 一种多终端在线文件同步方法、***、服务器及终端设备 |
Also Published As
Publication number | Publication date |
---|---|
EP3125501A4 (en) | 2017-04-05 |
CN104488248B (zh) | 2017-09-08 |
EP3125501A1 (en) | 2017-02-01 |
CN104488248A (zh) | 2015-04-01 |
US20170031948A1 (en) | 2017-02-02 |
EP3125501B1 (en) | 2018-08-22 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
WO2015157904A1 (zh) | 一种文件同步方法、服务器及终端 | |
US11809726B2 (en) | Distributed storage method and device | |
US20170161297A1 (en) | Data synchronization in a storage network | |
WO2018219178A1 (zh) | 数据同步方法、装置、服务器及存储介质 | |
WO2017162032A1 (zh) | 执行数据恢复操作的方法及装置 | |
CN101808127B (zh) | 数据备份方法、***和服务器 | |
WO2015117426A1 (zh) | 文件管理方法及装置 | |
CN110209642A (zh) | 信息处理的方法、装置、服务器及计算机可读介质 | |
WO2013177925A1 (zh) | 数据同步方法、***及设备 | |
US20150177999A1 (en) | Storage network data retrieval | |
WO2014059804A1 (zh) | 数据同步方法及*** | |
CN103986776A (zh) | 一种路由器及基于路由器的下载方法 | |
US20150227605A1 (en) | Information processing terminal, synchronization control method, and computer-readable recording medium | |
CN103902410A (zh) | 云存储***的数据备份加速方法 | |
US20170054803A1 (en) | Information processing device, method, and system | |
CN112003943A (zh) | 语音数据同步方法和装置 | |
WO2013078611A1 (zh) | 分布式存储***中的数据处理方法及设备、客户端 | |
CN106686117B (zh) | 一种分布式计算集群的数据存储处理***及方法 | |
JP2016530656A (ja) | 分散型ディザスタリカバリファイル同期サーバシステム | |
CN103607429A (zh) | 云计算业务实现方法和*** | |
CN104063377A (zh) | 信息处理方法和使用其的电子设备 | |
KR20160026138A (ko) | 클라우드 데이터 시스템의 급속 동기화 방법 및 그를 이용한 클라우드 데이터 시스템 | |
US10853892B2 (en) | Social networking relationships processing method, system, and storage medium | |
CN111176904B (zh) | 一种私有云架构下的数据备份的方法、***、设备及介质 | |
CN104754007A (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: 14889469 Country of ref document: EP Kind code of ref document: A1 |
|
NENP | Non-entry into the national phase |
Ref country code: DE |
|
REEP | Request for entry into the european phase |
Ref document number: 2014889469 Country of ref document: EP |
|
WWE | Wipo information: entry into national phase |
Ref document number: 2014889469 Country of ref document: EP |