Business data compression and decompression method and device, equipment and medium

Through shard compression and stream decompression technology, the problems of business data decompression in the prior art are solved, and efficient data processing and system stability are achieved.

CN119441164APending Publication Date: 2025-02-14TENCENT TECHNOLOGY (SHENZHEN) CO LTD
View PDF 0 Cites 4 Cited by

Patent Information

Application Number
CN202310986559.5
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2023-08-07
Publication Date
2025-02-14

AI Technical Summary

Technical Problem

The prior art takes a long time in the compression and decompression process of business data, and the decompression process causes excessive disk load, affecting the system response speed.

Method used

The shard compression method is used to divide the service data into multiple compressed fragments, and the target compressed file is formed by generating and encapsulating file header information. During decompression, stream decompression supports parallel processing of download and decompression tasks, reducing disk write density.

Benefits of technology

Effectively reduce the time-consuming process of decompression, reduce disk write pressure, and improve system operation stability and efficiency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119441164A_ABST
    Figure CN119441164A_ABST
Patent Text Reader

Abstract

The invention discloses a compression and decompression method and device for business data, equipment and a medium, and the compression method comprises the steps: obtaining to-be-compressed target business data, and carrying out fragmentation compression to obtain a first compressed file comprising a first file header, a tail file header and a plurality of first compressed fragments; according to the fragmentation compression, the whole target business data can be segmented and compressed into a plurality of first compressed fragments, so that the time consumption of a decompression process is reduced; generating a second file header according to the first file header, the initial position information of each first compressed fragment and the tail file header; and packaging the first compressed file and the second file header to obtain a target compressed file. The second file header can give the initial position information of each first compressed fragment, and the tail file header can give the offset information of each sub-file in the first compressed fragment, so that the compressed files can be efficiently decompressed. The technical scheme can be widely applied to the technical field of data processing.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of data processing technology, and in particular to a method, device, equipment and medium for compressing and decompressing business data. Background Art

[0002] At present, with the development of information technology, the storage and transmission of business data are increasingly used in various applications. In order to save storage space as much as possible and reduce the bandwidth requirements for data transmission, compression and decompression technology is generally used to process business data. Among them, compression technology is used to convert business data into a smaller representation, and decompression technology is used to restore compressed business data to its original form. Compression and decompression technology are widely used in various fields, including computer science, communications, image and audio processing.

[0003] In the related art, when compressing and decompressing business data, a serial download and decompression method is often used, that is, all business data is compressed into a compressed file, and then the compressed file is downloaded and decompressed to obtain the business data. In actual applications, it is found that the decompression process of this implementation method takes a long time, and during the decompression process, since the decompressed file needs to be written to the disk, the continuous decompression operation will cause a large amount of disk writing, which is prone to the problem of excessive disk load, resulting in slow system response.

[0004] In summary, the technical problems existing in the relevant technologies need to be improved. Summary of the invention

[0005] The embodiments of the present application provide a method, device, equipment and medium for compressing and decompressing business data, which can facilitate the efficient compression and decompression of business data, help reduce the time consumption of the decompression process, improve the problem of intensive disk writing in the decompression process, and improve the operating stability of the system.

[0006] An aspect of an embodiment of the present application provides a method for compressing business data, the method comprising:

[0007] Obtain target business data to be compressed;

[0008] The target business data is compressed in segments to obtain a first compressed file; wherein the first compressed file includes a first file header, a tail file header and a plurality of first compressed segments;

[0009] Generate a second file header according to the first file header, the starting position information of each of the first compressed segments, and the tail file header;

[0010] The first compressed file and the second file header are encapsulated to obtain a target compressed file.

[0011] On the other hand, an embodiment of the present application provides a method for decompressing business data, the decompression method comprising:

[0012] Downloading a second file header in a target compressed file to be decompressed; the target compressed file is obtained by encapsulating the second file header and the first compressed file, the first compressed file includes a first file header, a tail file header and a plurality of first compressed segments, and the second file header is generated according to the first file header, the starting position information of each of the first compressed segments and the tail file header;

[0013] Parsing the second file header to obtain the starting position information of each of the first compressed segments and the tail file header;

[0014] According to the starting position information and the tail file header, each of the first compressed segments in the target compressed file is downloaded and decompressed in sequence.

[0015] On the other hand, an embodiment of the present application provides a device for compressing business data, the device comprising:

[0016] An acquisition unit, used for acquiring target service data to be compressed;

[0017] A compression unit, configured to perform segment-by-segment compression on the target service data to obtain a first compressed file; wherein the first compressed file includes a first file header, a tail file header, and a plurality of first compressed segments;

[0018] a generating unit, configured to generate a second file header according to the first file header, the starting position information of each of the first compressed segments, and the tail file header;

[0019] The encapsulation unit is used to encapsulate the first compressed file and the second file header to obtain a target compressed file.

[0020] Optionally, the compression unit is specifically used for:

[0021] Obtaining preset compression parameters; the compression parameters are used to set a threshold value for the number of compressed segments obtained after slicing compression and a threshold value for the amount of data contained in the compressed segments;

[0022] According to the compression parameters, the target business data is segmented and compressed to obtain a first number of first compressed segments; wherein the first number is less than or equal to the number threshold, and the first data amount contained in each of the first compressed segments is less than or equal to the data amount threshold.

[0023] Optionally, the generating unit is specifically used for:

[0024] Detecting a second data amount of the first file header;

[0025] Performing hash processing on the second data volume, the starting position information, and the tail file header to obtain a first hash value;

[0026] A second file header is generated according to the second data volume, the starting position information, the tail file header and the first hash value.

[0027] Optionally, the generating unit is further used for:

[0028] Generate signature information corresponding to the first compressed file according to the file type or file format of the first compressed file;

[0029] The signature information is added to the second file header.

[0030] Optionally, the generating unit is further used for:

[0031] Performing hash processing on each of the first compressed segments to obtain a second hash value;

[0032] Add the second hash value to the second file header.

[0033] Optionally, the compression device further includes a second generating unit, wherein the second generating unit is specifically configured to:

[0034] detecting a third data amount of the second file header;

[0035] The file name information or uniform resource locator information corresponding to the target compressed file is generated according to the third data volume and the first hash value.

[0036] On the other hand, an embodiment of the present application provides a decompression device for business data, the decompression device comprising:

[0037] A first downloading unit is used to download a second file header in a target compressed file to be decompressed; the target compressed file is obtained by encapsulating the second file header and the first compressed file, the first compressed file includes a first file header, a tail file header and a plurality of first compressed segments, and the second file header is generated according to the first file header, the starting position information of each of the first compressed segments and the tail file header;

[0038] A parsing unit, configured to parse the second file header to obtain the starting position information of each of the first compressed segments and the tail file header;

[0039] The second downloading unit is used to download and decompress the first compressed segments in the target compressed file in sequence according to the starting position information and the tail file header.

[0040] Optionally, the first downloading unit is specifically used for:

[0041] Obtaining file name information or uniform resource locator information corresponding to the target compressed file;

[0042] Determine a third data amount according to the file name information or the uniform resource locator information; the third data amount is used to represent the data amount of the second file header;

[0043] According to the third data amount, the second file header in the target compressed file to be decompressed is downloaded.

[0044] Optionally, the second file header includes a first hash value, which is obtained by performing hash processing on the second data amount, the starting position information and the tail file header of the first file header; the decompression device also includes a first verification unit, which is specifically used to:

[0045] Performing hash processing on the second data volume, the starting position information, and the tail file header to obtain a verification hash value;

[0046] Comparing whether the first Hash value and the verification Hash value are consistent;

[0047] If the first Hash value and the verification Hash value are inconsistent, the decompression task of the target compressed file is terminated.

[0048] Optionally, the second file header includes a second hash value, which is obtained by performing hash processing on each of the first compressed segments; the decompression device also includes a second verification unit, which is specifically used to:

[0049] Downloading the first compressed segment according to the starting position information;

[0050] Performing a consistency check on the first compressed segment currently being downloaded according to the second Hash value;

[0051] If the consistency check passes, the first compressed fragment currently being downloaded is decompressed according to the tail file header, and the step of downloading the first compressed fragment according to the starting position information is returned; or, if the consistency check fails, the decompression task of the target compressed file is terminated.

[0052] On the other hand, an embodiment of the present application provides an electronic device, including a processor and a memory;

[0053] The memory is used to store computer programs;

[0054] The processor executes the computer program to implement the aforementioned service data compression method or service data decompression method.

[0055] On the other hand, an embodiment of the present application provides a computer-readable storage medium, wherein the storage medium stores a computer program, and the computer program is executed by a processor to implement the aforementioned business data compression method or business data decompression method.

[0056] The embodiment of the present application further discloses a computer program product, including a computer program, which implements the aforementioned business data compression method or business data decompression method when executed by a processor.

[0057] The embodiments of the present application include at least the following beneficial effects: The present application provides a method, device, equipment and medium for compressing and decompressing business data. The compression method obtains the target business data to be compressed, compresses the target business data in slices, and obtains a first compressed file including a first file header, a tail file header and a plurality of first compressed segments. The slice compression can compress the whole target business data into the form of a plurality of first compressed segments, which is convenient for subsequent streaming decompression and helps to reduce the time consumption of the decompression process; then, according to the first file header, the starting position information of each first compressed segment and the tail file header, a second file header is generated; the first compressed file and the second file header are encapsulated to obtain the target compressed file. The second file header can give the starting position information of each first compressed segment, and the tail file header can give the offset information of each sub-file in the first compressed segment, which is convenient for realizing efficient decompression of the compressed file. The decompression method can decompress the target compressed file by streaming decompression, supports parallel processing of download tasks and decompression tasks, and helps to reduce the time consumption of the decompression process; by sequentially decompressing each first compressed segment in a segmented manner, the problem of disk write intensiveness in the decompression process can be improved, and the operation stability of the system can be improved. BRIEF DESCRIPTION OF THE DRAWINGS

[0058] The accompanying drawings are used to provide further understanding of the technical solution of the present application and constitute a part of the specification. Together with the embodiments of the present application, they are used to explain the technical solution of the present application and do not constitute a limitation on the technical solution of the present application.

[0059] Figure 1 A schematic diagram of serial downloading and decompressing service data provided in an embodiment of the present application;

[0060] Figure 2 A schematic diagram of an implementation environment of a method for compressing and decompressing business data provided in an embodiment of the present application;

[0061] Figure 3 A flowchart of a method for compressing business data provided in an embodiment of the present application;

[0062] Figure 4 A schematic diagram of the structure of a first compressed file provided in an embodiment of the present application;

[0063] Figure 5 A schematic diagram of a streaming decompression provided in an embodiment of the present application;

