CN115865900A - Data breakpoint downloading method and system - Google Patents

Data breakpoint downloading method and system Download PDF

Info

Publication number
CN115865900A
CN115865900A CN202211520909.0A CN202211520909A CN115865900A CN 115865900 A CN115865900 A CN 115865900A CN 202211520909 A CN202211520909 A CN 202211520909A CN 115865900 A CN115865900 A CN 115865900A
Authority
CN
China
Prior art keywords
data
storage address
target file
download
server
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202211520909.0A
Other languages
Chinese (zh)
Inventor
刘琪
张凯翔
王雪剑
高道斌
樊凯
徐大创
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Zhongke Meiluo Technology Co ltd
Original Assignee
Zhongke Meiluo Technology Co ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Zhongke Meiluo Technology Co ltd filed Critical Zhongke Meiluo Technology Co ltd
Priority to CN202211520909.0A priority Critical patent/CN115865900A/en
Publication of CN115865900A publication Critical patent/CN115865900A/en
Pending legal-status Critical Current

Links

Images

Abstract

The invention provides a data breakpoint downloading method and a system, wherein the method comprises the following steps: allocating a first storage address for the target file according to a downloading instruction of a user for the target file; requesting data of a target file from a server according to a downloading instruction, receiving downloading data returned by the server, caching the downloading data to a first storage address, and judging whether the change condition of the downloading data in the first storage address needs breakpoint resuming operation or not; if yes, generating Range information according to the data size of the downloaded data stored in the cache position, and sending the Range information to the server side; receiving the residual data, taking the received residual data as download data, and returning to the step of caching the download data to the first storage address; and analyzing all downloaded data of the target file in the cache position to obtain the target file and transferring the target file to a second storage address. By applying the embodiment of the invention, the reliability of breakpoint continuous transmission can be improved.

Description

