Disclosure of Invention
Therefore, embodiments of the present invention provide a file downloading method, apparatus, node, terminal and storage medium based on an NDN network, so as to solve the problem in the prior art that server pressure is large because each downloading requires access to a centralized server.
In order to achieve the above object, an embodiment of the present invention provides the following:
in a first aspect of embodiments of the present invention, a file downloading method based on an NDN network is provided, including: the method comprises the steps that a first NDN node receives a file fragment downloading request from a second NDN node or a requester terminal, wherein the file fragment downloading request comprises a file fragment identifier; when the first NDN node stores the file fragment corresponding to the file fragment identifier, the first NDN node sends the file fragment corresponding to the file fragment identifier to the second NDN node or the requester terminal; when the first NDN node does not store the file fragment corresponding to the file fragment identifier, the first NDN node sends the file fragment downloading request to a third NDN node or a file server; when the first NDN node receives the file fragment downloading request from the second NDN node, the file fragment downloading request is information received by the second NDN node from the requester terminal, and the second NDN node does not store the file fragment corresponding to the file fragment identifier.
In an embodiment of the present invention, when the first NDN node does not store the file fragment corresponding to the file fragment identifier, after the first NDN node sends the file fragment identifier to a third NDN node or a file server, the file downloading method further includes: the first NDN node receives a file fragment corresponding to the file fragment identifier from the third NDN node or the file server; and the first NDN node sends the file fragment corresponding to the file fragment identifier to the second NDN node or the requester terminal.
In another embodiment of the present invention, the file fragment identifier is information received by the requester terminal from the file server; and the file fragment corresponding to the file fragment identification is the file fragment obtained by the file server fragment processing.
In a second aspect of embodiments of the present invention, there is provided a file downloading method based on an NDN network, including: a requester terminal sends a file fragment downloading request to a first NDN node or a second NDN node, wherein the file fragment downloading request comprises a file fragment identifier; when the requester terminal sends a file fragment downloading request to a second NDN node and when the second NDN node does not store a file fragment corresponding to the file fragment identifier, the second NDN node is used for sending the file fragment downloading request to a first NDN node; when the first NDN node stores the file fragment corresponding to the file fragment identifier, the requester terminal receives the file fragment corresponding to the file fragment identifier from the first NDN node; and when the first NDN node does not store the file fragment corresponding to the file fragment identifier, the first NDN node is used for sending the file fragment downloading request to a third NDN node or a file server.
In an embodiment of the present invention, when the first NDN node does not store a file fragment corresponding to the file fragment identifier, and the requester terminal sends a file fragment download request to the first NDN node, the requester terminal receives the file fragment corresponding to the file identifier from the first NDN node, where the file fragment corresponding to the file identifier is information received by the first NDN node from the third NDN node or the file server; when the first NDN node does not store the file fragment corresponding to the file fragment identifier, the requester terminal sends a file fragment downloading request to a second NDN node, and the second NDN node does not store the file fragment corresponding to the file fragment identifier, the requester terminal receives the file fragment corresponding to the file identifier from the second NDN node, and the file fragment corresponding to the file identifier is the information which is received by the first NDN node from the third NDN node or the file server and is forwarded to the second NDN node by the first NDN node.
In a third aspect of embodiments of the present invention, there is provided a file downloading apparatus based on an NDN network, including: a first receiving unit, configured to receive a file fragment downloading request from a second NDN node or a requester terminal, where the file fragment downloading request includes a file fragment identifier; a first sending unit, configured to send, to the second NDN node or the requester terminal, a file fragment corresponding to the file fragment identifier when the first NDN node stores the file fragment corresponding to the file fragment identifier; the first sending unit is further configured to send the file fragment downloading request to a third NDN node or a file server when the first NDN node does not store the file fragment corresponding to the file fragment identifier; when the first receiving unit receives the file fragment downloading request from the second NDN node, the file fragment downloading request is information received by the second NDN node from the requester terminal, and the second NDN node does not store the file fragment corresponding to the file fragment identifier.
In a fourth aspect of embodiments of the present invention, there is provided a file downloading apparatus based on an NDN network, including: a second sending unit, configured to send a file fragment downloading request to the first NDN node or the second NDN node, where the file fragment downloading request includes a file fragment identifier; when the second sending unit sends a file fragment downloading request to a second NDN node and when the second NDN node does not store a file fragment corresponding to the file fragment identifier, the second NDN node is configured to send the file fragment downloading request to a first NDN node; a second receiving unit, configured to receive, from the first NDN node, a file fragment corresponding to the file fragment identifier when the first NDN node stores the file fragment corresponding to the file fragment identifier; and when the first NDN node does not store the file fragment corresponding to the file fragment identifier, the first NDN node is used for sending the file fragment downloading request to a third NDN node or a file server.
In a fifth aspect of an embodiment of the present invention, there is provided an NDN node comprising a first processor and a first memory; wherein the first memory stores code; the first processor executes the code for performing the file download method of the first aspect.
In a sixth aspect of embodiments of the present invention, there is provided a terminal comprising a second processor and a second memory; wherein the second memory stores code; the second processor executes the code for performing the file download method of the second aspect.
In a seventh aspect of embodiments of the present invention, there is provided a computer-readable storage medium storing a program, the program including instructions that, when executed by a computer, cause the computer to perform the file download method of the first aspect or the file download method of the second aspect.
According to the embodiment of the present invention, the NDN network-based downloading method, apparatus, node, terminal, and storage medium provided in the embodiments of the present invention have the following advantages: the file fragments are tried to be downloaded from one NDN node, and when the NDN node does not store the file fragments, the file fragments are tried to be downloaded from other NDN nodes, so that the file server does not need to process each downloading, and the service pressure of the file server is relieved.
Detailed Description
The present invention is described in terms of particular embodiments, other advantages and features of the invention will become apparent to those skilled in the art from the following disclosure, and it is to be understood that the described embodiments are merely exemplary of the invention and that it is not intended to limit the invention to the particular embodiments disclosed. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
The NDN network-based file downloading method provided by the embodiment of the invention is applicable to a framework comprising a plurality of NDN nodes, and at least one node in the plurality of NDN nodes can be a file server. One or more of the plurality of NDN nodes may be a requester terminal. The requester terminal is a terminal used by the user to download the file.
The following specifically describes the embodiments of the present invention.
Example 1
The embodiment provides a file downloading method based on an NDN (named data networking), and the execution main body of the method is an NDN node in the NDN. Referring to fig. 1, the file downloading method includes the following steps.
Step 11, the first NDN node receives a file fragment downloading request from the second NDN node or the requester terminal, where the file fragment downloading request includes a file fragment identifier.
A file fragment download request comprises a file fragment identifier, which is used to identify a file fragment, i.e. a file fragment download request is used to request to download a file fragment.
The file fragment identification is information received by the requester terminal from the file server; and the file fragment corresponding to the file fragment identification is the file fragment obtained by the file server fragment processing.
The file server can fragment and encrypt the issued file. The fragmentation processing may perform fragmentation according to a preset fragmentation algorithm, where the preset algorithm may be a fragmentation algorithm in the prior art, for example, a 100MB file may be divided into 10 file fragments, and each file fragment is 10 MB. The file server generates a unique file identifier in the whole NDN for each file fragment.
The file server may send the name of the file (the name of a file is unique throughout the NDN network to identify a unique file) and/or the file fragment identification to the requestor terminal. When the file server only sends the name of the file to the requester terminal, the requester terminal may request the file server for the file fragment identifier of the file fragment corresponding to the file according to the name of the file.
Specifically, the file server may send interest package request information, which includes information of the file, subscriber identification. The subscriber identification may identify the corresponding subscriber as a requestor requesting to download the file. The interest package request information is information sent by the file server and used for requesting the subscriber to send the interest package. The information of the file may include a name of the file and/or a file fragment identification of a file fragment of the file.
The subscriber identification is a unique identification code in the NDN network for uniquely identifying the subscriber.
Before sending the interest package request information, the file server acquires the information of the file and the subscriber information; and generating the subscriber identification according to the information of the file and the subscriber information. In this example, one or some subscribers subscribe to content of some aspect, and when publishing a file, the file server obtains information of the published file and information of the subscribers, so that the subscribers who subscribe to the file, or subscribers who are interested in the file, can be obtained, and further, the subscribers of the subscribers can be identified.
The generating of the subscriber identity according to the information of the file and the subscriber information comprises generating the subscriber identity according to the information of the file, the subscriber information and reference information, wherein the reference information comprises publisher information and/or random values; the information of the file may further include any one or more of: file name, md5 value, storage path, URL, publisher, time of publication of the file. The file name, md5 value, storage path, URL, publisher, publication time, etc. of the file may be used to determine the published file.
After the interest packet request information is transmitted, transmitting the interest packet request information when acknowledgement information is not received within a preset time after the interest packet request information is transmitted. In this example, when the terminal of the subscriber receives the interest package request information, the terminal feeds back confirmation information to the file server to indicate that the interest package request information is received. If the file server does not receive the confirmation information within the preset time, the subscriber can be considered to not receive the interest package request information, the interest package request information fails to be sent, and then the interest package request information is sent again. The preset time may be a time preset by a manager, or a time set by the file server according to an evaluation result to evaluate the NDN network status. The evaluation of the NDN network condition may also refer to a network evaluation method in the prior art, which is not described herein again.
When the file information in the interest package request information includes only the name of the file, after the interest package request information is sent, the file server may receive an interest package from a terminal used by a subscriber, where the interest package is information sent by the subscriber corresponding to the subscriber identifier according to the information of the file. The interest package is used for requesting a file fragment identifier of a file fragment corresponding to the name of the file.
That is, in the present embodiment, the interest packet is not transmitted when the interest packet request information is not received, and the interest packet is transmitted only when the interest packet request information is received.
The interest package request message includes the subscriber identity, so the interest package request message is forwarded to the terminal used by the subscriber in the NDN network.
And after receiving the interest package, the file server sends a data package to the subscriber, wherein the data package comprises a file fragment identifier.
After a subscriber acquires all file fragment identifiers of a file, if the subscriber wants to download the file, the subscriber can send a file fragment downloading request to the NDN node, wherein the file fragment downloading request comprises the file fragment identifiers. In this case, the subscriber may be a requester, and a terminal used by the subscriber is referred to as a requester terminal.
When a file is requested to be downloaded, a requester terminal needs to send a file fragment download request of all file fragments of the file to an NDN node in an NDN network.
The requester terminal may send a file fragment download request for all file fragments of the file to one NDN node.
The requester terminal may also send file fragment download requests for all file fragments of the file to different NDN nodes, and the number of file fragment download requests received by one NDN node is not limited. For example, a file has 10 file fragments, and accordingly 10 file fragment download requests need to be sent, and the requester terminal may send 10 file fragment download requests to 10 NDN nodes, that is, each NDN node receives 1 file fragment download request. For another example, a file has 10 file fragments, and correspondingly 10 file fragment download requests need to be sent, and the requester terminal may send the 10 file fragment download requests to 5 NDN nodes, that is, each NDN node receives 2 file fragment download requests. For another example, a file has 10 file fragments, and correspondingly 10 file fragment download requests need to be sent, and the requester terminal may send the 10 file fragment download requests to 5 NDN nodes, where one NDN node receives 6 file fragment download requests, and the other four NDN nodes respectively receive one file fragment download request.
Step 12, when the first NDN node stores the file fragment corresponding to the file fragment identifier, the first NDN node sends the file fragment corresponding to the file fragment identifier to the second NDN node or the requester terminal; and when the first NDN node does not store the file fragment corresponding to the file fragment identifier, the first NDN node sends the file fragment downloading request to a third NDN node or a file server.
When the first NDN node receives the file fragment downloading request from the second NDN node, the file fragment downloading request is information received by the second NDN node from the requester terminal, and the second NDN node does not store the file fragment corresponding to the file fragment identifier.
When the first NDN node does not store the file fragment corresponding to the file fragment identifier, after the first NDN node sends the file fragment identifier to a third NDN node or a file server, the file downloading method further includes: the first NDN node receives a file fragment corresponding to the file fragment identifier from the third NDN node or the file server; and the first NDN node sends the file fragment corresponding to the file fragment identifier to the second NDN node or the requester terminal.
For example, if the second NDN node receives a file fragment download request from the requester terminal, and searches whether the file fragment is cached according to a file fragment identifier therein, if the file fragment is cached, the file fragment is sent to the requester terminal, and if the file fragment is not cached, the file fragment download request is forwarded to other NDN nodes, and if the file fragment download request is forwarded to the first NDN node, the first NDN node repeats the operation of the second NDN node, and if the first NDN node does not cache the secondary file fragment, the first NDN node forwards the file fragment download request to a third NDN node or a file server.
When the first NDN node forwards the file fragment download request to the file server, the file server necessarily contains all file fragments of a file issued by the file server, so the file server can respond to the file fragment download request forwarded by the first NDN node and send the corresponding file fragments to the first NDN node (the first NDN node is a file fragment requester of the file server), after obtaining the file fragments, the first NDN node sends the file fragments to the second NDN node (the second NDN node is a file fragment requester of the first NDN node) (each NDN node can record who has requested what file fragments from itself), and the second NDN node sends the file fragments to a requester terminal.
When the first NDN node forwards the file fragment download request to a third NDN node, the third NDN node repeats the operations of the first node. When requesting a file fragment, the transmission path of the file fragment is also as described above.
All NDN nodes on the transmission path of the file fragment cache the file fragment, and when the requester terminal requests the file fragment from any NDN node, the NDN node can directly respond to the requester terminal and send the file fragment to the requester terminal.
It should be noted that, in this embodiment, the file cache is a file storage method.
The downloading method based on the NDN network provided by the embodiment of the invention has the following advantages: the file fragments are tried to be downloaded from one NDN node, and when the NDN node does not store the file fragments, the file fragments are tried to be downloaded from other NDN nodes, so that the file server does not need to process each downloading, and the service pressure of the file server is relieved.
Example 2
The embodiment provides a file downloading method based on an NDN (named data networking), and the execution main body of the file downloading method is a requester terminal. The file downloading method comprises the following steps: a requester terminal sends a file fragment downloading request to a first NDN node or a second NDN node, wherein the file fragment downloading request comprises a file fragment identifier; when the requester terminal sends a file fragment downloading request to a second NDN node and when the second NDN node does not store a file fragment corresponding to the file fragment identifier, the second NDN node is used for sending the file fragment downloading request to a first NDN node; when the first NDN node stores the file fragment corresponding to the file fragment identifier, the requester terminal receives the file fragment corresponding to the file fragment identifier from the first NDN node; and when the first NDN node does not store the file fragment corresponding to the file fragment identifier, the first NDN node is used for sending the file fragment downloading request to a third NDN node or a file server.
In an example, when the first NDN node does not store a file fragment corresponding to the file fragment identifier and the requester terminal sends a file fragment download request to the first NDN node, the requester terminal receives the file fragment corresponding to the file identifier from the first NDN node, where the file fragment corresponding to the file identifier is information received by the first NDN node from the third NDN node or the file server; when the first NDN node does not store the file fragment corresponding to the file fragment identifier, the requester terminal sends a file fragment downloading request to a second NDN node, and the second NDN node does not store the file fragment corresponding to the file fragment identifier, the requester terminal receives the file fragment corresponding to the file identifier from the second NDN node, and the file fragment corresponding to the file identifier is the information which is received by the first NDN node from the third NDN node or the file server and is forwarded to the second NDN node by the first NDN node.
The file downloading method provided in this embodiment may be implemented by referring to the content described in embodiment 1, and details are not described here.
The file downloading method based on the NDN network provided by the embodiment has the following advantages: the file fragments are tried to be downloaded from one NDN node, and when the NDN node does not store the file fragments, the file fragments are tried to be downloaded from other NDN nodes, so that the file server does not need to process each downloading, and the service pressure of the file server is relieved.
Example 3
The present embodiment provides a file downloading device based on an NDN network, as shown in fig. 2, including:
a first receiving unit 21, configured to receive a file fragment downloading request from a second NDN node or a requester terminal, where the file fragment downloading request includes a file fragment identifier;
a first sending unit 22, configured to send, to the second NDN node or the requester terminal, a file fragment corresponding to the file fragment identifier when the first NDN node stores the file fragment corresponding to the file fragment identifier;
the first sending unit 22 is further configured to send the file fragment downloading request to a third NDN node or a file server when the first NDN node does not store the file fragment corresponding to the file fragment identifier;
when the first receiving unit 21 receives the file fragment downloading request from the second NDN node, the file fragment downloading request is information received by the second NDN node from the requester terminal, and the second NDN node does not store the file fragment corresponding to the file fragment identifier.
The functions of each functional unit of the file downloading device based on the NDN network provided in this embodiment may be implemented by referring to the contents described in embodiment 1, and are not described herein again.
The file downloading device based on the NDN network provided by this embodiment has the following advantages: the file fragments are tried to be downloaded from one NDN node, and when the NDN node does not store the file fragments, the file fragments are tried to be downloaded from other NDN nodes, so that the file server does not need to process each downloading, and the service pressure of the file server is relieved.
Example 4
The present embodiment provides a file downloading device based on an NDN network, as shown in fig. 3, including:
a second sending unit 31, configured to send a file fragment downloading request to the first NDN node or the second NDN node, where the file fragment downloading request includes a file fragment identifier;
when the second sending unit 31 sends a file fragment downloading request to a second NDN node, and when the second NDN node does not store a file fragment corresponding to the file fragment identifier, the second NDN node is configured to send the file fragment downloading request to a first NDN node;
a second receiving unit 32, configured to receive, from the first NDN node, a file fragment corresponding to the file fragment identifier when the first NDN node stores the file fragment corresponding to the file fragment identifier;
and when the first NDN node does not store the file fragment corresponding to the file fragment identifier, the first NDN node is used for sending the file fragment downloading request to a third NDN node or a file server.
The functions of each functional unit of the file downloading device based on the NDN network provided in this embodiment may be implemented by referring to the contents described in embodiment 1 and embodiment 2, which are not described herein again.
The file downloading device based on the NDN network provided by this embodiment has the following advantages: the file fragments are tried to be downloaded from one NDN node, and when the NDN node does not store the file fragments, the file fragments are tried to be downloaded from other NDN nodes, so that the file server does not need to process each downloading, and the service pressure of the file server is relieved.
Example 5
The present embodiment provides an NDN node, as shown in fig. 4, including a first processor 41 and a first memory 42; wherein,
the first memory 42 stores code;
the first processor 41 executes the codes for performing the file download method described in embodiment 1.
The NDN node provided by this embodiment has the following advantages: the file fragments are tried to be downloaded from one NDN node, and when the NDN node does not store the file fragments, the file fragments are tried to be downloaded from other NDN nodes, so that the file server does not need to process each downloading, and the service pressure of the file server is relieved.
Example 6
The present embodiment provides a terminal, as shown in fig. 5, including a second processor 51 and a second memory 52; wherein,
the second memory 52 stores code;
the second processor 51 executes the codes for performing the file download method described in embodiment 1.
The terminal provided by the embodiment has the following advantages: the file fragments are tried to be downloaded from one NDN node, and when the NDN node does not store the file fragments, the file fragments are tried to be downloaded from other NDN nodes, so that the file server does not need to process each downloading, and the service pressure of the file server is relieved.
Example 7
The present embodiment provides a computer-readable storage medium storing a program including instructions that, when executed by a computer, cause the computer to execute the file download method described in embodiment 1 or the file download method described in embodiment 2.
The computer-readable storage medium storing the program provided by the present embodiment has the following advantages: the file fragments are tried to be downloaded from one NDN node, and when the NDN node does not store the file fragments, the file fragments are tried to be downloaded from other NDN nodes, so that the file server does not need to process each downloading, and the service pressure of the file server is relieved.
Although the invention has been described in detail above with reference to a general description and specific examples, it will be apparent to one skilled in the art that modifications or improvements may be made thereto based on the invention. Accordingly, such modifications and improvements are intended to be within the scope of the invention as claimed.