[0064] Figure 6 A flowchart of a method for decompressing business data provided in an embodiment of the present application;

[0065] Figure 7a A schematic diagram of an interface of a game downloader provided in an embodiment of the present application;

[0066] Figure 7b A schematic diagram of an interface of a software downloader provided in an embodiment of the present application;

[0067] Figure 8 A flowchart of a specific embodiment of a method for compressing business data provided in an embodiment of the present application;

[0068] Fig. 9 A schematic diagram of packaging a 7z compressed file provided in an embodiment of the present application;

[0069] Fig.10 A flowchart of another specific embodiment of a method for compressing business data provided in an embodiment of the present application;

[0070] Fig.11 A flowchart of a specific embodiment of a method for decompressing business data provided in an embodiment of the present application;

[0071] Fig.12 A schematic diagram of the structure of a device for compressing business data provided in an embodiment of the present application;

[0072] Fig.13 A schematic diagram of the structure of a business data decompression device provided in an embodiment of the present application;

[0073] Fig.14 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application;

[0074] Fig.15 A schematic diagram of the structure of another electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0075] In order to make the purpose, technical solutions and advantages of the present application clearer, the present application is further described in detail below in conjunction with the accompanying drawings and examples. It should be understood that the specific embodiments described herein are only used to explain the present application and are not intended to limit the present application. When the following description refers to the drawings, unless otherwise indicated, the same numbers in different drawings represent the same or similar elements. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with the embodiments of the present application. They are only examples of devices and methods consistent with some aspects of the embodiments of the present application as detailed in the attached claims.

[0076] It is understood that the terms "first", "second", etc. used in this application can be used to describe various concepts in this article, but unless otherwise specified, these concepts are not limited by these terms. These terms are only used to distinguish one concept from another concept. For example, without departing from the scope of the embodiment of the present application, the first information may also be referred to as the second information, and similarly, the second information may also be referred to as the first information. Depending on the context, the words "if" and "if" as used herein can be interpreted as "at the time of" or "when" or "in response to determination".

[0077] The terms "at least one", "multiple", "each", "any", etc. used in this application, at least one includes one, two or more, multiple includes two or more, each refers to each of the corresponding multiple, and any refers to any one of the multiple.

[0078] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as those commonly understood by those skilled in the art to which this application belongs. The terms used herein are only for the purpose of describing the embodiments of this application and are not intended to limit this application.

[0079] Before describing the embodiments of the present application in detail, some nouns and terms involved in the embodiments of the present application are first described. The nouns and terms involved in the embodiments of the present application are subject to the following explanations.

[0080] 1) HTTP, Hypertext Transfer Protocol, is a communication protocol for transmitting hypertext (such as HTML, Hypertext Markup Language) over the Internet. HTTP is a protocol based on the client and server model, in which the client can send requests to the server, and the server returns a response to the client.

[0081] 2) Compression algorithm: an algorithm used to achieve data compression, which reduces the storage space or transmission bandwidth occupied by the data by performing specific encoding and processing on the data. Common compression algorithm types include ZIP compression algorithm, GZIP compression algorithm, LZ77 / LZ78 compression algorithm, 7z compression algorithm, H.264 / AVC compression algorithm, etc. Generally speaking, there is a corresponding decompression algorithm for a compression algorithm, and the corresponding compression algorithm and decompression algorithm can form a compression format, such as ZIP, which is a compression format.

[0082] 3) API (Application Programming Interface), a software interface that enables data interaction and communication between different applications.

[0083] 4) MD5 (Message Digest Algorithm 5), a commonly used hash algorithm, is used to generate a 128-bit (16-byte) hash value. It accepts input (message) of any length and outputs a hash value of a fixed length. The MD5 algorithm is mainly used in data integrity verification, digital signatures, password storage and other fields.

[0084] 5) CRC32 (Cyclic Redundancy Check), a cyclic redundancy check algorithm used to detect errors in data transmission or storage. The CRC32 algorithm generates a 32-bit check value by calculating the data block with a predefined polynomial. The check value can be used to verify whether the data has been modified or damaged during transmission or storage.

[0085] At present, with the development of information technology, the storage and transmission of business data are increasingly used in various applications. In order to save storage space as much as possible and reduce the bandwidth requirements for data transmission, compression and decompression technology is generally used to process business data. Among them, compression technology is used to convert business data into a smaller representation, and decompression technology is used to restore compressed business data to its original form. Compression and decompression technology are widely used in various fields, including computer science, communications, image and audio processing.

[0086] In the related art, when compressing and decompressing business data, a serial download decompression method is often used, referring to Figure 1 , Figure 1A schematic diagram of serial downloading and decompressing business data provided in an embodiment of the present application is shown. Generally speaking, in the application of serial downloading and decompression, the business data 120 is compressed into a complete compressed file 110. When decompressing the business data 120, first, the compressed file 110 can be downloaded from the server or the network. The download method can use the HTTP protocol or other protocols, depending on the source of the business data and the download requirements. After the compressed file 110 is downloaded, it is usually necessary to verify it to ensure the integrity and accuracy of the file. Common verification methods are to use technologies such as checksums, hash values ​​or digital signatures to compare whether the verification value is consistent with the expected one. If the verification fails, you can download it again, or change the download channel.

[0087] After the verification is passed, the compressed file 110 can be decompressed. The decompression process is the process of converting the compressed file 110 into the original business data 120. Here, it is generally necessary to determine which compression algorithm is used to obtain the compressed file 110, such as a ZIP compression algorithm, a GZIP compression algorithm, etc. Then, the compressed file 110 is decompressed using a corresponding decompression algorithm and tool. After the decompression is completed, the required business data 120 can be extracted from the decompressed file. Of course, the above embodiment is only used to illustrate the implementation process of serial download decompression. Those skilled in the art can change or adjust some of the processes according to actual needs, and this application does not limit this.

[0088] In actual applications, it is found that when the serial download decompression technology is used to decompress the compressed file 110, since all the compressed files 110 need to be downloaded before entering the verification and decompression process, the overall time consumed is equal to the sum of the total download time, verification time and decompression time, and the decompression process takes a long time; during the verification process, if the verification fails, the entire compressed file 110 needs to be downloaded again, which is also time-consuming and occupies a large amount of network resources; and during the decompression process, since the decompressed file needs to be written to the disk, the continuous decompression operation will cause a large amount of disk writes, which is prone to the problem of excessive disk load, resulting in slow system response.

[0089] In view of this, the present application provides a method, device, equipment and medium for compressing and decompressing business data. The compression method obtains the target business data to be compressed, compresses the target business data in slices, and obtains a first compressed file including a first file header, a tail file header and a plurality of first compressed segments. The slice compression can divide and compress the entire target business data into the form of a plurality of first compressed segments, which is convenient for subsequent streaming decompression and helps to reduce the time consumption of the decompression process; then, according to the first file header, the starting position information of each first compressed segment and the tail file header, a second file header is generated; the first compressed file and the second file header are encapsulated to obtain the target compressed file. The second file header can give the starting position information of each first compressed segment, and the tail file header can give the offset information of each sub-file in the first compressed segment, which is convenient for realizing efficient decompression of the compressed file. The decompression method can decompress the target compressed file by streaming decompression, supports parallel processing of download tasks and decompression tasks, and helps to reduce the time consumption of the decompression process; by sequentially decompressing each first compressed segment in a segmented manner, the problem of disk write intensiveness in the decompression process can be improved, and the operation stability of the system can be improved.

[0090] The business data compression method and business data decompression method provided in the embodiments of the present application mainly relate to technologies related to data processing in the field of information technology. It can be understood by those skilled in the art that the business data compression method and business data decompression method provided in the embodiments of the present application can be executed in various application scenarios:

[0091] For example, in a data transmission scenario, when a large amount of business data needs to be transmitted, the business data can be compressed into a compressed file by using the business data compression method provided in the embodiment of the present application. Data transmission can be achieved by compressing the file, which can reduce the time required for transmission and the consumption of network bandwidth. After the transmission is completed, the compressed file can be restored to the original business data by using the business data decompression method provided in the embodiment of the present application for subsequent processing.

[0092] For example, some e-commerce websites need to transmit a large amount of order data to suppliers to facilitate the suppliers to supply goods. In this case, the business data compression method provided in the embodiment of the present application can be used to compress the order data into a compressed file, and then transmit it to the supplier through the network. After receiving the compressed file, the supplier can use the business data decompression method provided in the embodiment of the present application to restore the compressed order data for order processing.

[0093] For example, in a data storage scenario, when business data needs to be backed up, the business data compression method provided in the embodiment of the present application can compress the business data into a compressed file, and then back up and store the compressed file. In this way, the occupied storage space can be reduced and the resource consumption of the hardware device can be reduced.

[0094] For example, a hospital may need to store a large amount of case data for a long time. In this case, the compression method of the business data provided in the embodiment of the present application can be used to compress the case data into a compressed file, and then store it on a hard disk or cloud. When the case data needs to be used or analyzed, the decompression method of the business data provided in the embodiment of the present application can be used to restore the compressed file to the original case data. In this way, it can save the occupied storage space and quickly restore the relevant business data when it is needed.

[0095] It is understandable that the above application scenarios are only exemplary and do not limit the actual application of the business data compression method and the business data decompression method in the embodiments of the present application. Those skilled in the art can understand that in different application scenarios, the business data compression method and the business data decompression method provided in the embodiments of the present application can be used to perform specified tasks.

[0096] It should be noted that in each specific implementation of the present application, when it comes to the need to perform relevant processing based on the object's information, the object's behavioral data, the object's historical data, the object's location information, and other data related to the object's identity or characteristics, the object's permission or consent will be obtained first, and the collection, use, and processing of these data will comply with the relevant laws, regulations, and standards of the relevant countries and regions. In addition, when the embodiment of the present application needs to obtain sensitive information of the object, the object's separate permission or separate consent will be obtained through a pop-up window or by jumping to a confirmation page. After clearly obtaining the object's separate permission or separate consent, the necessary object-related data for the normal operation of the embodiment of the present application will be obtained.

[0097] The specific implementation of the embodiment of the present application is described in detail below in conjunction with the accompanying drawings. First, the service data compression method and the service data decompression method provided in the embodiment of the present application are described in conjunction with the accompanying drawings.

[0098] Please refer to Figure 2 , Figure 2A schematic diagram of the implementation environment of a compression method and a decompression method for business data provided in an embodiment of the present application is shown. In the implementation environment, the main hardware and software entities involved include a terminal device 210 and a server 220, and the terminal device 210 and the server 220 are connected in communication. In the embodiment of the present application, the compression method for business data can be executed on the server 220 side, and the decompression method for business data can be executed on the terminal device 210 side. Based on the communication connection between the terminal device 210 and the server 220, the transmission of business data or compressed files can be realized.