Data breakpoint downloading method and system
Technical Field
The invention relates to the technical field of breakpoint continuous transmission, in particular to a data breakpoint downloading method and system.
Background
The principle of breakpoint download is that Range and Content-Range fields of a HTTP header related to breakpoint download are defined in HTTP1.1 Protocol (Hyper Text Transfer Protocol, version RFC 2616), which supports requesting only a part of a resource. Range is sent by a client to a server and can request one or more sub-ranges of file resources.
The Content-Range field is returned by the server to the client, and is used for explaining that the server returns a certain Range (after being downloaded) of the file and the total length of the file. According to the existing method, the breakpoint download needs local cache and maintenance of download data.
However, the inventor finds that the storage location of the local cache is fixed and public, so that the local cache is relatively easy to find, and once the data in the local cache is tampered, the Range field returned by the client is in error, thereby causing a breakpoint resuming failure. Therefore, the prior art has the defect of low breakpoint continuous transmission reliability.
Disclosure of Invention
The technical problem to be solved by the present invention is how to provide a data breakpoint downloading method and system to solve the problem of low breakpoint resume reliability in the prior art.
The invention solves the technical problems through the following technical means:
the invention provides a data breakpoint downloading method, which is applied to a client and comprises the following steps:
according to a downloading instruction of a user for a target file, allocating a first storage address for the target file, wherein the downloading instruction comprises a second storage address of the target file specified by the user;
requesting data of a target file from a server according to the downloading instruction, receiving downloading data returned by the server, caching the downloading data to the first storage address, and judging whether the change condition of the downloading data in the first storage address needs breakpoint resuming operation or not;
if so, generating Range information according to the data size of the downloaded data stored in the cache position, and sending the Range information to the server so as to enable the server to return the residual data corresponding to the target file; receiving residual data, taking the received residual data as download data, and returning to execute the step of caching the download data to the first storage address until all download data of the target file are obtained, wherein the residual data are other data except the download data in the target file;
and analyzing all downloaded data of the target file in the cache position to obtain the target file and transferring the target file to a second storage address.
Optionally, the allocating a first storage address to the target file includes:
the method comprises the steps of obtaining a storage address list of a client, and randomly selecting an address from the storage address list as a first storage address.
Optionally, the allocating a first storage address to the target file includes:
the method comprises the steps of obtaining a storage address list of a client, and selecting a first number of addresses from the storage address list as alternative addresses according to a preset strategy;
sending the first quantity to a server so that the server can divide the target file into a first quantity of data segments according to the first quantity, setting a unique number for each data segment, and adding the number to each data packet corresponding to the data segment;
receiving a data packet corresponding to a target file returned by a server, extracting a number corresponding to the data packet, traversing each alternative address according to the number, and judging whether the data packet of downloaded data in each alternative address contains the number;
if so, taking the alternative address as a first storage address corresponding to the data packet, and caching the data packet in the first storage address;
if not, deleting the alternative addresses in which the downloaded data is cached from the alternative address set to obtain a residual alternative address set, and randomly selecting one alternative address from the residual alternative address set as a first storage address for caching the data packet; and returning to execute the step of receiving the data packets corresponding to the data segments returned by the server side until all the data packets corresponding to the target data are received.
Optionally, the selecting a first number of addresses from the storage address list as alternative addresses according to a preset policy includes:
obtaining hash values of all storage addresses in a storage address list to obtain a plurality of hash values;
calculating the distances between the hash values and other hash values one by one aiming at each hash value, and taking the sum of the distances as the label value of the hash value;
sequencing all the hash values according to the sequence of the label values from small to large to obtain a hash value sequence; and taking the storage address corresponding to the hash value with the smallest label value in the first number of sequential orders in the hash value sequence as an alternative address.
Optionally, the caching the download data to the first storage address includes:
acquiring first system information of a target file at a server; acquiring second binary information of the client, and judging whether the first binary information is consistent with the second binary information;
and if so, caching the downloaded data to a first storage address.
Optionally, the caching the downloaded data to the first storage address includes
Acquiring storage format information of the target file at a server;
and packaging the downloaded data by using the storage format information, caching the downloaded data to a first storage address, and providing a Range information reading interface for the downloaded data for a file management system of the client.
Optionally, the encapsulating the download data by using the storage format information includes:
and packaging the downloaded data and replacing the attribute information of the downloaded data by using the storage format information.
Optionally, the encapsulating the download data by using the storage format information includes:
establishing a virtual machine according to the storage environment information of the target file, and caching the downloaded data in the virtual machine;
and taking the position of the cache downloading data in the virtual machine as a first storage address.
Optionally, the generating Range information according to the data size of the downloaded data stored in the cache location includes:
acquiring a first hash value corresponding to target data, and acquiring a stored second hash value from each first storage address, wherein the second hash value is a hash value aiming at the target data acquired when a client receives download data from a server;
judging whether the second hash value exists in the data with the same first hash value;
if yes, analyzing Range information of the downloaded data by using a cache analysis method;
if not, establishing a new Session, and executing the step of receiving the residual data and taking the received residual data as the download data.
The invention also provides a data breakpoint downloading system, which comprises a client and a server, wherein,
the client is configured to perform the method of any of claims 1-9;
and the server is used for returning the download data to the client according to the download instruction and returning the residual data of the target file serving as the download data to the client according to the Range information.
The invention has the advantages that:
according to the method and the device, the target file is cached in the first storage address instead of the second storage address specified by a user or the second storage address default in the downloading process, so that the difficulty of obtaining the first storage address by a falsifier is improved, the possibility of exposing the first storage address is further reduced, and finally the reliability of breakpoint continuous transmission is improved.
Drawings
Fig. 1 is a schematic flowchart of a data breakpoint downloading method according to an embodiment of the present invention;
fig. 2 is a schematic diagram of a Session initiation method in a data breakpoint download method according to an embodiment of the present invention;
fig. 3 is a schematic structural diagram of a data breakpoint download system according to an embodiment of the present invention.
Detailed Description
In order to make the objects, technical solutions and advantages of the embodiments of the present invention clearer, the technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the embodiments of the present invention, and it is obvious that the described embodiments are some embodiments of the present invention, but not all embodiments. All other embodiments, which can be obtained by a person skilled in the art without inventive step based on the embodiments of the present invention, are within the scope of protection of the present invention.
Example 1
First, it should be noted that embodiment 1 of the present invention is preferably applied to a client, for example, a terminal device such as a mobile phone, a tablet computer, or a notebook computer.
Fig. 1 is a schematic flowchart of a data breakpoint downloading method according to an embodiment of the present invention, as shown in fig. 1, the method includes:
s101: according to a downloading instruction of a user for a target file, a first storage address is allocated to the target file, wherein the downloading instruction comprises a second storage address of the target file specified by the user.
For example, the embodiment of the present invention is described by taking a mobile phone with an iOS system as a client and a server with a kylin Linux system as a server as an example. When the user inputs a download instruction on the mobile phone, the download instruction at least comprises identification information of the target file, and downloads the target file, the target file should be stored in a second storage address of the position in the mobile phone. In general, the second storage address may be a default download address of the system on the client, for example, a default download address of a download process in the mobile phone system, which is usually a download folder, and in the default download address, the downloaded file is stored in the folder regardless of any download instruction. Alternatively, the user sets a download address on the client manually, for example, under a file set by the user for storing songs, or a folder set by the user for storing pictures, but the download address is set manually by the user, or set manually by the user at the time of first use.
The client sends a request for downloading the target file to the server according to the downloading instruction, the server analyzes the downloading request to obtain the identification information of the target file, the target file stored in the server is found out according to the identification information, and the target file is sent to the client in the form of a data packet.
The client can allocate a first storage address for a data packet of a target file to be received when the downloading instruction is sent to the server. It is emphasized that the first storage address is different from the second storage address, the first storage address is automatically set by a system of the client according to the downloading instruction, and different downloading instructions can correspond to different first storage addresses; two or more first memory addresses may also be used for multiple download instructions.
In a specific implementation manner of this step, the client may use a tool to read the storage directory information of each file, use each storage directory as a storage address, further obtain a storage address list of the client, and then randomly select one storage address from the storage address list as the first storage address. In practical application, for example, the itool or the updating software can be used to read out the information of all files of the client, and further, the storage directory information of each file can be obtained.
S102: requesting data of the target file from the server according to the downloading instruction, receiving the downloading data returned by the server, caching the downloading data to the first storage address, judging whether the change condition of the downloading data in the first storage address needs breakpoint resuming operation, and if so, executing the step S103.
The client continuously receives the data packet returned by the server and then caches the data packet in the first storage address. One target file corresponds to a plurality of data packets, and the data packets are continuously sent to the client by the server. For example, the target file corresponds to 100 data packets, the server sends the data packets one by one, the client receives the data packets one by one, the client integrally takes the a data packets cached to the first storage address as download data, and the client does not receive the 100-a data packets corresponding to the target file, and then takes the data packets as residual data. It will be appreciated that the size of the data packets is determined according to the file transfer protocol, which should be applicable to both the client and the server.
However, in practical applications, the transmission process of the data packet may be interrupted due to device performance and network fluctuation, which may result in failure or stop of downloading the target file.
Therefore, the client needs to have a process to continuously monitor the downloading condition of the data packet of the target data, and then determines whether a downloading interruption occurs according to the downloading condition, and if a downloading terminal occurs, the step S103 needs to be executed.
S103: generating Range information according to the data volume of the downloaded data stored in the cache position, and sending the Range information to the server so that the server returns the residual data corresponding to the target file; and receiving residual data, taking the received residual data as download data, and returning to execute the step of caching the download data to the first storage address until all download data of the target file are acquired, wherein the residual data are other data except the download data in the target file.
In a first aspect, range information is typically used in the request header to specify the location of the first byte and the location of the last byte, and the general format: range (unit = first byte pos) - [ last byte pos ]. If the target file contains 1 ten thousand bytes, each data packet contains 100 bytes, if a data packets have been cached, and if 100A bytes have been cached in the first storage address, the Range information of the downloaded data includes: first byte pos is 100A +1 byte, last byte pos is 1 ten thousand bytes.
After the client sends the Range information to the server, the server returns a partial response Content-Range to the client, which must describe the Range covered by the response and the entire entity length. General format: content-Range bytes (unit first bytes pos) - [ last bytes pos ]/[ entry length h ]
And then the client interacts with the server, the server sends the B data packets of the target file to the client, and the client caches the B data packets as download data to the first storage address. After the client downloads all 100 data packets, a complete cache file of the target file can be obtained.
In a second aspect, in another implementation manner of this step, when generating Range information according to the data size of the downloaded data stored in the cache location, the client needs to obtain the first hash value corresponding to the target data. The first hash value may be a character string returned by the server for the client to verify whether the target file to be downloaded is complete when the server sends a download request.
In practical application, in order to avoid that the client cannot receive the first hash value, the server puts the first hash value in a data packet and sends the data packet to the client, so that the downloaded data comprises a plurality of hash values. In practical application, in order to avoid the influence on the effective capacity of the data packet caused by inserting the first hash value into each data packet, the server may extract one data packet from every 10 data packets, and insert the first hash value into the data packet, so that the client may be ensured to receive the first hash value, and the effective capacity of the data packet occupied by the character string of the hash value may be reduced.
Since the client may have a plurality of pieces of download data corresponding to a plurality of target files, the hash value in the acquired download data is referred to as a second hash value in the embodiment of the present invention. The second hash value is stored in the data packet, and the download data is composed of a plurality of data packets, so that the second hash value can be directly parsed from the download data by using a cache parsing method.
The client downloads other files once, and each file has one second hash value, so that the client can analyze more than one second hash value; if the client fails to resolve any of the second hash values, the second hash value is null.
Fig. 2 is a schematic diagram of a Session initiation method in the data breakpoint download method according to the embodiment of the present invention, and as shown in fig. 2, a client determines in real time whether there is data in a second hash value that is the same as a first hash value; if the judgment result is yes, the client already receives the downloaded data aiming at the target file, the breakpoint downloading is required, and the breakpoint downloading is premised on the requirement of obtaining Range information of the downloaded data, so that the Range information of the downloaded data is analyzed by using a cache analysis method, and the breakpoint resuming operation is carried out according to the Range information.
If the result of the determination is negative, it is described that the client obtains the second hash value, but the obtained second hash value is not the hash value of the target file, that is, the target file is not yet downloaded, and therefore, a new Session needs to be established, and the downloading operation for the target file is completed.
For the target file with the interrupted downloading, if a new Session is directly established, the target file is downloaded again, so that the downloading time of the target file is too long, and the flow is wasted. Therefore, it is necessary to obtain Range information and then restart the previous Session according to the Range information, or establish a new Session to continue downloading the target file. By applying the embodiment of the invention, the method of hash value comparison can be used for judging whether the breakpoint continuous transmission method is directly started or a new downloading task is established, so that repeated downloading of the downloaded data is avoided, the time consumption can be reduced, and the flow is saved.
S104: and analyzing all downloaded data of the target file in the cache position to obtain the target file and transferring the target file to a second storage address.
And the client analyzes the cache file, so that the target file can be restored, and then the target file is transferred to the second storage address.
According to the method and the device, the target file is cached in the first storage address instead of the second storage address specified by the user or the second storage address with the default downloading process, so that the difficulty of a falsifier for obtaining the first storage address is improved, the possibility of exposing the first storage address is further reduced, and finally the reliability of intermittent continuous transmission is improved.
Furthermore, in order to improve the running performance of the system, the first storage address is an address in the RAM, so that the data in the RAM is directly operated, local storage and maintenance of downloaded data are avoided, and the implementation of breakpoint downloading is simplified. Repeated caching of local data is avoided, system consumption is reduced, and performance is improved.
Example 2
On the basis of embodiment 1 of the present invention, embodiment 2 of the present invention further provides another method for acquiring a first storage address:
s201 (not shown in the figure): the method comprises the steps of obtaining a storage address list of a client, and selecting a first number of addresses from the storage address list as alternative addresses according to a preset strategy.
Specifically, the hash value of each storage address in the storage address list can be obtained to obtain a plurality of hash values; for example, the storage address 1 corresponds to the hash value 1, the storage address 2 corresponds to the hash value 2, and the storage address 3 corresponds to the hash value 3; the storage address 4 corresponds to the hash value 4, and so on. The hash value 1 will be described as an example.
Then, the distance 1 between the hash value 1 and the hash value 2, the distance 2 between the hash value 1 and the hash value 3, the distance 3 between the hash value 1 and the hash value 4, and the distance 4 between the hash value 1 and the hash value 5 are calculated respectively. In practical application, the hash values are character strings with a certain length, and a hamming distance or manhattan distance calculation method can be used for calculation. Further, when the hash algorithm used by the client is updated, the length of the hash value 2 calculated before is inconsistent with the length of the hash value 1 calculated currently, the updated hash algorithm can be used for performing secondary hash on the hash value 1 and the hash value 2 respectively to obtain the secondary hash value 1 of the hash value 1 and the secondary hash value 2 of the hash value 2, and then the hamming distance between the secondary hash value 1 and the secondary hash value 2 is calculated, so that different hash values can be compatible.
Then, the distance 1, the distance 2, the distance 3, and the distance 4 are summed to obtain a label value 1 of the hash value 1. By the above method, the label value 1 of the hash value 1, the label value 2 of the hash value 2, the label value 3 of the hash value 3, the label value 4 of the hash value 4, and the label value 5 of the hash value 5 are calculated, respectively.
Sequencing the hash values according to the sequence of the label values from small to large to obtain a hash value sequence: the resulting hash value sequence is: hash value 1, hash value 2, hash value 3, hash value 4. In the hash value sequence, the label value of the hash value 1 is minimum; the label value of the hash value 2 is larger than that of the hash value 1 and smaller than that of the hash value 3; the label value of hash value 3 is greater than the label value of hash value 2, but less than the label value of hash value 4; the hash value 4 has the largest tag value.
When the first number is 2, the storage address 1 corresponding to the hash value 1, the storage address 2 corresponding to the hash value 2, and the storage address 3 corresponding to the hash value 3 are used as candidate addresses. These three alternative addresses constitute the set of alternative addresses.
It is emphasized that the first number may be 3 or other positive integers.
S202 (not shown): and sending the first quantity to a server so that the server can divide the target file into a first quantity of data segments according to the first quantity, setting a unique number for each data segment, and adding the number to each data packet corresponding to the data segment.
The client sends the first quantity to the server, and the server divides the target file into 3 data segments, such as data segment 1, data segment 2, and data segment 3, wherein data segment 1 includes 33 data packets, data segment 2 includes 33 data packets, and data segment 3 includes 34 data packets. It can be understood that, when performing the splitting of the target file, the average splitting is not performed, and how to perform the splitting of the target file is not limited in the embodiment of the present invention.
The client inserts the number "1" in one or more of the 33 packets included in the data segment 1, inserts the number "2" in one or more of the 33 packets included in the data segment 2, and inserts the number "3" in one or more of the 34 packets included in the data segment 3.
After the server finishes the above operations, the server sequentially sends 33 data packets contained in the data segment 1, 33 data packets contained in the data segment 2, and 34 data packets contained in the data segment 3 to the client.
S203 (not shown): and receiving a data packet corresponding to the target file returned by the server, extracting a number corresponding to the data packet, traversing each alternative address according to the number, and judging whether the data packet of the downloaded data in each alternative address contains the number.
After receiving the data packet a in the data segment 1 of the target file, the client extracts a number corresponding to the data packet from the data packet, for example, if the read number is "1", then traverse each alternative address: memory address 1 and memory address 2. When the number in the packet at the storage address 1 is "1", step S204 is executed. If not, go to step S205.
S204 (not shown): and taking the alternative address as a first storage address corresponding to the data packet, and caching the data packet in the first storage address.
And taking the alternative address with the same cached data packet number as the data packet number of the target file as a first storage address, namely taking the storage address 1 as the first storage address, and caching the data packet received in the step S203 in the storage address.
S205 (not shown): deleting the alternative addresses of which the downloaded data are cached from the alternative address set to obtain a residual alternative address set, and randomly selecting one alternative address from the residual alternative address set as a first storage address for caching the data packet; and returning to execute the step of receiving the data packets corresponding to the data segments returned by the server side until all the data packets corresponding to the target data are received.
And when the data packet exists in the storage address 1 and the number of the data packet in the storage address 1 is not 1, deleting the storage address 1 from the set of the alternative addresses, and traversing each alternative address in the set of the alternative addresses according to the method. For example, if the packet numbered 1 is buffered in the candidate address 2, the packet numbered 1 is buffered in the candidate address 2. The alternative address 2 should also be deleted from the alternative address set.
And if the data packet is not cached in the alternative address 3 and the alternative address 4, taking the alternative address 3 and the alternative address 4 as a residual alternative address set, and randomly selecting one alternative address from the alternative address 3 and the alternative address 4 as the first storage address for use.
Then, the next data packet is received, and step S203 is performed on the next data packet until all data packets are received. In practical application, the data packet may be a +1 in the data segment 1, or may be a data packet b in the data segment 2, and the receiving sequence of the data packets is not limited in the embodiment of the present invention.
By applying the embodiment of the invention, the target file is split, when the client receives the data packets of different data segments, the data packets belonging to different data segments are cached in different first storage addresses, even if one first storage address is found, a falsifier can only obtain part of the data packets but not obtain other data packets, and compared with the technical scheme that all the data packets of the target file are cached in the same first storage address, the embodiment 2 of the invention further reduces the risk of cache address exposure and improves the data security.
Example 3
Based on embodiment 1 of the present invention, embodiment 3 of the present invention provides a specific method for caching the download data in the first storage address, where the method includes:
acquiring first system information of a target file at a server; acquiring second binary information of the client, and judging whether the first binary information is consistent with the second binary information; and if so, caching the downloaded data to a first storage address.
In the prior art, the client needs to calculate Range data and interact with the server, the method steps are complex, errors are prone to occurring, and if Range is calculated incorrectly, the files spliced through breakpoint downloading are invalid. For example, when the client receives a data packet of the target file from the server, the client may also request the server for the first binary information of the target file, for example, when the target file is stored in the server, if the server uses a Linux system, the first binary information of the target file is 1024. When the client is Android, the second binary information is 1024, and when the client is iOS, the second binary information is 1000. Thereby causing the intermittent retransmission to possibly fail.
In order to solve the above problem, in the embodiment of the present invention, the difference between the server and the client is firstly identified, and when the two systems are consistent, the file is cached. Therefore, errors caused by the system distinction can be shielded, and the reliability of breakpoint continuous transmission is improved.
Furthermore, the storage formats of the same target file at the server and the client may be different, and different storage formats correspond to different encoding modes, so that the number of bytes may also be different, that is, the Range information returned by the client may be misaligned with the byte sequence number read by the server from the target file. In order to solve the error caused by the file format, the following steps are added in the embodiment of the invention. Firstly, acquiring storage format information of the target file at a server; and then, packaging the downloaded data, replacing the attribute information of the downloaded data with the storage format information, caching the downloaded data to a first storage address, and providing a Range information reading interface of the downloaded data for a file management system of the client.
For example, the format of the target file in the server is a, and the client stores the downloaded data in the a format after receiving the data packet of the target file, so that errors in the format calculation for Range information can be shielded. Then, the client side carries out caching analysis on the downloaded file based on the A format, and accurate Range information can be obtained.
In another specific real-time manner of the embodiment of the present invention, encapsulating the download data using the storage format information may include the following steps: establishing a virtual machine according to the storage environment information of the target file, and caching the downloaded data in the virtual machine; and taking the position of the cache downloading data in the virtual machine as a first storage address.
In order to further cache errors possibly generated by the parsing process, a virtual machine can be created at the client, the storage format of a target file in the virtual machine, and the version number, the system type and the hardware format of the system are all consistent with those of the server. And storing the download file in the virtual machine, and analyzing the download file in the virtual machine, so that the most accurate Range information can be obtained, and further, the difference between the Range information of the client and the Range information of the server is avoided. The reliability of intermittent continuous transmission is improved.
Finally, due to sudden network interruption, network fluctuation and other reasons, the range of the file returned by the server is different from the range of the downloaded file actually stored locally, so that the two are inconsistent. The method of the embodiment of the invention can also shield the difference caused by network problems.
Example 4
Embodiment 4 provides a data breakpoint download system corresponding to any of embodiments 1 to 3 of the present invention, where the system includes a client and a server, where,
the client is for performing the method of claim;
and the server is used for returning the download data to the client according to the download instruction and returning the residual data of the target file serving as the download data to the client according to the Range information.
Example 5
Fig. 3 is a schematic structural diagram of a data breakpoint download system according to an embodiment of the present invention, and as shown in fig. 3, the system includes a download view, a downloader, cache resolution, session management, thread management, state management, and a tool class.
Downloading a view: the download control system is used for displaying the progress and the state of a certain download and interacting with a user, such as providing the user with control operation entries for starting download, suspending download, cancelling download and the like.
A downloader: the main implementation part of the file download operation. And performing connection interaction with the server, and transmitting the target file stored by the server to the local client.
And (4) cache analysis: the system cache is usually data with a specific format, such as XML, plist, and the like, and the system cache analysis mainly analyzes the data, so that breakpoint information is obtained, and data support is provided for Session recovery. The structural format of the cache files may be different for different system versions, and the differences are shielded by the cache resolution module.
Session management: and managing the download Session, including creating, recovering, destroying and the like of the download Session.
Thread management: and for the condition that a plurality of tasks are downloaded in parallel, starting a plurality of downloading threads and carrying out corresponding thread management. For simultaneously starting a plurality of downloading tasks, a plurality of threads are started and managed through a thread manager, the number of the simultaneously concurrent threads has a maximum value, and the size of the value is determined through hardware and a system.
And (3) state management: managing a download state, the download state comprising: not started, downloading in, suspended, cancelled, completed. Different operations result in a change of the downloaded state, requiring a synchronous change of the download state by the state manager.
Tools: and basic function services such as communication, hash value operation, list control and the like are provided for other parts.
The above examples are only intended to illustrate the technical solution of the present invention, but not to limit it; although the present invention has been described in detail with reference to the foregoing embodiments, it will be understood by those of ordinary skill in the art that: the technical solutions described in the foregoing embodiments may still be modified, or some technical features may be equivalently replaced; and such modifications or substitutions do not depart from the spirit and scope of the corresponding technical solutions of the embodiments of the present invention.

