Remote file differential transmission and iteration method and device
By using the index file of the target compressed package to directly locate and transfer the compressed data of the target file during software and service iteration, the problems of high CPU resource consumption and mount point list access bottlenecks are solved, and efficient iterative updates are achieved.
Patent Information
- Application Number
- CN202511368695.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-09-24
- Publication Date
- 2025-10-28
- Estimated Expiration
- 2045-09-24
AI Technical Summary
Existing technologies consume high CPU resources and are inefficient during software and service iteration, and accessing the mount point list becomes a performance bottleneck.
By utilizing the index file in the target compressed package, the compressed data of the target file is extracted from the target compressed package and sent to the client. The client decompresses the data based on the index table to achieve iterative updates, thus avoiding the use of decompressing the target compressed package and mounting the file system.
It reduces CPU resource consumption, improves transmission efficiency, and avoids performance issues caused by accessing the mount point list.
Smart Images

Figure CN120849355A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of computers, and in particular to a method and apparatus for remote file differential transmission and iteration. Background Technology
[0002] With the development of internet technology, rapid iteration of software and services has become the norm. During iteration, the Archivemount tool can be used on the server to mount the compressed package of the new version of the software / service to a specific directory via the fuse file system. Then, the rsync tool compares the list of compressed package files in the specific directory on the server with the file list on the terminal to identify the difference file and download it to the terminal. On the one hand, since compressed packages usually do not have file location capabilities, when a difference file needs to be downloaded, the Archivemount tool will decompress the entire compressed package from the beginning until it finds the difference file, instead of directly locating it. This results in high CPU resource consumption and low efficiency. On the other hand, since the Archivemount tool mounts the compressed package of the new version of the software to a specific directory via the fuse file system, the corresponding mount point needs to be added to the mount point list. When there are multiple difference files being downloaded simultaneously, the file system's access to the mount point list can also become a performance bottleneck.
[0003] In view of this, how to provide an iterative solution applicable to software and services that can reduce CPU resource consumption and improve efficiency has become an urgent technical problem to be solved. Summary of the Invention
[0004] To address the technical problems existing in the prior art, embodiments of this application provide a remote file differential transmission and iteration method and apparatus.
[0005] In a first aspect, embodiments of this application provide a remote file differential transmission method, applied to a server, comprising: The system receives the hash value of at least one file in a specific directory transmitted by the client, reads the index file in the target compressed package, traverses the information of each file in the index file, obtains the hash value of the current file from the index file, and if it is determined that the hash value of the current file is different from the hash values of each file in the at least one file, and the hash value of the current file is different from the hash values of the files that have been traversed, then obtains the compressed data size of the current file from the index file. The index file contains the file name, hash value, compressed data size, and offset position of the compressed data in the target compressed package for each file in the target compressed package. The target file header is determined based on the size of the compressed data of each file, and the target file header and the index table in the target compressed package are sent to the client. For each target file, the compressed data of the target file is determined based on the offset position of the compressed data of the target file in the target compressed package, and the compressed data of the target file is sent to the client. The target file includes the file whose compressed data size was obtained during the traversal. The target file end and at least a portion of the data in the index file are sent to the client, wherein the at least a portion of the data includes the filename and hash value.
[0006] Secondly, embodiments of this application also provide a remote file differential iteration method, applied to a client, including: Receive the target file header and index table sent by the server; Receive compressed data of target files sent by the server. The target files include files in the target compressed package whose hash values are different from the hash values of each file in at least one file in a specific directory of the client. Different target files have different hash values. The server receives the end of the target file and at least a portion of the data in the index file of the target compressed package, wherein the at least a portion of the data includes the filename and hash value; The compressed data of the target file is decompressed to the target directory using the index table. The information of each file in the index file is traversed. If the hash value of the current file is different from the hash values of each file in the at least one of the index files, and the hash value of the current file is different from the hash values of the files that have been traversed, then the file is skipped.
[0007] Thirdly, embodiments of this application also provide a remote file differential transmission device, applied on a server side, comprising: The acquisition unit is used to receive the hash value of at least one file in a specific directory transmitted by the client, read the index file in the target compressed package, traverse the information of each file in the index file, obtain the hash value of the current file from the index file, and if it is determined that the hash value of the current file is different from the hash values of each file in the at least one file, and the hash value of the current file is different from the hash values of the files that have been traversed, then obtain the compressed data size of the current file from the index file. The index file contains the file name, hash value, compressed data size and offset position of the compressed data in the target compressed package for each file in the target compressed package. The sending unit is used to determine the target file header based on the size of the compressed data of each acquired file, and send the target file header and the index table in the target compressed package to the client; and For each target file, the compressed data of that target file is determined based on its offset position within the target compressed archive, and this compressed data is then sent to the client. The target files include those whose compressed data size was obtained during the traversal process; and... The target file end and at least a portion of the data in the index file are sent to the client, wherein the at least a portion of the data includes the filename and hash value.
[0008] Fourthly, embodiments of this application also provide a remote file differential iteration device, applied to a client, comprising: The receiving unit is used to receive the target file header and index table sent by the server; and Receive compressed data of target files sent by the server, wherein the target files include files in the target compressed package whose hash values are different from the hash values of all files in at least one file in a specific directory of the client, and different target files have different hash values; and The server receives the end of the target file and at least a portion of the data in the index file of the target compressed package, wherein the at least a portion of the data includes the filename and hash value; The decompression unit is used to decompress the compressed data of the target file to the target directory using the index table, and to traverse the information of each file in the index file. If the hash value of the current file is different from the hash values of each file in the at least one file, and the hash value of the current file is different from the hash values of the files that have been traversed, then it is skipped.
[0009] In summary, the remote file differential transmission and iteration method and apparatus provided in this application extracts the compressed data of the target file from the target compressed package using an index file in the target compressed package, and sends the compressed data of the target file and at least part of the data in the index file to the client. After receiving the data, the client can decompress the compressed data to achieve iterative updates of the software / service. Compared with the prior art, the entire solution can directly locate the data to be downloaded in the target compressed package without decompressing the target compressed package, and does not mount a file system, thus avoiding the performance problems caused by accessing the mount point list. Therefore, it can reduce CPU resource consumption and improve efficiency. Attached Figure Description
[0010] Figure 1 This is a flowchart illustrating an embodiment of a remote file differential transmission method provided in this application. Figure 2 A flowchart illustrating an embodiment of a remote file differential iteration method provided in this application; Figure 3 This is a schematic diagram of an embodiment of a remote file differential transmission device provided in this application. Figure 4 This is a schematic diagram of an embodiment of a remote file differential iteration device provided in this application. Detailed Implementation
[0011] To make the objectives, technical solutions, and advantages of the embodiments of this application clearer, the technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. It should be understood that the accompanying drawings in this application are for illustrative and descriptive purposes only and are not intended to limit the scope of protection of this application. Furthermore, it should be understood that the schematic drawings are not drawn to scale. The flowcharts used in this application illustrate operations implemented according to some embodiments of this application. It should be understood that the operations in the flowcharts may not be implemented in sequence, and steps without logical contextual relationships may be reversed or implemented simultaneously. In addition, those skilled in the art, guided by the content of this application, may add one or more other operations to the flowcharts, or remove one or more operations from the flowcharts.
[0012] Furthermore, the described embodiments are merely some, not all, of the embodiments of this application. The components of the embodiments of this application described and illustrated herein can typically be arranged and designed in various different configurations. Therefore, the following detailed description of the embodiments of this application provided in the accompanying drawings is not intended to limit the scope of the claimed application, but merely to illustrate selected embodiments of the application. All other embodiments obtained by those skilled in the art based on the embodiments of this application without inventive effort are within the scope of protection of this application.
[0013] It should be noted that the term "comprising" will be used in the embodiments of this application to indicate the presence of the features declared thereafter, but does not exclude the addition of other features.
[0014] Reference Figure 1 As shown in the figure, this application provides a flowchart of a remote file differential transmission method, which is applied to a server and includes: S10. Receive the hash value of at least one file in a specific directory transmitted by the client, read the index file in the target compressed package, traverse the information of each file in the index file, obtain the hash value of the current file from the index file, if it is determined that the hash value of the current file is different from the hash values of each file in the at least one file, and the hash value of the current file is different from the hash values of the files that have been traversed, then obtain the compressed data size of the current file from the index file, wherein the index file contains the file name, hash value, compressed data size, and offset position of the compressed data in the target compressed package for each file in the target compressed package; In this embodiment, it should be noted that the index file is pre-generated and compressed into the target compressed package, and the compression algorithm used can be the same as the compression algorithm used to generate the target compressed package. The index file contains the filename, hash value, compressed data size, and offset position of the compressed data in the target compressed package for each ordinary file in the target compressed package. In addition, it may also contain the filename, hash value, compressed data size, and offset position of the compressed data in the target compressed package for each special file and folder in the target compressed package. Ordinary files refer to files that actually store file data content on the disk, while special files refer to files that do not store file data content on the disk. The files described in this embodiment all refer to ordinary files. For special files and folders in the target compressed package, since their compressed data is small, the compressed data can be directly extracted from the target compressed package and sent to the client for decompression to update the special files and folders in the target directory. The file / folder filename may include the relative path of the file / folder to the target compressed package. When reading the index file in the target compressed package, it can be read directly without decompressing the target compressed package. When traversing the information of files in the index file, if the hash value of the current file is different from the hash values of each file in at least one file in the specific directory transmitted by the client, and the hash value of the current file is different from the hash values of the files that have been traversed, then the compressed data size of the current file is obtained from the index file, and finally the compressed data size of at least one file is obtained. These files are the files that need to be transmitted to the client with compressed data, which is the target file mentioned in step S12.
[0015] S11. Determine the target file header based on the size of the compressed data of each file, and send the target file header and the index table in the target compressed package to the client; In this embodiment, it should be noted that after obtaining at least one compressed data size in step S10, the size of the new compressed package needs to be calculated based on these compressed data sizes. A target file header is then generated based on the new compressed package size. This target file header is the header of the new compressed package and contains the size of the new compressed package. The target file header (fixed size), the index table (which is the index table in the target compressed package), the compressed data to be transmitted to the client, and the target file footer (fixed size) constitute the new compressed package. The total size of the contents included in the new compressed package is the size of the new compressed package. This new compressed package needs to be transmitted to the client. When transmitting the new compressed package, the target file header and index table can be transmitted first, followed by the compressed data, and finally the target file footer, following a streaming transmission method.
[0016] S12. For each target file, determine the compressed data of the target file according to the offset position of the compressed data of the target file in the target compressed package, and send the compressed data of the target file to the client. The target file includes the file whose compressed data size was obtained during the traversal. In this embodiment, it should be noted that the target file in step S12 is the file whose compressed data needs to be transmitted to the client. The compressed data of the target file needs to be determined based on the offset position of the compressed data of the target file in the target compressed package within the index file. The compressed data of the target file is not necessarily the compressed data of the target file in the target compressed package: if the target file is independently compressed (i.e., the data of the target file is not merged with the data of other files / folders), then the compressed data of the target file is the compressed data of the target file in the target compressed package; if the target file is not independently compressed (i.e., the data of the target file is merged with the data of other files / folders), then the compressed data of the target file is not the compressed data of the target file in the target compressed package. In this case, the compressed data of the target file includes the independently compressed data of the target file in the index file and the independently compressed data of the target file in the target compressed package. For example, the compressed data of target file A in the target compressed package includes three parts: I1, I2, and I3. I1 is the merged data of part N of file B in the target compressed package and part M1 of file A. The compressed data is as follows: I1 represents the non-independent compressed data portion of target file A in the target compressed package; I2 and I3 are obtained by compressing partial data M2 and partial data M3 of target file A, respectively; I2 and I3 are the independent compressed data portions of target file A in the target compressed package; M1, M2, and M3 constitute the complete data of target file A; the index file contains I11 and M1, where I11 is the compressed data obtained by compressing M1, that is, I11 is the independent compressed data of the data source M1 of target file A. Therefore, the final compressed data of target file A is determined. The index file contains compressed data I11, I2, and I3 of part of the target file A, including M1. The index file also includes the offset positions of I1, I2, and I3 in the target compressed package. Thus, I1, I2, and I3 can be extracted from the target compressed package based on their offset positions. Then, I11 corresponding to M1 can be determined from the index file. Finally, I11, I2, and I3 are determined to be the compressed data of the target file A (i.e., the compressed data of the target file A to be sent to the client).
[0017] S13. Send the end of the target file and at least a portion of the data in the index file to the client, wherein the at least a portion of the data includes the filename and hash value.
[0018] In this embodiment, it should be noted that sending the filename and hash value from the index file to the client is to enable the client to check whether there is a file in at least one file in the specific directory whose hash value is different from the hash value sent by the server. This is because if there is a file whose hash value is different from the hash value sent by the server, it is necessary to ensure that such a file does not exist in the updated target directory.
[0019] The remote file differential transmission method provided in this application uses an index file in the target compressed package to extract the compressed data of the target file from the target compressed package, and sends the compressed data of the target file and at least part of the data in the index file to the client so that the client can decompress the compressed data to achieve iterative updates of software / services. Compared with the prior art, the whole solution can directly locate the data to be downloaded in the target compressed package without decompressing the target compressed package, and does not mount a file system, thus avoiding the performance problems caused by accessing the mount point list. Therefore, it can reduce CPU resource consumption and improve efficiency.
[0020] Based on the foregoing method embodiments, determining the compressed data of the target file according to the offset position of the compressed data of the target file in the target compressed package may include: If the compressed data of the target file in the target archive is independent compressed data, then the compressed data of the target file is directly extracted from the target archive based on its offset position within the target archive; or If the compressed data of the target file in the target archive is not independent compressed data, then the independent compressed data corresponding to the non-independent compressed data part of the target file in the target archive is obtained from the index file. Based on the offset position of the compressed data of the target file in the target archive, the independent compressed data part of the target file in the target archive is directly extracted from the target archive. The independent compressed data obtained from the index file and the independent compressed data part of the target file in the target archive are combined to obtain the compressed data of the target file. The index file also includes the independent compressed data corresponding to the non-independent compressed data part and the source data.
[0021] In this embodiment, it should be noted that if the compressed data of the target file in the target compressed package is independent compressed data, the compressed data of the target file can be directly extracted from the target compressed package according to the offset position of the compressed data of the target file in the target compressed package. For example, the compressed data of the target file C in the target compressed package includes two parts, I4 and I5. I4 and I5 are obtained by compressing part data M4 and part data M5 of the target file C, respectively. M4 and M5 constitute all the data of the target file C. Then, I4 and I5 can be directly extracted from the target compressed package according to the offset position of I4 and I5 in the target compressed package contained in the index file.
[0022] If the compressed data of the target file in the target archive is not independent compressed data, then it is necessary to obtain the independent compressed data corresponding to the non-independent compressed data part of the target file in the target archive from the index file. Based on the offset position of the compressed data of the target file in the target archive, the independent compressed data part of the target file in the target archive is directly extracted from the target archive. The independent compressed data obtained from the index file and the independent compressed data part extracted from the target archive are combined to obtain the compressed data of the target file. For example, for the target file A in the previous example, it is necessary to obtain the independent compressed data I11 corresponding to the non-independent compressed data part I1 of the target file A in the target archive from the index file. Based on the offset positions of I2 and I3 in the target archive, the independent compressed data parts I2 and I3 of the target file A in the target archive are directly extracted from the target archive. The compressed data of the target file A, that is, the compressed data of the target file A to be sent to the client, is obtained by combining I11, I2 and I3.
[0023] Based on the foregoing method embodiments, before reading the index file in the target compressed package, the method may further include: The target compressed package is decompressed to obtain the decompression result, which contains multiple items; Generate an index file. For each of the multiple items, obtain the information of that item and save the information of that item to the index file. The information of that item includes the file name corresponding to that item, the hash value of that item, the size of the compressed data of that item, and the offset position of the compressed data in the target compressed package. Compress the index file into the target compressed package.
[0024] In this embodiment, it should be noted that this embodiment describes the process of creating an index file. This process needs to be executed beforehand and requires decompressing the target compressed package once. Subsequent client-server interactions and iterative updates do not require further decompression of the target compressed package. The decompression result of the target compressed package can be a file (such as a tar archive) or a folder. If the decompression result is a file, the information of each item in that file needs to be obtained and saved into the index file. If the decompression result is a folder (each file / folder in the folder is an item), the information of each file / folder in that folder needs to be obtained and saved into the index file. The information of each item includes the filename corresponding to the item, the hash value of the item, the size of the compressed data of the item, and the offset position of the compressed data in the target compressed package. The size of the compressed data of the item is the size of the compressed data of the file corresponding to the item that needs to be sent to the client. For example, for the target file A in the previous example, the size of the compressed data of target file A is the total size of I11, I2, and I3. The offset position of compressed data within the target compressed archive refers to the offset position of the compressed data in the file / folder corresponding to that item within the target compressed archive. For example, for target file A in the previous example, the offset position of the compressed data of target file A within the target compressed archive includes the offset positions of I1, I2, and I3 within the target compressed archive. In addition to the filename, hash value, compressed data size, and offset position of the compressed data within the target compressed archive, the index file can also contain the independent compressed data and source data corresponding to the non-independent compressed data portion of the corresponding file / folder. For example, for target file A in the previous example, the index file can also contain the independent compressed data I11 corresponding to the non-independent compressed data portion I1 of target file A, as well as the source data M1. It should be noted that if the index table contains a correspondence between independent compressed data and source data, this correspondence can be used directly. However, if the index table does not contain a correspondence between independent compressed data and source data, this correspondence needs to be constructed, and the construction of this correspondence must ensure that it does not conflict with the original correspondence in the index table. In addition to the above, the index file can also contain the file mode (FileMode), file owner user ID (FileUid), file owner group ID (FileGid), file modification time (FileModifyTime), and file device number (FileDev) for the corresponding file / folder. Furthermore, when compressing the index file, it can be placed at the end of the target archive. In some cases, the decompression of the target archive (such as the decompression of a tar.gz format archive by the Linux tar program) can automatically skip the index file, thus eliminating the need to modify the original decompression program code.
[0025] Reference Figure 2 As shown in the figure, this application embodiment provides a flowchart of a remote file differential iteration method, which is applied to a client and includes: S20. Receive the target file header and index table sent by the server; In this embodiment, it should be noted that the target file header contains the size of the compressed package sent by the server. After receiving the target file header, the client can assess whether there is enough storage space to store the compressed package data sent by the server based on the size of the compressed package, and then take corresponding measures.
[0026] S21. Receive compressed data of target files sent by the server, wherein the target files include files in the target compressed package whose hash values are different from the hash values of each file in at least one file in a specific directory of the client, and different target files have different hash values; In this embodiment, it should be noted that the target file is a file that exists in the target compressed package but does not exist in at least one file in a specific directory of the client, and different target files have different hash values. In this way, the file generated after the compressed data received by the client is decompressed will not have the same content as the file in at least one file in the specific directory, and the content of the file decompressed by the client will not be duplicated, so that the client can complete the iterative update of the software / service with the minimum amount of data downloaded.
[0027] S22. Receive the target file tail sent by the server, and at least part of the data in the index file of the target compressed package, wherein the at least part of the data includes the file name and hash value; S23. Use the index table to decompress the compressed data of the target file to the target directory, and traverse the information of each file in the index file. If the hash value of the current file is different from the hash values of each file in the at least one file, and the hash value of the current file is different from the hash values of the files that have been traversed, then skip it.
[0028] In this embodiment, it should be noted that the target file header, index table, compressed target file data, and target file footer received by the client logically constitute a new compressed package. After receiving the compressed target file data, the client can use the index table to decompress the compressed target file data to the target directory.
[0029] If the target directory is the specific directory, the compressed data needs to be decompressed to the corresponding path under the specific directory (the relative path of this path can be the relative path of the file corresponding to the compressed data), and the information of each file in the index file needs to be traversed: if the hash value of the current file is different from the hash values of all files in the at least one of the aforementioned files, and the hash value of the current file is different from the hash values of all files that have been traversed, then skip it; if the hash value of the current file is different from the hash values of all files in the at least one of the aforementioned files, and the hash value of the current file is the same as the hash value of a file that has been traversed, then the content of the current file needs to be created in the specific directory based on the relative path of the current file, or the content of an existing file (the relative path of the existing file is the same as the relative path of the current file) needs to be modified (the modified content of the existing file becomes the current file), and the content of the current file needs to be the same as the content of the file that has been traversed and whose hash value is the same as the hash value of the current file (for example, copying the content of the file that has been traversed and whose hash value is the same as the hash value of the current file to the current file, or creating a hard link between the two files). (Sharing the same file content); If the hash value of the current file is the same as the hash value of one of the at least one files, it is necessary to determine whether a file with the same relative path as the current file exists in a specific directory. If not, a file with the same relative path as the current file needs to be created in the specific directory, and the content of the created file must be the same as that of one of the at least one files (which has the same hash value as the current file). Alternatively, if such a file exists, it is necessary to ensure that the content of the file with the same relative path as the current file in the specific directory is the same as the content of one of the at least one files (which has the same hash value as the current file). For example, if the content of the file with the same relative path as the current file in the specific directory is the same as the content of the aforementioned file, no processing is performed. Otherwise, processing such as overwriting the content of the file with the same relative path as the current file in the specific directory with the content of the aforementioned file can be performed to ensure that the content of the file with the same relative path as the current file in the specific directory is the same as the content of the aforementioned file. In addition, it is necessary to iterate through the hash values of each file in the at least one file and delete the files corresponding to hash values that are different from the hash values sent by the server.
[0030] If the target directory is not the specified directory, the compressed data needs to be decompressed to the corresponding path under the target directory, and the information of each file in the index file needs to be traversed: if the hash value of the current file is different from the hash values of all files in the at least one file, and the hash value of the current file is different from the hash values of all files that have been traversed, then skip it; if the hash value of the current file is different from the hash values of all files in the at least one file, and the hash value of the current file is the same as the hash value of one of the files that have been traversed, then the current file needs to be created in the target directory, and the content of the current file needs to be the same as the content of the traversed file whose hash value is the same as the hash value of the current file; if the hash value of the current file is the same as the hash value of one of the files in the at least one file, then the current file needs to be created in the target directory, and the content of the current file needs to be the same as the content of a file in the at least one file (which has the same hash value as the current file).
[0031] Additionally, it should be noted that besides the filename and hash value, the at least part of the data may also include other information, such as the independent compressed data corresponding to the non-independent compressed data portion of the target file and the source data. If the compressed data of a target file is independent compressed data, then when decompressing the compressed data of the target file, the index table can be used directly for decompression; however, if the compressed data of a target file is non-independent compressed data, then when decompressing the compressed data of the target file, the index table and index file need to be used for decompression. For example, for the target file A in the previous example, its decompressed data includes I11, I2, and I3. When decompressing I11, the independent compressed data I11 contained in the index file and the corresponding source data M1 need to be used to decompress I11 into M1. When decompressing I2 and I3, the index table needs to be used to decompress I2 and I3 into M2 and M3 respectively. The final source data of the target file A includes M1, M2, and M3.
[0032] The remote file differential iteration method provided in this application receives compressed data of a target file sent by the server and decompresses the compressed data to realize iterative updates of software / services. Since the compressed data of the target file is extracted from the target compressed package by the server using the index file in the target compressed package, compared with the prior art, the whole solution can directly locate the data to be downloaded in the target compressed package without decompressing the target compressed package, and there is no file system mounted, so there will be no performance problems caused by mount point list access. Therefore, it can reduce CPU resource consumption and improve efficiency.
[0033] Based on the foregoing method embodiments, the method may further include: If the hash value of the current file is different from the hash values of all files in the at least one file, and the hash value of the current file is the same as the hash value of a file that has already been traversed, then a new file is created in the target directory based on the filename of the current file.
[0034] Based on the foregoing method embodiments, the method may further include: Delete files whose hash values are different from those in at least one part of the data.
[0035] Reference Figure 3 The diagram shown is a structural schematic of a remote file differential transmission device provided in an embodiment of this application. This device is applied to a server and includes: The acquisition unit 30 is used to receive the hash value of at least one file in a specific directory transmitted by the client, read the index file in the target compressed package, traverse the information of each file in the index file, obtain the hash value of the current file from the index file, and if it is determined that the hash value of the current file is different from the hash values of each file in the at least one file, and the hash value of the current file is different from the hash values of the files that have been traversed, then obtain the compressed data size of the current file from the index file. The index file contains the file name, hash value, compressed data size and offset position of the compressed data in the target compressed package for each file in the target compressed package. Sending unit 31 is used to determine the target file header based on the size of the compressed data of each acquired file, and send the target file header and the index table in the target compressed package to the client; and For each target file, the compressed data of that target file is determined based on its offset position within the target compressed archive, and this compressed data is then sent to the client. The target files include those whose compressed data size was obtained during the traversal process; and... The target file end and at least a portion of the data in the index file are sent to the client, wherein the at least a portion of the data includes the filename and hash value.
[0036] The remote file differential transmission device provided in this application uses an index file in the target compressed package to extract the compressed data of the target file from the target compressed package, and sends the compressed data of the target file and at least part of the data in the index file to the client so that the client can decompress the compressed data to achieve iterative updates of software / services. Compared with the prior art, the whole solution can directly locate the data to be downloaded in the target compressed package without decompressing the target compressed package, and does not mount a file system, so there will be no performance problems caused by accessing the mount point list. Therefore, it can reduce CPU resource consumption and improve efficiency.
[0037] The remote file differential transmission device provided in this application embodiment is implemented in the same way as the remote file differential transmission method provided in this application embodiment, and the effect it achieves is also the same as the remote file differential transmission method provided in this application embodiment, so it will not be described again here.
[0038] Reference Figure 4 The diagram shown is a schematic representation of a remote file differential iteration device provided in an embodiment of this application. This device is applied to a client and includes: Receiving unit 40 is used to receive the target file header and index table sent by the server; and Receive compressed data of target files sent by the server, wherein the target files include files in the target compressed package whose hash values are different from the hash values of all files in at least one file in a specific directory of the client, and different target files have different hash values; and The server receives the end of the target file and at least a portion of the data in the index file of the target compressed package, wherein the at least a portion of the data includes the filename and hash value; The decompression unit 41 is used to decompress the compressed data of the target file to the target directory using the index table, and to traverse the information of each file in the index file. If the hash value of the current file is different from the hash values of each file in the at least one file, and the hash value of the current file is different from the hash values of the files that have been traversed, then it is skipped.
[0039] The remote file differential iteration device provided in this application receives compressed data of a target file sent by the server and decompresses the compressed data to realize iterative updates of software / services. Since the compressed data of the target file is extracted from the target compressed package by the server using the index file in the target compressed package, compared with the prior art, the whole solution can directly locate the data to be downloaded in the target compressed package without decompressing the target compressed package, and there is no file system mounted, so there will be no performance problems caused by mount point list access. Therefore, it can reduce CPU resource consumption and improve efficiency.
[0040] The remote file differential iteration device provided in this application embodiment is implemented in the same way as the remote file differential iteration method provided in this application embodiment, and the effect it can achieve is also the same as the remote file differential iteration method provided in this application embodiment, so it will not be described again here.
[0041] The above are merely specific embodiments of this application, but the scope of protection of this application is not limited thereto. Any variations or substitutions that can be easily conceived by those skilled in the art within the scope of the technology disclosed in this application should be included within the scope of protection of this application. Therefore, the scope of protection of this application should be determined by the scope of the claims.
Claims
1. A remote file differential transfer method, applied to a server, characterized in that, include: The system receives the hash value of at least one file in a specific directory transmitted by the client, reads the index file in the target compressed package, traverses the information of each file in the index file, obtains the hash value of the current file from the index file, and if it is determined that the hash value of the current file is different from the hash values of each file in the at least one file, and the hash value of the current file is different from the hash values of the files that have been traversed, then obtains the compressed data size of the current file from the index file. The index file contains the file name, hash value, compressed data size, and offset position of the compressed data in the target compressed package for each file in the target compressed package. The target file header is determined based on the size of the compressed data of each file, and the target file header and the index table in the target compressed package are sent to the client. For each target file, the compressed data of the target file is determined based on the offset position of the compressed data of the target file in the target compressed package, and the compressed data of the target file is sent to the client. The target file includes the file whose compressed data size was obtained during the traversal. The target file end and at least a portion of the data in the index file are sent to the client, wherein the at least a portion of the data includes the filename and hash value.
2. The method as described in claim 1, characterized in that, Determining the compressed data of the target file based on its offset position within the target compressed archive includes: If the compressed data of the target file in the target archive is independent compressed data, then the compressed data of the target file is directly extracted from the target archive based on its offset position within the target archive; or If the compressed data of the target file in the target archive is not independent compressed data, then the independent compressed data corresponding to the non-independent compressed data part of the target file in the target archive is obtained from the index file. Based on the offset position of the compressed data of the target file in the target archive, the independent compressed data part of the target file in the target archive is directly extracted from the target archive. The independent compressed data obtained from the index file and the independent compressed data part of the target file in the target archive are combined to obtain the compressed data of the target file. The index file also includes the independent compressed data corresponding to the non-independent compressed data part and the source data.
3. The method as described in claim 1 or 2, characterized in that, Before reading the index file in the target compressed package, the following is also included: The target compressed package is decompressed to obtain the decompression result, which contains multiple items; Generate an index file. For each of the multiple items, obtain the information of that item and save the information of that item to the index file. The information of that item includes the file name corresponding to that item, the hash value of that item, the size of the compressed data of that item, and the offset position of the compressed data in the target compressed package. Compress the index file into the target compressed package.
4. The method as described in claim 3, characterized in that, This information also includes the independent compressed data corresponding to the non-independent compressed data portion of this item in the target compressed package, as well as the source data.
5. The method as described in claim 3, characterized in that, The index file is located after the end of the file in the target compressed package.
6. A remote file differential iteration method, applied to a client, characterized in that, include: Receive the target file header and index table sent by the server; Receive compressed data of target files sent by the server. The target files include files in the target compressed package whose hash values are different from the hash values of each file in at least one file in a specific directory of the client. Different target files have different hash values. The server receives the end of the target file and at least a portion of the data in the index file of the target compressed package, wherein the at least a portion of the data includes the filename and hash value; The compressed data of the target file is decompressed to the target directory using the index table. The information of each file in the index file is traversed. If the hash value of the current file is different from the hash values of each file in the at least one of the index files, and the hash value of the current file is different from the hash values of the files that have been traversed, then the file is skipped.
7. The method as described in claim 6, characterized in that, Also includes: If the hash value of the current file is different from the hash values of all files in the at least one file, and the hash value of the current file is the same as the hash value of a file that has already been traversed, then a new file is created in the target directory based on the filename of the current file.
8. The method as described in claim 6 or 7, characterized in that, Also includes: Delete files whose hash values are different from those in at least one part of the data.
9. A remote file differential transmission device, applied to a server, characterized in that, include: The acquisition unit is used to receive the hash value of at least one file in a specific directory transmitted by the client, read the index file in the target compressed package, traverse the information of each file in the index file, obtain the hash value of the current file from the index file, and if it is determined that the hash value of the current file is different from the hash values of each file in the at least one file, and the hash value of the current file is different from the hash values of the files that have been traversed, then obtain the compressed data size of the current file from the index file. The index file contains the file name, hash value, compressed data size and offset position of the compressed data in the target compressed package for each file in the target compressed package. The sending unit is used to determine the target file header based on the size of the compressed data of each acquired file, and send the target file header and the index table in the target compressed package to the client; and For each target file, the compressed data of that target file is determined based on its offset position within the target compressed archive, and this compressed data is then sent to the client. The target files include those whose compressed data size was obtained during the traversal process; and... The target file end and at least a portion of the data in the index file are sent to the client, wherein the at least a portion of the data includes the filename and hash value.
10. A remote file differential iteration device, applied to a client, characterized in that, include: The receiving unit is used to receive the target file header and index table sent by the server; as well as Receive compressed data of target files sent by the server, wherein the target files include files in the target compressed package whose hash values are different from the hash values of all files in at least one file in a specific directory of the client, and different target files have different hash values; and The server receives the end of the target file and at least a portion of the data in the index file of the target compressed package, wherein the at least a portion of the data includes the filename and hash value; The decompression unit is used to decompress the compressed data of the target file to the target directory using the index table, and to traverse the information of each file in the index file. If the hash value of the current file is different from the hash values of each file in the at least one file, and the hash value of the current file is different from the hash values of the files that have been traversed, then it is skipped.
Citation Information
Patent Citations
Data structure of mapping file
CN101441638A
Efficient PLC firmware remote upgrading method
CN117032771A
Business data compression and decompression method and device, equipment and medium
CN119441164A
Multi-version installation package upgrading method and system based on file comparison
CN119960790A
Distributed high-concurrency aggregation storage method and system for small files
CN120295977A