[0099] For the compression method of business data, illustratively, in some embodiments, the server 220 may be a server dedicated to storing business data. When the target object has a data storage requirement, a data compression request may be sent to the server 220 through the terminal device 210. After receiving the data compression request, the server 220 may obtain the target business data to be compressed from the terminal device 210, and the compression method of business data provided in the embodiment of the present application may be executed to compress the target business data, obtain the target compressed file and store it.

[0100] For the decompression method of the service data, illustratively, in some embodiments, the terminal device 210 may be a device for video playback, and a video application may be installed on the terminal device 210, and the video application may provide a video playback service. The server 220 may be a background server of the video application, and the server 220 may provide video resources based on the compressed target compressed file. Specifically, when the video application is used on the terminal device 210, the service data decompression method provided in the embodiment of the present application may be executed to download and decompress the target compressed file from the server 220, obtain the video data, and then play it.

[0101] Among them, the terminal device 210 of the above embodiment may include a smart phone, a tablet computer, a laptop computer, a desktop computer, a smart speaker, a smart watch, a smart TV, and a car terminal, but is not limited thereto.

[0102] Server 220 can be an independent physical server, or a server cluster or distributed system composed of multiple physical servers. It can also be a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, CDN (Content Delivery Network), as well as big data and artificial intelligence platforms.

[0103] In addition, the server 220 may also be a node server in the blockchain network.

[0104] The terminal device 210 and the server 220 may establish a communication connection through a wireless network or a wired network. The wireless network or wired network uses standard communication technology and / or protocols, and the network may be set to the Internet, or any other network, such as but not limited to a local area network (LAN), a metropolitan area network (MAN), a wide area network (WAN), a mobile, wired or wireless network, a private network or any combination of a virtual private network. Moreover, the above-mentioned software and hardware entities may use the same communication connection mode or different communication connection modes, and this application does not impose any specific restrictions on this.

[0105] Of course, it is understandable that Figure 2 The implementation environment in the embodiment of the present application is only some optional application scenarios of the compression method and decompression method of business data provided in the embodiment of the present application. The actual application is not fixed. Figure 2 The method provided in the embodiments of the present application can be applied to various technical fields, such as shopping, games, audio and video, social networking, cloud technology, artificial intelligence, smart transportation, assisted driving, etc., and the present application does not make any specific restrictions on this.

[0106] like Figure 3 As shown, in an embodiment of the present application, a method for compressing business data is provided, and the method for compressing business data can be applied to Figure 2 In the server 220 shown. Figure 3 The method for compressing business data provided in the embodiment of the present application specifically includes but is not limited to steps 310 to 340:

[0107] Step 310: Obtain target service data to be compressed;

[0108] In this step, when executing the compression method of the business data, the business data to be compressed can be obtained, which is recorded as the target business data. Specifically, in the embodiment of the present application, the target business data to be compressed can be various types of data, including but not limited to at least one of text data, image data, audio data or video data, and the present application does not limit the specific data type and data size contained in the target business data.

[0109] In this step, there is no restriction on the actual source of the target business data. For example, in some embodiments, the target business data may be sent by the terminal device to the server responsible for processing the data compression service when the target object requests compression processing; in some embodiments, the target business data may also be uploaded by relevant development and testing personnel themselves. Figure 2 Taking the implementation scenario shown as an example, the development and testing personnel of the server 220 can edit the target business data to be compressed according to the requirements and upload it to the server 220. The server 220 can obtain the corresponding target compressed file by executing the compression method of the business data provided in the embodiment of the present application. The development and testing personnel can determine whether the compression method can be effectively executed according to whether the target compressed file actually meets the predetermined requirements, thereby facilitating the optimization and update of the relevant program codes involved in the compression method.

[0110] It is understandable that in the embodiments of the present application, when acquiring target business data, different types of target business data can be acquired in corresponding ways. Exemplarily, for text-type target business data, it can be acquired from an internal database, a file server, or various public data sets within the enterprise. These data can be structured, such as reports, log files, or database records; they can also be unstructured, such as emails, social media posts, or web page content. For image-type target business data, it can be acquired from photos and video frames taken by a camera, camcorder, or drone, or downloaded from a public image data set. For audio-type target business data, it can be acquired from a recording device, a phone call, or an audio file.

[0111] Of course, it is understandable that the above introduction to the method of acquiring the target business data is only for exemplary explanation and is not meant to limit the actual implementation of this application. In addition to the above-mentioned methods, in some embodiments, the target business data can also be acquired through web crawling, API (Application Programming Interface) interface calls, sensor data collection, etc. In the embodiments of the present application, the target business data can be acquired by selecting a suitable acquisition method according to specific business needs and data sources; and, in some embodiments, after obtaining the target business data, the target business data can be sorted and preprocessed accordingly for subsequent compression processing, and this application does not limit this.

[0112] It should be noted that in the embodiments of the present application, the target business data can be obtained from a single data source or from multiple data sources. When the target business data is obtained from multiple data sources, the obtained data can be integrated to obtain the target business data for subsequent compression processing.

[0113] Step 320: compress the target business data into segments to obtain a first compressed file; wherein the first compressed file includes a first file header, a tail file header, and a plurality of first compressed segments;

[0114] In this step, after obtaining the target business data, the compression process of the target business data can be started. Specifically, in the embodiment of the present application, the target business data can be compressed by slices. Slice compression is a method of compressing a large-scale data into multiple smaller parts. Through slice compression, large-scale target business data can be processed more efficiently, which is conducive to reducing the time consumed by the compression and decompression process.

[0115] In this step, when the target business data is compressed in slices, the data can be divided into multiple fragments according to certain rules and strategies, and then each fragment is compressed independently. Exemplarily, in some embodiments, the target business data is compressed in slices, which may include data division, compression, information collection, and compressed file assembly. When the data is divided, the target business data is divided into multiple smaller parts according to the set rules and strategies. These parts can be recorded as data fragments. The specific division rules and strategies can be set based on time periods, data types, keywords, etc., and the present application does not limit this. After the multiple data fragments are obtained by division, appropriate compression algorithms and parameters can be selected to perform independent compression operations on each data fragment. This process can be implemented in parallel, and the time consumed by compressing the target business data can be reduced relative to the compression process corresponding to the conventional serial download decompression. In the embodiment of the present application, the data fragments corresponding to the target business data are compressed, and the compressed data obtained is recorded as the first compressed fragment. Then, corresponding information can be created for each compressed fragment, for example, the starting position information, length information, type of compression algorithm used, verification information, etc. of the compressed fragment can be included. This information can be subsequently recorded in the obtained compressed file so that the compressed fragments can be correctly restored when decompressed. Then, the obtained compressed fragments and information can be assembled into a compressed file in a certain format and order to complete the segmented compression of the target business data. In the embodiment of the present application, the compressed file obtained by segmenting and compressing the target business data is recorded as the first compressed file.

[0116] In the embodiment of the present application, the first compressed file may include a first file header, a tail file header and a plurality of first compressed segments, wherein the first compressed segment has been introduced in the aforementioned implementation process of the segment compression, and will not be described in detail here; the first file header and the tail file header are structures for storing information related to the first compressed file. Figure 4 , Figure 4 A schematic diagram of the structure of a first compressed file provided in an embodiment of the present application is shown in FIG. Figure 4The first compressed file shown includes multiple first compressed segments, which can be recorded as first compressed segment 1, first compressed segment 2, first compressed segment 3...first compressed segment n, where n is a positive integer. In addition to the compressed segments, the first compressed file also includes a first file header and a tail file header, where the first file header is located before all the first compressed segments, and the tail file header is located after all the first compressed segments.

[0117] In general, the file header usually refers to the beginning of a compressed file, which is used to store the meta information of the entire compressed file. The meta information includes various attribute information and description information of the compressed file, such as the type of compression algorithm used (version number), compression parameters (such as compression level, dictionary size, etc.), the original file name before compression, compression time, the starting position information of the compressed segment, the file size before and after compression, the file size, etc. In the embodiment of the present application, the file header in the first compressed file is recorded as the first file header. The footer header is at the end of the compressed file, which is usually used to store the offset information and verification information of the compressed file, wherein the offset information is also a kind of position information. In a compressed segment, there are generally multiple subdivided files, which can be recorded as sub-files. The offset information can record the position of each sub-file, which is convenient for the subsequent correct decompression and restoration of each compressed segment. The verification information is used to implement the integrity check of the compressed file to ensure that the compressed file has not been tampered with or damaged. Generally, the verification value of the compressed file calculated by a specific algorithm, such as CRC32, MD5, etc., is not limited to this in the present application.

[0118] Of course, it should be noted that the types of related information stored in the first file header and the tail file header in the above embodiments are only used for exemplary explanations, and do not mean to limit the specific implementation of the first file header and the tail file header. In different compression algorithms, the related information stored in the first file header and the tail file header may be different. For example, in some embodiments, the checksum information may also be stored in the first file header, and this application does not limit this.

[0119] In this step, the target business data is compressed in pieces. During the decompression process, the target compressed file can be decompressed by streaming decompression, supporting the parallel processing of download tasks and decompression tasks. Figure 5 , Figure 5 A schematic diagram of a stream decompression provided in an embodiment of the present application is shown, Figure 5As shown, for the first compressed file obtained by segmented compression, when decompressing it, each first compressed segment can be decompressed segment by segment in turn. For example, first download the first compressed segment 1, and then verify the first compressed segment 1 after the download is complete. When the verification passes, the first compressed segment 1 can be decompressed. While verifying and decompressing the first compressed segment 1, the download task can be processed in parallel, for example, the first compressed segment 2 can be downloaded. In this way, the parallel processing of the download task and the decompression task can be achieved, and the overall decompression time is roughly equal to the sum of the download time of all the first compressed segments, the verification time of the last first compressed segment, and the decompression time of the last compressed segment. Figure 1 The serial download decompression method shown can greatly shorten the time required for the decompression process. In addition, since verification can be performed each time a first compressed segment is downloaded during the streaming decompression process, it is convenient to quickly find out whether the target compressed file has been tampered with or damaged, and there is no need to re-download the entire first compressed file when the verification fails, which is conducive to reducing the consumption of network resources.

[0120] It should be noted that, in the actual decompression process, depending on the server settings, some servers support piecewise downloading, that is, when downloading the first compressed file, it is not necessary to download in the order in which the parts in the first compressed file are arranged. Figure 5 In the example, the first compressed segment 2 may be downloaded first, and then the first compressed segment 1. However, some servers may only support sequential downloading, but not segmented downloading. In this case, the first compressed segments need to be downloaded and decompressed in sequence according to the order in which the segments in the first compressed file are arranged.

[0121] Step 330: Generate a second file header according to the first file header, the start position information of each first compressed segment, and the tail file header;

[0122] As mentioned above, some servers may only support sequential downloading, but not segmented downloading. In this case, during the decompression process, the first compressed segments need to be downloaded and decompressed in sequence according to the order in which the segments are arranged in the first compressed file. Figure 4 It can be known that in the first compressed file, the tail file header is at the end of the first compressed file, that is, for a server that only supports sequential downloading, the tail file header can only be downloaded after all the first compressed segments are downloaded. In the decompression process of the first compressed segment, the offset information in the tail file header is required to correctly restore the sub-file. If there is no tail file header, it is difficult to correctly decompress each first compressed segment. Therefore, the first compressed file obtained by the conventional compression algorithm is not suitable for the application scenario of sequential downloading.

[0123] Therefore, in the embodiment of the present application, considering the problem that it is difficult to download the tail file header in advance in the application scenario of sequential downloading to realize the correct decompression and restoration of each first compressed fragment, a new compression strategy is provided. Specifically, in this step, a new file header can be generated according to the first file header in the first compressed file, the starting position information of the first compressed fragment, and the tail file header, and the file header is recorded as the second file header. Here, when generating the second file header, the starting position information of each first compressed fragment and the tail file header can be used to provide the location information of the file (or sub-file) required for subsequent decompression, which can facilitate the decompression task of the first compressed file.

[0124] In this step, in addition to the starting position information of each first compressed fragment and the tail file header, when generating the second file header, some relevant information in the first file header can also be selected according to needs, such as the file size information of the first file header, the total number of segments of the compressed fragments, etc. In this way, when the first compressed file is subsequently decompressed, the information required for decompression can be quickly acquired through the second file header, and the decompression task can be started without downloading and parsing the first file header, which can improve the efficiency of decompression of the first compressed file.

[0125] Step 340: encapsulate the first compressed file and the second file header to obtain a target compressed file.

[0126] In this step, after obtaining the second file header, the first compressed file and the second file header may be encapsulated, and the encapsulated file may be recorded as the target compressed file. Specifically, when encapsulating the first compressed file and the second file header to generate the target compressed file, the second file header may be added to the front of all the contents of the first compressed file. The second file header is used as a part of the target compressed file and appears at the beginning of the target compressed file.

[0127] Exemplarily, in some embodiments, when encapsulating the first compressed file and the second file header, the content of the first compressed file can be read first, for example, the relevant API interface for file reading can be used to read the byte stream of the first compressed file, or the first compressed file can be directly stored in a memory buffer. And, similarly, the content of the second file header can be read in the same way. Then, a new buffer can be created, the content of the second file header can be written into the new buffer first, and then the content of the first compressed file can be written into the buffer. In this way, a new byte stream containing the second file header and the first compressed file can be obtained, the byte stream can be encapsulated, and the encapsulated byte stream can be written into a new file to obtain the target compressed file. It should be noted that in the embodiments of the present application, the algorithm and implementation process used for encapsulating the byte stream can be implemented according to specific needs and application scenarios, and the present application does not limit this.

[0128] In the embodiment of the present application, by encapsulating the first compressed file and the second file header, a new compressed file structure can be obtained. In the target compressed file, the second file header is at the beginning, followed by the first compressed file, and the second file header includes the tail file header corresponding to the first compressed file. In this way, even in the application scenario of sequential downloading, the tail file header can be obtained before the first compressed segment is downloaded and decompressed, thereby realizing normal decompression of the first compressed file.

[0129] It can be understood that the compression method of business data provided in the embodiment of the present application obtains the target business data to be compressed, and compresses the target business data in slices to obtain a first compressed file including a first file header, a tail file header and a plurality of first compressed segments. The slice compression can divide and compress the overall target business data into the form of a plurality of first compressed segments, which is convenient for subsequent streaming decompression and helps to reduce the time consumption of the decompression process; then, according to the first file header, the starting position information of each first compressed segment and the tail file header, a second file header is generated; the first compressed file and the second file header are encapsulated to obtain a target compressed file. The second file header can provide the starting position information of each first compressed segment, and the tail file header can provide the offset information of each sub-file in the first compressed segment, which is convenient for realizing efficient decompression of the compressed file.

[0130] Specifically, in a possible implementation, the target service data is compressed in slices to obtain a first compressed file, including:

[0131] Obtain preset compression parameters; the compression parameters are used to set the threshold value of the number of compressed segments obtained after shard compression and the threshold value of the amount of data contained in the compressed segments;

[0132] According to the compression parameters, the target business data is segmented and compressed to obtain a first number of first compressed segments; wherein the first number is less than or equal to a number threshold, and a first data volume contained in each first compressed segment is less than or equal to a data volume threshold.

[0133] In the embodiment of the present application, when the target business data is compressed in segments, the number of first compressed segments obtained after compression and the amount of data contained in each first compressed segment can be constrained. Here, it can be understood that for the first compressed segments, it is hoped that the amount of data contained therein is as evenly distributed as possible. If the amount of data contained in some first compressed segments is too large, it may cause difficulty in parallel processing during download and decompression; and, since the starting position information of each first compressed segment needs to be recorded in the second file header, the number of first compressed segments should not be too large, otherwise it is easy to cause the second file header data to expand, reducing the efficiency of compression and decompression.

[0134] Specifically, in the embodiments of the present application, some compression parameters can be pre-set, and these compression parameters can be used to set the number threshold of compressed segments obtained after the segment compression and the data volume threshold contained in the compressed segments. The specific compression parameter setting method, the number threshold and the size of the data volume threshold can be flexibly set as needed, and the present application does not impose any restrictions on this. It should be noted that in order to meet the compression requirements of the target business data, the product of the number threshold of compressed segments and the data volume threshold contained in the compressed segments should be greater than the total data volume of the target business data after the overall compression.

[0135] In the embodiment of the present application, according to the set compression parameters, the target business data can be compressed in slices to obtain the first number of first compressed segments. Here, the first number is less than or equal to the number threshold of the compressed segments set by the compression parameters, and the amount of data contained in each first compressed segment (recorded as the first data amount) is less than or equal to the data amount threshold of the compressed segments set by the compression parameters. Specifically, when implementing the above-mentioned compression process, the total amount of data after the overall compression of the target business data can be calculated first, and then a value less than or equal to the number threshold is selected as the first number of the first compressed segments obtained after the slice compression, and the quotient of the total amount of data and the first number is calculated as the first amount of data contained in each first compressed segment. When the target business data is compressed in slices, the amount of data currently compressed is recorded, and when the first data amount is reached, a first compressed segment is formed. Of course, the above compression process is only used to exemplify the implementation of the slice compression in the embodiment of the present application, and does not mean to limit the actual implementation of the present application.

[0136] It can be understood that in the embodiment of the present application, by constraining the first data amount contained in the first compressed segment by compression parameters, it is possible to avoid the occurrence of a first compressed segment with too large a data amount, which is beneficial to improving the stability during downloading and decompression; and by constraining the number of first compressed segments by compression parameters, the data amount of the second file header can be effectively limited, which is beneficial to improving the efficiency of compression and decompression.

[0137] Specifically, in a possible implementation, generating a second file header according to the first file header, the starting position information of each first compressed segment, and the tail file header includes:

[0138] Detecting a second data amount of the first file header;

[0139] Performing hash processing on the second data volume, the starting position information, and the tail file header to obtain a first hash value;

[0140] A second file header is generated according to the second data amount, the starting position information, the tail file header and the first Hash value.

[0141] In an embodiment of the present application, in some cases, the second file header may include the file size information of the first file header, the starting position information of the first compressed segment, the tail file header, and the verification information corresponding to the above information. Specifically, when generating the second file header, the data amount of the first file header, that is, the file size information of the first file header, can be detected, recorded as the second data amount, and then, the second data amount, the starting position information and the tail file header can be hashed. The hashing process is an irreversible algorithm that can convert data into a hash value of a fixed length. The uniqueness of the data can be guaranteed by the hashing process. Even if the data changes slightly, it will result in a different hash value. Therefore, the verification of the data can be achieved by the hashing process. In an embodiment of the present application, the hash value obtained here is recorded as the first hash value. The first hash value can be used to verify whether the information in the second file header has been tampered with, which is conducive to improving the data reliability of the second file header, and then improving the stability of the subsequent decompression process.

[0142] In the embodiment of the present application, after obtaining the first hash value, the second file header can be generated according to the second data volume, the starting position information, the tail file header and the first hash value. Specifically, in the embodiment of the present application, multiple data areas can be set in the second file header, and each information can be filled in the corresponding data area to obtain a complete second file header. Here, there is no restriction on the front and back relationship of the data areas corresponding to each information.

[0143] It is understandable that in the embodiments of the present application, the information in the second file header is not limited to this. For example, in some embodiments, the second file header may also include the first quantity information of the first compressed segment. Furthermore, it should be noted that in the embodiments of the present application, when calculating the first hash value, it is not limited to the calculation based on the second data volume, the starting position information, and the tail file header, and can be implemented by combining all the information included in the second file header, and the present application does not limit this.

[0144] Specifically, in a possible implementation manner, the method further includes:

[0145] Generate signature information corresponding to the first compressed file according to the file type or file format of the first compressed file;

[0146] Add the signature information to the second file header.

[0147] In an embodiment of the present application, in order to facilitate understanding of the file type and file format of the first compressed file, in some cases, signature information (signature) can also be added to the second file header. Here, the signature information refers to a specific byte sequence in the file header of the compressed file, which can be used to identify the file type or file format of the compressed file. For example, when the first compressed file is a PEG image file, the corresponding signature information can be "FF D8 FF"; when the first compressed file is a PDF file, the corresponding signature information can be "%PDF". In an embodiment of the present application, the signature information corresponding to the first compressed file can be generated according to the file type or file format of the first compressed file, and then the signature information can be added to the second file header, so as to facilitate the rapid determination of the file type during the decompression process, thereby selecting the correct parsing method. This application does not limit the location of the data area where the signature information is filled in the second file header.

[0148] Specifically, in a possible implementation manner, the method further includes:

[0149] Performing hash processing on each first compressed segment to obtain a second hash value;

[0150] The second hash value is added to the second file header.

[0151] In the embodiments of the present application, similarly, in some embodiments, in order to facilitate the verification of each first compressed segment during the decompression process, when generating the second file header, each first compressed segment can be hashed, and the obtained hash value is recorded as the second hash value. Then, the second hash value can also be added to the second file header, and the location of the data area in the second file header where the second hash value is filled is not limited by the present application.

[0152] Here, it should be noted that the hash processing is performed on the first compressed segment to obtain the second hash value, and each first compressed segment can be hashed once to obtain a corresponding second hash value recorded in the second file header. For different first compressed segments, the same hash algorithm can be used when calculating the second hash value, or different hash algorithms can be used, and this application does not limit this.

[0153] Specifically, in a possible implementation manner, the method further includes:

[0154] detecting a third data amount of the second file header;

[0155] The file name information or uniform resource locator information corresponding to the target compressed file is generated according to the third data volume and the first hash value.

[0156] In the embodiment of the present application, during the decompression process, since the data in the header part of the target compressed file is the second file header, when the target compressed file is downloaded, the second file header in the target compressed file will be downloaded first, and by downloading and parsing the second file header, information for further downloading and parsing the first compressed file is obtained. Therefore, in the initial stage of downloading the target compressed file, it is necessary to understand the file size of the second file header to facilitate the download and parsing of the second file header. In the embodiment of the present application, an implementation scheme for identifying the file size of the second file header is provided.

[0157] Specifically, in the embodiment of the present application, the file size of the second file header can be detected, and the obtained data can be recorded as the third data amount. Then, the file name information corresponding to the target compressed file can be generated according to the third data amount, or the uniform resource locator information corresponding to the target compressed file can be generated according to the third data amount. In this way, when the target compressed file is downloaded, the file size of the second file header can be roughly determined according to its file name information or uniform resource locator information, so as to facilitate the configuration of network resources according to the third data amount, and quickly realize the download and analysis of the second file header.

[0158] Of course, in some embodiments, the first hash value can also be added to the identification information, that is, the file name information or uniform resource locator information corresponding to the target compressed file can be generated according to the third data volume and the first hash value. In this way, after the second file header is downloaded, it can be verified according to the first hash value, which can conveniently detect whether the second file header has been tampered with or damaged, which is conducive to improving the efficiency of parsing.

[0159] It should be noted that, in the embodiment of the present application, the file name information or uniform resource locator information corresponding to the target compressed file is generated based on the third data amount and the first hash value, which means that the third data amount and the first hash value can be added to the corresponding information, that is, the file name information or the uniform resource locator information can also include other information. The present application does not limit the other content contained in the file name information or the uniform resource locator information corresponding to the target compressed file, and it can be flexibly set as needed.

[0160] like Figure 6 As shown, in the embodiment of the present application, a method for decompressing business data is also provided, and the method for decompressing business data can be applied to Figure 2 In the terminal device 210 shown. Figure 6 The decompression method of the business data provided in the embodiment of the present application specifically includes but is not limited to steps 610 to 630:

[0161] Step 610: download the second file header in the target compressed file to be decompressed; the target compressed file is obtained by encapsulating the second file header and the first compressed file, the first compressed file includes the first file header, the tail file header and multiple first compressed segments, and the second file header is generated according to the first file header, the starting position information of each first compressed segment and the tail file header;

[0162] Step 620: parse the second file header to obtain the starting position information and the tail file header of each first compressed segment;

[0163] Step 630: Download and decompress each first compressed segment in the target compressed file in sequence according to the starting position information and the tail file header.

[0164] In the embodiment of the present application, for the target compressed file compressed on the server side, the decompression method of the business data provided in the embodiment of the present application can be used to perform streaming decompression processing on it. Figure 4 It can be known that when performing streaming decompression, each first compressed segment in the target compressed file can be decompressed in segments in turn. To achieve segmented decompression, it is necessary to obtain relevant information in the target compressed file, such as the starting position information of each first compressed segment in the target compressed file and the offset information of each sub-file in the first compressed segment, so as to realize the correct restoration of the target business data.

[0165] In the embodiment of the present application, when decompressing the target compressed file, first, the second file header in the target compressed file can be downloaded and parsed. The second file header includes the starting position information of each first compressed segment and the tail file header. The second file header can be parsed to obtain this information, and then the first compressed segment can be downloaded according to the starting position information of each first compressed segment, and each first compressed segment can be parsed according to the tail file header information to restore the corresponding target business data.

[0166] It can be understood that the decompression method of business data provided in the embodiment of the present application can decompress the target compressed file by streaming decompression, support parallel processing of download tasks and decompression tasks, and help reduce the time consumption of the decompression process; by sequentially decompressing each first compressed fragment in segments, the problem of disk write-intensive decompression operation can be improved, and the operation stability of the system can be improved. The decompression method of business data provided in the embodiment of the present application can obtain the tail file header of the first compressed file in advance based on the second file header, so that the offset information in the tail file header can be used to realize the correct restoration of the sub-file, which is not only applicable to server scenarios that support piecemeal downloading, but also applicable to server scenarios that only support sequential downloading.

[0167] Specifically, in a possible implementation manner, the method further includes:

[0168] Parsing the second file header to obtain a second data volume; wherein the second data volume is used to represent the data volume of the first file header;

[0169] Downloading a first file header in the target compressed file according to the second data amount;

[0170] According to the first file header and the tail file header, each first compressed segment in the target compressed file is downloaded and decompressed in sequence.

[0171] In the embodiment of the present application, when downloading and decompressing each first compressed segment in the target compressed file, the first file header and the tail file header can also be used. Specifically, generally speaking, the first file header also records the starting position information of each first compressed segment. Therefore, in the embodiment of the present application, the first file header can be downloaded according to the second data volume recorded in the second file header, thereby realizing the download and decompression of the first compressed segment. For example, the second file header can be parsed to obtain the second data volume, and then the first file header in the target compressed file can be downloaded, so that each first compressed segment can be downloaded and decompressed according to the first file header and the tail file header.

[0172] Specifically, in a possible implementation, downloading the second file header in the target compressed file to be decompressed includes:

[0173] Obtain the file name information or uniform resource locator information corresponding to the target compressed file;

[0174] Determine a third data amount according to the file name information or the uniform resource locator information; the third data amount is used to represent the data amount of the second file header;

[0175] According to the third data amount, the second file header in the target compressed file to be decompressed is downloaded.

[0176] In the embodiment of the present application, as mentioned above, the file name information or uniform resource locator information corresponding to the target compressed file may carry the file size information of the second file header. Therefore, in some embodiments, when downloading the second file header in the target compressed file, the file name information or uniform resource locator information corresponding to the target compressed file may be obtained, and then the file size of the second file header, i.e., the third data volume, may be determined based on the file name information or uniform resource locator information. Based on the third data volume, the second file header may be quickly and conveniently downloaded and parsed, which may improve the decompression efficiency of the target compressed file. Moreover, by providing the file size information of the second file header through the file name information or uniform resource locator information corresponding to the target compressed file, it is no longer necessary to obtain other associated information to determine the amount of data required for downloading the second file header, which may reduce the number of information interactions and reduce the network resources consumed during the decompression process.

[0177] Specifically, in a possible implementation, the second file header includes a first hash value, and the first hash value is obtained by performing hash processing on the second data volume, the starting position information, and the tail file header; before the step of parsing the second file header to obtain the second data volume, the starting position information of each first compressed segment, and the tail file header, the method further includes:

[0178] Performing hash processing on the second data volume, the starting position information, and the tail file header to obtain a verification hash value;

[0179] Comparing the first hash value and the verification hash value to see if they are consistent;

[0180] If the first hash value and the verification hash value are inconsistent, the decompression task of the target compressed file is terminated.

[0181] In the aforementioned compression embodiment, it is mentioned that the second file header may include a first hash value, and the first hash value may be used to verify the second file header. Therefore, in the embodiment of the present application, the second file header is downloaded and obtained, and after the second file header is parsed and the content recorded therein is obtained, it can be verified to detect whether the second file header has been tampered with or damaged. Specifically, taking the second file header including the second data volume, the starting position information and the tail file header information as an example, the second data volume, the starting position information and the tail file header can be hashed, and the hash value obtained here is recorded as the verification hash value, and then the first hash value and the verification hash value are compared to see if they are consistent. If the first hash value and the verification hash value are consistent, it means that the content of the second file header is complete and correct, and the subsequent download and decompression task can be continued; if the first hash value and the verification hash value are inconsistent, it means that there is an error in the content of the second file header, which is likely to cause download or decompression failure, so the decompression task of the target compressed file can be terminated, and the corresponding prompt information is output to prompt the target object to re-execute the decompression task or change the resource download channel of the target compressed file.

[0182] Specifically, in a possible implementation, the second file header includes the second hash value, and the first hash value is obtained by performing hash processing on each first compressed segment; and according to the starting position information and the tail file header, the first compressed segments in the target compressed file are sequentially downloaded and decompressed, including:

[0183] Downloading the first compressed segment according to the starting position information;

[0184] Performing a consistency check on the first compressed segment currently being downloaded according to the second hash value;

[0185] If the consistency check passes, the first compressed segment currently being downloaded is decompressed according to the tail file header, and the process returns to the step of downloading the first compressed segment according to the starting position information; or, if the consistency check fails, the decompression task of the target compressed file is terminated.

[0186] In the embodiment of the present application, the second file header may include a second hash value. The second hash value corresponds to each first compressed segment and can be used to verify whether the content of each first compressed segment is complete and correct. Figure 4When downloading and decompressing each first compressed segment in the target compressed file, a first compressed segment can be downloaded according to the starting position information, and then the second hash value corresponding to the first compressed segment can be obtained. A new hash value is obtained by hashing the first compressed segment, and the hash value is compared with the second hash value. If the two are consistent, it means that the first compressed segment has passed the consistency check and its content has not been tampered with or damaged. It can be decompressed according to the tail file header, and then another first compressed segment can be downloaded. Relatively speaking, if it is found that the hash value and the second hash value are inconsistent, it means that the first compressed segment has not passed the consistency check and its content may have been tampered with or damaged. At this time, the decompression task of the target compressed file can be ended, and the corresponding prompt information can be output to prompt the target object to re-execute the decompression task or change the resource download channel of the target compressed file.

[0187] It should be noted that in the embodiment of the present application, there is no restriction on the downloading order of each first compressed fragment, which can be implemented according to the specific server settings. If the server only supports sequential downloading, the first compressed fragments can be downloaded and decompressed in sequence according to the arrangement order of the first compressed file.

[0188] Below, in conjunction with the specific application implementation process, the business data compression method and the business data decompression method provided in this application are introduced and explained in detail.

[0189] In the embodiment of the present application, a method for compressing business data and a method for decompressing business data are provided, which can be applied to various business scenarios. Figure 7a The compression method and decompression method can be applied to business scenarios of games. For example, the compression method can be applied to the server of the game application, and the decompression method can be applied to the game downloader. The server can compress the game resource package and publish it to the corresponding platform by executing the business data compression method in the embodiment of the present application; the game downloader can download and decompress the corresponding game resource package by executing the business data decompression method provided in the embodiment of the present application. Figure 7b The compression method and decompression method can also be applied to other types of software download scenarios. These software can be shopping software, live broadcast software, communication software, etc. This application does not limit this.

[0190] Specifically, refer to Figure 8 , Figure 8A flow chart of a specific embodiment of a method for compressing business data provided in an embodiment of the present application is shown. In an embodiment of the present application, when compressing business data, a 7z compression tool can be used to package resource files (i.e., target business data) into a 7z compressed file (i.e., a first compressed file). Here, the 7z compression tool can use the 7z compression algorithm to divide the resource files into multiple compressed fragments for compression. Then, for the obtained compressed package, a custom tool can be used to encapsulate it to obtain a jz compressed file (i.e., a target compressed file). Specifically, in an embodiment of the present application, when compressing a resource file, it can be implemented by using extreme compression and limiting the size of the compressed fragment. For example, the compression parameter -mx=9 can be set. The compression parameter can specify a maximum compression level of 9. A higher compression level can obtain a better compression ratio, but it will consume more time and computing resources; the compression parameter -mqs=on means turning on the silent mode to reduce the redundant information output; the compression parameter -mf=on means enabling the fastest compression mode; the compression parameter -mhc=on means enabling the hash chain mode. Of course, the specific compression parameter types and options can be flexibly set according to actual needs, and this application does not limit this. In particular, in the embodiment of the present application, a compression parameter -ms=200f8m is also set, which can limit the size of the compressed segment to no more than 8M and the number of compressed segments to no more than 200. This can help improve the stability and efficiency of downloading and decompressing.

[0191] Please refer to Fig. 9 , Fig. 9 FIG. 1 shows a schematic diagram of packaging a 7z compressed file provided in an embodiment of the present application. Fig. 9 As shown, in the 7z compressed file, there are a 7z file header (i.e., the first file header), multiple 7z compressed fragments (i.e., the first compressed fragments) and a 7z tail file header. In the embodiment of the present application, when encapsulating the 7z compressed file, a new file structure is customized, and the compressed file obtained by encapsulation is recorded as a jz compressed file (i.e., the target compressed file). During the encapsulation process, a new jz file header (i.e., the second file header) is generated, and the jz file header is added to the header of the original 7z compressed file to obtain the jz compressed file. Here, the jz file header may include various types of information and verification information for decompressing the 7z compressed file, such as jz file header signature information, which can be used to identify the file type or file format of the 7z compressed file; the jz file header hash value (i.e., the first hash value) can be used to verify the jz file header; the jz file header size and the 7z file header size are used to identify the corresponding file header size information; the total number of 7z compressed fragments can be used to identify the number of 7z compressed fragments, Fig. 9The number of in is m, where m is a positive integer. The starting position information of the 7z compressed segment can be used to subsequently download each 7z compressed segment, the hash value of the 7z compressed segment can be used to verify the downloaded 7z compressed segment, and the 7z tail file header can be used to decompress the 7z compressed segment.

[0192] Reference Fig.10 , Fig.10 A flow chart of a specific embodiment of a compression method for another type of business data provided in an embodiment of the present application is shown. Specifically, in an embodiment of the present application, when generating a jz compressed file, first, the 7z compressed file can be analyzed to obtain relevant information, such as the size of the 7z file header, the 7z tail file header, and the starting position information of each 7z compressed fragment and the hash value of the 7z compressed fragment, and this information is filled into the custom jz file header, and the 7z tail file header is copied to the jz file header to facilitate subsequent download and decompression work. Then, information related to the jz file header can be generated, such as the jz file header signature information and the jz file header size, and the jz file header hash value is generated based on the above information, and the jz file header signature information, the jz file header size and the jz file header hash value are filled in the jz file header. Then the jz file header and the 7z compressed file are spliced ​​into a jz compressed file.

[0193] In order to facilitate the subsequent download and verification of the jz file header, in the embodiment of the present application, the jz file header hash value and the jz file header size can be added to the file name information of the jz compressed file, for example, referring to Fig.10 , you can name the jz compressed file as

[0194] [yyyyy]-mjz[p]k[xxxxxxxxx].jz, where p represents the jz file header size, and xxxxxxx represents the jz file header hash value. [yyyyy] can be arbitrarily specified as the actual file name, including file version information, etc., and this application does not limit this. In addition, in an embodiment of the present application, when the jz compressed file is placed on the server for download and decompression, this file name information can be used in the url. In this way, a complete verification link can be formed starting from the url, which can improve the convenience and security of downloading the jz file header.

[0195] Reference Fig.11 , Fig.11A flowchart of a specific embodiment of a decompression method for business data provided in an embodiment of the present application. In an embodiment of the present application, when decompressing a jz compressed file, first, the file name information of the jz compressed file can be obtained from the url information, and then the jz file header size and the jz file header hash value can be parsed. Based on the jz file header size, the information of the corresponding data volume can be downloaded to obtain the jz file header, and then the jz file header hash value can be used to verify it. If the verification passes, the jz file header can be parsed, the starting position information of the 7z compressed fragment and the 7z tail file header can be read, and a storage space for storing decompressed data can be created, and the 7z tail file header can be copied to the end position of the space. Then, the 7z decompression tool can be called, the jz compressed file can be loaded, and streaming decompression can be started. In the specific decompression process, each time a 7z compressed fragment is downloaded, a verification is performed by the hash value corresponding to the 7z compressed fragment. If the verification is successful, the 7z compressed fragment is decompressed, and then the download is continued until all decompression is completed; if the verification fails, the decompression task is terminated, and a prompt message of decompression failure is output.

[0196] In order to verify the effect that can be achieved by the method provided in the present application, in the embodiment of the present application, a test was conducted on two game resource packages, using the serial download decompression method and the streaming decompression method provided in the embodiment of the present application respectively, to compress and decompress the two game resource packages, and the obtained results are shown in Table 1:

[0197] Table 1

[0198]

[0199]

[0200] It can be seen that the streaming decompression method provided in the embodiment of the present application, although the size of the newly constructed compressed package file is slightly increased relative to the original compressed package (mainly the file header is newly added), can greatly shorten the total time consumed by the decompression process. For example, for game resource package 1, the original decompression time required 41.5 seconds, and the technical solution in the embodiment of the present application can be shortened to 26 seconds, and the efficiency is nearly doubled, which can significantly improve the download and decompression experience of the compressed package. In addition, in the embodiment of the present application, the decompression process of the streaming decompression is implemented in segments, which can improve the problem of intensive disk writes in the decompression process and improve the operational stability of the system.

[0201] Reference Fig.12 In an embodiment of the present application, a device for compressing business data is also provided, and the device for compressing business data includes:

[0202] An acquisition unit 1210 is used to acquire target service data to be compressed;

[0203] The compression unit 1220 is used to perform segment compression on the target business data to obtain a first compressed file; wherein the first compressed file includes a first file header, a tail file header and a plurality of first compressed segments;

[0204] A generating unit 1230, configured to generate a second file header according to the first file header, the starting position information of each first compressed segment, and the tail file header;

[0205] The encapsulation unit 1240 is used to encapsulate the first compressed file and the second file header to obtain a target compressed file.

[0206] Optionally, the compression unit is specifically configured to:

[0207] Obtain preset compression parameters; the compression parameters are used to set the threshold value of the number of compressed segments obtained after shard compression and the threshold value of the amount of data contained in the compressed segments;

[0208] According to the compression parameters, the target business data is segmented and compressed to obtain a first number of first compressed segments; wherein the first number is less than or equal to a number threshold, and a first data volume contained in each first compressed segment is less than or equal to a data volume threshold.

[0209] Optionally, the generating unit is specifically used for:

[0210] Detecting a second data amount of the first file header;

[0211] Performing hash processing on the second data volume, the starting position information, and the tail file header to obtain a first hash value;

[0212] A second file header is generated according to the second data amount, the starting position information, the tail file header and the first Hash value.

[0213] Optionally, the generating unit is further configured to:

[0214] Generate signature information corresponding to the first compressed file according to the file type or file format of the first compressed file;

[0215] Add the signature information to the second file header.

[0216] Optionally, the generating unit is further configured to:

[0217] Performing hash processing on each first compressed segment to obtain a second hash value;

[0218] The second hash value is added to the second file header.

[0219] Optionally, the compression device further includes a second generating unit, and the second generating unit is specifically configured to:

[0220] detecting a third data amount of the second file header;

[0221] The file name information or uniform resource locator information corresponding to the target compressed file is generated according to the third data volume and the first hash value.

[0222] It is understandable that if Figure 2 The contents of the business data compression method embodiment shown in the figure are applicable to the business data compression device embodiment of the present invention. The functions specifically implemented by the business data compression device embodiment of the present invention are similar to those of the present invention. Figure 2 The method for compressing business data shown in the embodiment is the same as that shown in the embodiment, and the beneficial effects achieved are the same as those Figure 2 The beneficial effects achieved by the illustrated embodiment of the method for compressing business data are also the same.

[0223] Reference Fig.13 , the embodiment of the present application provides a decompression device for business data, the decompression device comprising:

[0224] The first downloading unit 1310 is used to download the second file header in the target compressed file to be decompressed; the target compressed file is obtained by encapsulating the second file header and the first compressed file, the first compressed file includes the first file header, the tail file header and multiple first compressed segments, and the second file header is generated according to the first file header, the starting position information of each first compressed segment and the tail file header;

[0225] The parsing unit 1320 is used to parse the second file header to obtain the starting position information and the tail file header of each first compressed segment;

[0226] The second downloading unit 1330 is used to download and decompress each first compressed segment in the target compressed file in sequence according to the starting position information and the tail file header.

[0227] Optionally, the first downloading unit is specifically used for:

[0228] Obtain the file name information or uniform resource locator information corresponding to the target compressed file;

[0229] Determine a third data amount according to the file name information or the uniform resource locator information; the third data amount is used to represent the data amount of the second file header;

[0230] According to the third data amount, the second file header in the target compressed file to be decompressed is downloaded.

[0231] Optionally, the second file header includes a first hash value, which is obtained by performing hash processing on the second data amount, the starting position information and the tail file header of the first file header; the decompression device also includes a first verification unit, which is specifically used to:

[0232] Performing hash processing on the second data volume, the starting position information, and the tail file header to obtain a verification hash value;

[0233] Comparing the first hash value and the verification hash value to see if they are consistent;

[0234] If the first hash value and the verification hash value are inconsistent, the decompression task of the target compressed file is terminated.

[0235] Optionally, the second file header includes a second hash value, which is obtained by performing hash processing on each first compressed segment; the decompression device also includes a second verification unit, which is specifically used to:

[0236] Downloading the first compressed segment according to the starting position information;

[0237] Performing a consistency check on the first compressed segment currently being downloaded according to the second hash value;

[0238] If the consistency check passes, the first compressed segment currently being downloaded is decompressed according to the tail file header, and the process returns to the step of downloading the first compressed segment according to the starting position information; or, if the consistency check fails, the decompression task of the target compressed file is terminated.

[0239] It is understandable that if Figure 6 The contents of the business data decompression method embodiment shown in the figure are applicable to the business data compression device embodiment of the present invention. The functions specifically implemented by the business data decompression device embodiment of the present invention are similar to those of the present invention. Figure 6 The decompression method embodiment of the business data shown is the same as that of the embodiment of the business data decompression method shown in FIG. Figure 6 The beneficial effects achieved by the illustrated business data decompression method embodiment are also the same.

[0240] The present application also discloses an electronic device, including:

[0241] at least one processor;

[0242] at least one memory for storing at least one program;

[0243] When at least one program is executed by at least one processor, the at least one processor implements Figure 2 The compression method of the business data shown or Figure 6 An embodiment of a method for decompressing business data is shown.

[0244] It is understandable that if Figure 2 The compression method of the business data shown or Figure 6 The contents of the decompression method of business data in the embodiment shown in FIG. 1 are applicable to the electronic device embodiment. The functions specifically implemented by the electronic device embodiment are similar to those in FIG. 1 . Figure 2The compression method of the business data shown or Figure 6 The decompression method embodiment of the business data shown is the same as that of the embodiment of the business data decompression method shown in FIG. Figure 2 The compression method of the business data shown or Figure 6 The beneficial effects achieved by the illustrated business data decompression method embodiment are also the same.

[0245] The electronic device of the embodiment of the present application may be a terminal device, a computer device or a server device.

[0246] For example, refer to Fig.14 , Fig.14 Schematic diagram of the structure of an electronic device provided in an embodiment of the present application. Taking the electronic device as a terminal device as an example, Fig.14 In the embodiment, the terminal device 1400 may include an RF (Radio Frequency) circuit 1410, a memory 1420 including one or more computer-readable storage media, an input unit 1430, a display unit 1440, a sensor 1450, an audio circuit 1460, a short-range wireless transmission module 1470, a processor 1480 including one or more processing cores, and a power supply 1490. Those skilled in the art will appreciate that Fig.14 The device structure shown in the figure does not constitute a limitation on the terminal device, and may include more or fewer components than shown in the figure, or combine certain components, or arrange the components differently.

[0247] The RF circuit 1410 can be used for receiving and sending signals during information transmission or calls. In particular, after receiving the downlink information of the base station, it is handed over to one or more processors 1480 for processing; in addition, the data related to the uplink is sent to the base station. Generally, the RF circuit 1410 includes but is not limited to an antenna, at least one amplifier, a tuner, one or more oscillators, a subject identity module (SIM) card, a transceiver, a coupler, an LNA (Low Noise Amplifier), a duplexer, etc. In addition, the RF circuit 1410 can also communicate with the network and other devices through wireless communication. Wireless communication can use any communication standard or protocol, including but not limited to GSM (Global System of Mobile communication), GPRS (General Packet Radio Service), CDMA (Code Division Multiple Access), WCDMA (Wideband Code Division Multiple Access), LTE (Long Term Evolution), email, SMS (Short Messaging Service), etc.

[0248] The memory 1420 can be used to store software programs and modules (or units). The processor 1480 executes various functional applications and data processing by running the software programs and modules (or units) stored in the memory 1420. The memory 1420 may mainly include a program storage area and a data storage area, wherein the program storage area may store an operating system, an application required for at least one function (such as a sound playback function, an image playback function), etc.; the data storage area may store data created according to the use of the terminal device 1400 (such as audio data, a phone book), etc. In addition, the memory 1420 may include a high-speed random access memory, and may also include a non-volatile memory, such as at least one disk storage device, a flash memory device, or other volatile solid-state storage devices. Accordingly, the memory 1420 may also include a memory controller to provide the processor 1480 and the input unit 1430 with access to the memory 1420. Although Fig.14 The RF circuit 1410 is shown, but it is understandable that it is not a necessary component of the terminal device 1400 and can be omitted as needed without changing the essence of the invention.

[0249] The input unit 1430 can be used to receive input digital or character information, and generate keyboard, mouse, joystick, optical or trackball signal input related to object setting and function control. Specifically, the input unit 1430 may include a touch-sensitive surface 1431 and other input devices 1432. The touch-sensitive surface 1431, also known as a touch display screen or touch pad, can collect touch operations of an object on or near it (such as operations of an object using a finger, stylus or any other suitable object or accessory on or near the touch-sensitive surface 1431), and drive the corresponding connection device according to a pre-set program. Optionally, the touch-sensitive surface 1431 may include a touch detection device and a touch controller. Among them, the touch detection device detects the touch orientation of the object, detects the signal brought by the touch operation, and transmits the signal to the touch controller; the touch controller receives the touch information from the touch detection device, converts it into touch point coordinates, and then sends it to the processor 1480, and can receive instructions sent by the processor 1480 and execute them. In addition, the touch-sensitive surface 1431 may be implemented in various types such as resistive, capacitive, infrared, and surface acoustic wave. In addition to the touch-sensitive surface 1431, the input unit 1430 may further include other input devices 1432. Specifically, the other input devices 1432 may include, but are not limited to, one or more of a physical keyboard, a function key (such as a volume control key, a switch key, etc.), a trackball, a mouse, a joystick, and the like.

[0250] The display unit 1440 may be used to display information input by an object or information provided to an object and to control various graphic object interfaces of the terminal device 1400, which may be composed of graphics, text, icons, videos, and any combination thereof. The display unit 1440 may include a display panel 1441. Optionally, the display panel 1441 may be configured in the form of an LCD (Liquid Crystal Display), an OLED (Organic Light-Emitting Diode), or the like. Further, the touch-sensitive surface 1431 may be overlaid on the display panel 1441. When the touch-sensitive surface 1431 detects a touch operation on or near it, it is transmitted to the processor 1480 to determine the type of touch event. Subsequently, the processor 1480 provides corresponding visual output on the display panel 1441 according to the type of touch event. Although in Fig.14 In the embodiment, the touch-sensitive surface 1431 and the display panel 1441 are implemented as two independent components to implement input and output functions, but in some embodiments, the touch-sensitive surface 1431 and the display panel 1441 can be integrated to implement input and output functions.

[0251] The terminal device 1400 may also include at least one sensor 1450, such as a light sensor, a motion sensor, and other sensors. Specifically, the light sensor may include an ambient light sensor and a proximity sensor, wherein the ambient light sensor may adjust the brightness of the display panel 1441 according to the brightness of the ambient light, and the proximity sensor may turn off the display panel 1441 or the backlight when the terminal device 1400 is moved to the ear. As a type of motion sensor, the gravity acceleration sensor can detect the magnitude of acceleration in each direction (generally three axes), and can detect the magnitude and direction of gravity when stationary, which can be used for applications that identify the posture of the mobile phone (such as horizontal and vertical screen switching, related games, magnetometer posture calibration), vibration recognition related functions (such as pedometer, tapping), etc.; as for other sensors such as gyroscopes, barometers, hygrometers, thermometers, infrared sensors, etc. that can also be configured in the terminal device 1400, they will not be repeated here.

[0252] The audio circuit 1460, the speaker 1461, and the microphone 1462 can provide an audio interface between the object and the terminal device 1400. The audio circuit 1460 can transmit the electrical signal converted from the received audio data to the speaker 1461, which is converted into a sound signal for output; on the other hand, the microphone 1462 converts the collected sound signal into an electrical signal, which is received by the audio circuit 1460 and converted into audio data, and then the audio data is output to the processor 1480 for processing, and then sent to another electronic device through the RF circuit 1414, or the audio data is output to the memory 1420 for further processing. The audio circuit 1460 may also include an earplug jack to provide communication between an external headset and the terminal device 1400.

[0253] The short-range wireless transmission module 1470 may be a WIFI (wireless fidelity) module, a Bluetooth module, an infrared module, etc. The terminal device 1400 may transmit information with wireless transmission modules provided on other devices through the short-range wireless transmission module 1470 .

[0254] The processor 1480 is the control center of the terminal device 1400. It uses various interfaces and lines to connect various parts of the entire device. By running or executing software programs or modules stored in the memory 1420, and calling data stored in the memory 1420, it executes various functions of the terminal device 1400 and processes data, thereby controlling the device as a whole. Optionally, the processor 1480 may include one or more processing cores; optionally, the processor 1480 may integrate an application processor and a modem processor, wherein the application processor mainly processes the operating system, object interface and application programs, etc., and the modem processor mainly processes wireless communications. It is understandable that the above-mentioned modem processor may not be integrated into the processor 1480.

[0255] The terminal device 1400 also includes a power supply 1490 (such as a battery) for supplying power to various components. Optionally, the power supply 1490 can be logically connected to the processor 1480 through a power management system, so as to manage charging, discharging, and power consumption through the power management system. The power supply 1490 can also include any components such as one or more DC or AC power supplies, recharging systems, power failure detection circuits, power converters or inverters, and power status indicators.

[0256] Although not shown, the terminal device 1400 may also include a camera, a Bluetooth module, etc., which will not be described in detail here.

[0257] For example, taking the electronic device as a server device as an example, referring to Fig.15 The server device 1500 may have relatively large differences due to different configurations or performances, and may include one or more central processing units 1510 (abbreviated as CPU, Central Processing Units) and memory 1560, and one or more storage media 1530 (such as one or more mass storage devices) storing application programs 1533 or data 1532. Among them, the memory 1560 and the storage medium 1530 can be temporary storage or permanent storage. The program stored in the storage medium 1530 may include one or more units or modules, and each unit or module may include a series of operating instructions in the server device 1500. Furthermore, the central processing unit 1510 can be configured to communicate with the storage medium 1530 and execute a series of operating instructions in the storage medium 1530 on the server device 1500.

[0258] The server device 1500 may further include one or more power supplies 1520 , one or more wired or wireless network interfaces 1540 , one or more input and output interfaces 1550 , and one or more operating systems 1531 .

[0259] The CPU 1510 in the server device 1500 may be used to execute the following Figure 2 The compression method of the business data shown or Figure 6 An embodiment of a method for decompressing business data is shown.

[0260] The present application also discloses a computer-readable storage medium in which a program executable by a processor is stored. When the program executable by the processor is executed by the processor, it is used to implement the following Figure 2 The compression method of the business data shown or Figure 6 An embodiment of a method for decompressing business data is shown.

[0261] Understandably, Figure 2The compression method of the business data shown or Figure 6 The contents of the business data decompression method embodiment shown in the figure are applicable to the computer-readable storage medium embodiment, and the functions specifically implemented by the computer-readable storage medium embodiment are the same as those in the embodiment of FIG. Figure 2 The compression method of the business data shown or Figure 6 The decompression method embodiment of the business data shown is the same as that of Figure 2 The compression method of the business data shown or Figure 6 The beneficial effects achieved by the illustrated business data decompression method embodiment are also the same.

[0262] The embodiment of the present application further discloses a computer program product or a computer program, the computer program product or the computer program comprising computer instructions, the computer instructions being stored in the above-mentioned computer-readable storage medium; Fig.14 , Fig.15 The processor of the electronic device shown can read the computer instruction from the above-mentioned computer readable storage medium, and the processor executes the computer instruction so that the computer device executes Figure 2 The compression method of the business data shown or Figure 6 An embodiment of a method for decompressing business data is shown.

[0263] Understandably, Figure 2 The compression method of the business data shown or Figure 6 The contents of the business data decompression method embodiment shown in the figure are applicable to the present computer program product or computer program embodiment, and the functions specifically implemented by the present computer program product or computer program embodiment are the same as those in the embodiment of FIG. Figure 2 The compression method of the business data shown or Figure 6 The decompression method embodiment of the business data shown is the same as that of Figure 2 The compression method of the business data shown or Figure 6 The beneficial effects achieved by the illustrated business data decompression method embodiment are also the same.

[0264] In some selectable embodiments, the function / operation mentioned in the block diagram may not occur in the order mentioned in the operation diagram. For example, depending on the function / operation involved, the two boxes shown in succession can actually be executed substantially simultaneously or the boxes can sometimes be executed in reverse order. In addition, the embodiment presented and described in the flow chart of the application is provided by way of example, for the purpose of providing a more comprehensive understanding of technology. The disclosed method is not limited to the operation and logic flow presented herein. Selectable embodiments are expected, wherein the order of various operations is changed and the sub-operation of a part described as a larger operation is performed independently.

[0265] In addition, although the present application is described in the context of functional modules, it should be understood that, unless otherwise specified, one or more of the functions and / or features can be integrated into a single physical device and / or software module, or one or more functions and / or features can be implemented in a separate physical device or software module. It is also understood that a detailed discussion of the actual implementation of each module is unnecessary for understanding the present application. More specifically, in view of the properties, functions, and internal relationships of the various functional modules in the device disclosed herein, the actual implementation of the module will be understood within the conventional techniques of the engineer. Therefore, those skilled in the art can implement the present application set forth in the claims without excessive experimentation using ordinary techniques. It is also understood that the specific concepts disclosed are merely illustrative and are not intended to limit the scope of the present application, which is determined by the full scope of the attached claims and their equivalents.

[0266] If the function is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application, or the part that contributes to the prior art or the part of the technical solution, can be embodied in the form of a software product, which is stored in a storage medium and includes several instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the various embodiments of the present application. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), disk or optical disk, and other media that can store program codes.

[0267] The logic and / or steps represented in the flowchart or otherwise described herein, for example, may be considered as an ordered list of executable instructions for implementing logical functions, and may be embodied in any computer-readable storage medium for use by an instruction execution system, apparatus, or device (such as a computer-based system, a system including a processor, or other system that can fetch instructions from an instruction execution system, apparatus, or device and execute instructions), or in conjunction with such instruction execution system, apparatus, or device. For purposes of this specification, a "computer-readable storage medium" may be any device that can contain, store, communicate, propagate, or transmit a program for use by an instruction execution system, apparatus, or device, or in conjunction with such instruction execution system, apparatus, or device.

[0268] It should be understood that the various parts of the present application can be implemented by hardware, software, firmware or a combination thereof. In the above-mentioned embodiments, multiple steps or methods can be implemented by software or firmware stored in a memory and executed by a suitable instruction execution system. For example, if implemented by hardware, as in another embodiment, it can be implemented by any one of the following technologies known in the art or their combination: a discrete logic circuit having a logic gate circuit for implementing a logic function for a data signal, a dedicated integrated circuit having a suitable combination of logic gate circuits, a programmable gate array (PGA), a field programmable gate array (FPGA), etc.

[0269] In the above description of this specification, the description with reference to the terms "one embodiment / example", "another embodiment / example" or "certain embodiments / examples" etc. means that the specific features, structures, materials or characteristics described in conjunction with the embodiment or example are included in at least one embodiment or example of the present application. In this specification, the schematic representation of the above terms does not necessarily refer to the same embodiment or example. Moreover, the specific features, structures, materials or characteristics described may be combined in any one or more embodiments or examples in a suitable manner.

[0270] Although the embodiments of the present application have been shown and described, those skilled in the art will appreciate that various changes, modifications, substitutions and variations may be made to the embodiments without departing from the principles and spirit of the present application, and that the scope of the present application is defined by the claims and their equivalents.

[0271] The above is a specific description of the preferred implementation of the present application, but the present application is not limited to the embodiments. Technical personnel familiar with the field can make various equivalent modifications or substitutions without violating the spirit of the present application. These equivalent modifications or substitutions are all included in the scope defined by the claims of the present application.

Claims

1. A method for compressing business data, characterized in that: The compression method comprises: Obtain target business data to be compressed; The target business data is compressed in segments to obtain a first compressed file; wherein the first compressed file includes a first file header, a tail file header and a plurality of first compressed segments; Generate a second file header according to the first file header, the starting position information of each of the first compressed segments, and the tail file header; The first compressed file and the second file header are encapsulated to obtain a target compressed file.

2. The method for compressing business data according to claim 1, characterized in that: The step of compressing the target service data into slices to obtain a first compressed file includes: Obtaining preset compression parameters; the compression parameters are used to set a threshold value for the number of compressed segments obtained after slicing compression and a threshold value for the amount of data contained in the compressed segments; According to the compression parameters, the target business data is segmented and compressed to obtain a first number of first compressed segments; wherein the first number is less than or equal to the number threshold, and the first data amount contained in each of the first compressed segments is less than or equal to the data amount threshold.

3. The method for compressing business data according to claim 1, characterized in that: The generating a second file header according to the first file header, the starting position information of each of the first compressed segments and the tail file header includes: Detecting a second data amount of the first file header; Performing hash processing on the second data volume, the starting position information, and the tail file header to obtain a first hash value; A second file header is generated according to the second data volume, the starting position information, the tail file header and the first hash value.

4. The method for compressing business data according to claim 3, characterized in that: The method further comprises: Generate signature information corresponding to the first compressed file according to the file type or file format of the first compressed file; The signature information is added to the second file header.

5. The method for compressing business data according to claim 3, characterized in that: The method further comprises: Performing hash processing on each of the first compressed segments to obtain a second hash value; Add the second hash value to the second file header.

6. The method for compressing business data according to any one of claims 3 to 5, characterized in that: The method further comprises: detecting a third data amount of the second file header; The file name information or uniform resource locator information corresponding to the target compressed file is generated according to the third data volume and the first hash value.

7. A method for decompressing business data, characterized in that: The decompression method comprises: Downloading a second file header in a target compressed file to be decompressed; the target compressed file is obtained by encapsulating the second file header and the first compressed file, the first compressed file includes a first file header, a tail file header and a plurality of first compressed segments, and the second file header is generated according to the first file header, the starting position information of each of the first compressed segments and the tail file header; Parsing the second file header to obtain the starting position information of each of the first compressed segments and the tail file header; According to the starting position information and the tail file header, each of the first compressed segments in the target compressed file is downloaded and decompressed in sequence.

8. The method for decompressing business data according to claim 7, characterized in that: The second file header in the target compressed file to be decompressed is downloaded, including: Obtaining file name information or uniform resource locator information corresponding to the target compressed file; Determine a third data amount according to the file name information or the uniform resource locator information; the third data amount is used to represent the data amount of the second file header; According to the third data amount, the second file header in the target compressed file to be decompressed is downloaded.

9. The method for decompressing business data according to claim 7, characterized in that: The second file header includes a first hash value, and the first hash value is obtained by performing hash processing on the second data amount, the starting position information and the tail file header of the first file header; after the step of parsing the second file header to obtain the starting position information and the tail file header of each first compressed segment, the method further includes: Performing hash processing on the second data volume, the starting position information, and the tail file header to obtain a verification hash value; Comparing whether the first Hash value and the verification Hash value are consistent; If the first Hash value and the verification Hash value are inconsistent, the decompression task of the target compressed file is terminated.

10. The method for decompressing business data according to claim 7, characterized in that: The second file header includes a second Hash value, where the second Hash value is obtained by performing Hash processing on each of the first compressed segments; The downloading and decompressing the first compressed segments in the target compressed file in sequence according to the starting position information and the tail file header includes: Downloading the first compressed segment according to the starting position information; Performing a consistency check on the first compressed segment currently being downloaded according to the second Hash value; If the consistency check passes, the first compressed fragment currently being downloaded is decompressed according to the tail file header, and the step of downloading the first compressed fragment according to the starting position information is returned; or, if the consistency check fails, the decompression task of the target compressed file is terminated.

11. A device for compressing business data, characterized in that: The compression device comprises: An acquisition unit, used for acquiring target service data to be compressed; A compression unit, configured to perform segment-by-segment compression on the target service data to obtain a first compressed file; wherein the first compressed file includes a first file header, a tail file header, and a plurality of first compressed segments; a generating unit, configured to generate a second file header according to the first file header, the starting position information of each of the first compressed segments, and the tail file header; The encapsulation unit is used to encapsulate the first compressed file and the second file header to obtain a target compressed file.

12. A device for decompressing business data, characterized in that: The decompression device comprises: A first downloading unit is used to download a second file header in a target compressed file to be decompressed; the target compressed file is obtained by encapsulating the second file header and the first compressed file, the first compressed file includes a first file header, a tail file header and a plurality of first compressed segments, and the second file header is generated according to the first file header, the starting position information of each of the first compressed segments and the tail file header; A parsing unit, configured to parse the second file header to obtain the starting position information of each of the first compressed segments and the tail file header; The second downloading unit is used to download and decompress the first compressed segments in the target compressed file in sequence according to the starting position information and the tail file header.

13. An electronic device comprising a memory and a processor, wherein the memory stores a computer program, wherein: When the processor executes the computer program, the method according to any one of claims 1 to 10 is implemented.

14. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, the method according to any one of claims 1 to 10 is implemented.

15. A computer program product comprising a computer program, characterized in that When the computer program is executed by a processor, the method according to any one of claims 1 to 10 is implemented.

Citation Information

Cited By

  • Remote file differential transmission and iteration method and device

    CN120849355A

  • Remote file differential transfer and iteration method and apparatus

    CN120849355B

  • Method and device for optimizing program based on user video data and medium

    CN121037639A

  • A method, apparatus, and medium for optimizing user video data.

    CN121037639B