Claims (10)

1. A data breakpoint downloading method is applied to a client, and comprises the following steps:
according to a downloading instruction of a user for a target file, allocating a first storage address for the target file, wherein the downloading instruction comprises a second storage address of the target file specified by the user;
requesting data of a target file from a server according to the downloading instruction, receiving downloading data returned by the server, caching the downloading data to the first storage address, and judging whether the change condition of the downloading data in the first storage address needs breakpoint resuming operation or not;
if yes, generating Range information according to the data size of the downloaded data stored in the cache position, and sending the Range information to the server so that the server returns the residual data corresponding to the target file; receiving residual data, taking the received residual data as download data, and returning to execute the step of caching the download data to the first storage address until all download data of the target file are obtained, wherein the residual data are other data except the download data in the target file;
and analyzing all downloaded data of the target file in the cache position to obtain the target file and transferring the target file to a second storage address.
2. A method for breakpoint download of data according to claim 1, wherein said allocating a first storage address to the target file comprises:
the method comprises the steps of obtaining a storage address list of a client, and randomly selecting an address from the storage address list as a first storage address.
3. A method for breakpoint download of data according to claim 1, wherein said allocating a first storage address to the target file comprises:
the method comprises the steps of obtaining a storage address list of a client, and selecting a first number of addresses from the storage address list as alternative addresses according to a preset strategy;
sending the first quantity to a server so that the server can divide the target file into a first quantity of data segments according to the first quantity, setting a unique number for each data segment, and adding the number to each data packet corresponding to the data segment;
receiving a data packet corresponding to a target file returned by a server, extracting a number corresponding to the data packet, traversing each alternative address according to the number, and judging whether the data packet of downloaded data in each alternative address contains the number;
if so, taking the alternative address as a first storage address corresponding to the data packet, and caching the data packet in the first storage address;
if not, deleting the alternative addresses in which the downloaded data is cached from the alternative address set to obtain a residual alternative address set, and randomly selecting one alternative address from the residual alternative address set as a first storage address for caching the data packet; and returning to execute the step of receiving the data packets corresponding to the data segments returned by the server side until all the data packets corresponding to the target data are received.
4. A method for breakpoint download of data according to claim 3, wherein the selecting a first number of addresses from the storage address list as alternative addresses according to a preset policy includes:
obtaining hash values of all storage addresses in a storage address list to obtain a plurality of hash values;
calculating the distances between the hash values and other hash values one by one aiming at each hash value, and taking the sum of the distances as the label value of the hash value;
sequencing all the hash values according to the sequence of the label values from small to large to obtain a hash value sequence; and taking the storage address corresponding to the hash value with the smallest label value in the first number of sequential orders in the hash value sequence as an alternative address.
5. The method for breakpoint downloading of data according to claim 1, wherein the caching the downloaded data to the first storage address includes:
acquiring first system information of a target file at a server; acquiring second binary information of the client, and judging whether the first binary information is consistent with the second binary information;
and if so, caching the downloaded data to a first storage address.
6. The method for breakpoint download of data according to claim 5, wherein the caching the download data to the first storage address includes:
acquiring storage format information of the target file at a server;
and packaging the downloaded data by using the storage format information, caching the downloaded data to a first storage address, and providing a Range information reading interface for the downloaded data for a file management system of the client.
7. A data breakpoint download method according to claim 6, wherein the encapsulating the download data with the storage format information includes:
and packaging the downloaded data and replacing the attribute information of the downloaded data by using the storage format information.
8. A method for breakpoint download of data according to claim 6, wherein the encapsulating the download data using the storage format information includes:
establishing a virtual machine according to the storage environment information of the target file, and caching the downloaded data in the virtual machine;
and taking the position of the cache downloading data in the virtual machine as a first storage address.
9. A method as claimed in claim 1, wherein the generating Range information according to the data size of the downloaded data stored in the cache location includes:
acquiring a first hash value corresponding to target data, and acquiring a stored second hash value from each first storage address, wherein the second hash value is a hash value aiming at the target data acquired when a client receives download data from a server;
judging whether the second hash value exists in the data with the same first hash value;
if yes, analyzing Range information of the downloaded data by using a cache analysis method;
if not, establishing a new Session, and executing the step of receiving the residual data and taking the received residual data as the download data.
10. A data breakpoint download system is characterized in that the system comprises a client and a server, wherein,
the client is configured to perform the method of any of claims 1-9;
and the server is used for returning the download data to the client according to the download instruction and returning the residual data of the target file serving as the download data to the client according to the Range information.
CN202211520909.0A 2022-11-30 2022-11-30 Data breakpoint downloading method and system Pending CN115865900A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202211520909.0A CN115865900A (en) 2022-11-30 2022-11-30 Data breakpoint downloading method and system

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202211520909.0A CN115865900A (en) 2022-11-30 2022-11-30 Data breakpoint downloading method and system

Publications (1)

Publication Number Publication Date
CN115865900A true CN115865900A (en) 2023-03-28

Family

ID=85668357

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202211520909.0A Pending CN115865900A (en) 2022-11-30 2022-11-30 Data breakpoint downloading method and system

Country Status (1)

Country Link
CN (1) CN115865900A (en)

Similar Documents

Publication Publication Date Title
CN108958927B (en) Deployment method and device of container application, computer equipment and storage medium
CN108287839B (en) Page loading method and equipment
US9350610B2 (en) System and method for configuration management service
US10257110B2 (en) Using a template to update a stack of resources
US6314567B1 (en) Apparatus and method for transferring state data when performing on-line replacement of a running program code and data
US6272536B1 (en) System and method for the distribution of code and data
US8443347B2 (en) Translating declarative models
US20030055809A1 (en) Methods, systems, and articles of manufacture for efficient log record access
US8825750B2 (en) Application server management system, application server management method, management apparatus, application server and computer program
CN114911519A (en) Shared software library for computing devices
CN108512898B (en) File pushing method and device, computer equipment and storage medium
CN111045721B (en) Method, device and storage medium for dynamically modifying Nginx configuration parameters
WO2021120968A1 (en) Server capacity expansion method and capacity expansion system
CN110990335A (en) Log archiving method, device, equipment and computer readable storage medium
CN112069152B (en) Database cluster upgrading method, device, equipment and storage medium
CN111327680B (en) Authentication data synchronization method, device, system, computer equipment and storage medium
US20110321043A1 (en) System, Method and Program Product for Native Interface Optimization of Read-Only Arrays
CN113761412A (en) Application page display method and device, electronic equipment, medium and application system
CN115865900A (en) Data breakpoint downloading method and system
CN116069366A (en) Client application program updating method and device, storage medium and electronic equipment
CN102355486A (en) Data download method and apparatus thereof
CN113364887B (en) File downloading method based on FTP, proxy server and system
CN112947956B (en) Application software upgrading method
CN114490124A (en) Method, device, equipment and medium for calling Application Programming Interface (API)
CN116069744A (en) Data processing method, device, equipment, storage medium and product

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination