Data interaction method, device and electronic device in peer-to-peer network

By automatically slicing media segments in P2P network and interacting in slice units, the playback quality and transmission efficiency problems in P2P network are solved, the burden on CDN nodes is reduced, and the coordination of slice rules is simplified.

CN115396420BActive Publication Date: 2025-08-29BEIJING KINGSOFT CLOUD NETWORK TECH CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202110575249.5
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-05-25
Publication Date
2025-08-29
Estimated Expiration
2041-05-25

AI Technical Summary

Technical Problem

The prior art affects the playback quality and transmission efficiency when media segments in P2P networks are long, and it is difficult to unify all film rules between different CDN manufacturers, which increases the burden on CDN nodes.

Method used

In the P2P network, nodes further slice media segments based on pre-saved slicing rules, generate slice information, and interact data in slice units, avoiding the repeated slices and unified standard requirements of CDN nodes.

Benefits of technology

It improves P2P transmission efficiency, reduces the burden on CDN nodes, simplifies the coordination of slicing rules between different CDN manufacturers, and improves playback quality.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115396420B_ABST
    Figure CN115396420B_ABST
Patent Text Reader

Abstract

The present invention provides a data interaction method, device, and electronic device in a peer-to-peer network. Based on an acquired index file, the index of each data segment indicated by the index file is determined; for each index, the data segment corresponding to the current index is sliced ​​according to a stored slicing rule to obtain slicing information of the data segment corresponding to the current index; the slicing information includes: the number of slice units obtained after slicing the data segment, and the slice identifier, slice length, and slice position of each slice unit; based on the slicing information, data is interacted with a second node in the peer-to-peer network. In this method, the nodes in the peer-to-peer network further slice the data segment corresponding to the index file using the slicing rule, and the sliced ​​slice information is transmitted in the peer-to-peer network through P2P transmission. Further slicing improves the transmission efficiency of the P2P nodes. At the same time, this method does not require unified standards between CDN manufacturers, reducing the burden on CDN nodes.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of data processing technology, and in particular to a data interaction method, device and electronic equipment in a peer-to-peer network. Background Art

[0002] An m3u8 file is essentially a playlist that only records the indexes of media segments. The internal information corresponding to the m3u8 file records a series of media segment resources. Playing these segment resources sequentially can fully display the multimedia resources. The above internal information is stored in the CDN (Content Delivery Network) node corresponding to the CDN manufacturer. A multimedia resource in the internal information can be divided into multiple media segments, and a media segment is stored in one file.

[0003] During multimedia playback, P2P (peer-to-peer) data exchange typically uses a single media segment as the smallest unit. Because P2P nodes must wait for the entire media segment to download before verifying its correctness and allowing playback, this approach can affect playback quality and P2P transmission efficiency when the media segments are long.

[0004] In order to solve the above problems, CDN manufacturers in related technologies usually divide the multimedia resources stored in CDN nodes into the smallest possible media segments, or re-slice the original media segments to obtain smaller slice resources. The first method mentioned above increases the number of files storing media segments in CDN nodes, which may affect the performance of CDN nodes, and it is impossible to unify the slicing rules among different CDN manufacturers; the second method requires the cooperation of CDN nodes and requires the definition of unified standards among different CDN manufacturers. Therefore, the methods in related technologies increase the burden on CDN nodes and increase the difficulty of unifying standards among different manufacturers. Summary of the Invention

[0005] The purpose of the present invention is to provide a data interaction method, device and electronic device in a peer-to-peer network to avoid the unified standard operation between different CDN manufacturers, reduce the burden on CDN nodes, and improve P2P transmission efficiency.

[0006] In a first aspect, the present invention provides a method for data interaction in a peer-to-peer network, which is applied to a first node in the peer-to-peer network, and includes: determining the index of each data fragment in a plurality of data fragments indicated by the index file based on an acquired index file; for each index, slicing the data fragment corresponding to the current index according to a pre-saved slicing rule to obtain slicing information of the data fragment corresponding to the current index; wherein the slicing information includes: the number of slicing units obtained after slicing the data fragment corresponding to the current index, and the slice identifier, slice length and slice position of each slice unit; based on the slicing information, performing data interaction with a second node in the peer-to-peer network.

[0007] In an optional embodiment, the above-mentioned step of slicing the data segment corresponding to the current index according to a pre-saved slicing rule to obtain slicing information of the data segment corresponding to the current index includes: determining the number of slicing units obtained by the data segment corresponding to the current index and the slicing identifier of each slicing unit according to the slicing rule; determining the length information of the data segment corresponding to the current index from a preset node; and determining the slicing length and slicing position of each slicing unit of the data segment corresponding to the current index according to the length information and the slicing rule.

[0008] In an optional embodiment, the above-mentioned slicing rules include the number of slices corresponding to each data segment and the rules for identifying the slice units; the above-mentioned step of determining the number of slice units obtained by the data segment corresponding to the current index and the slice identification of each slice unit according to the slicing rules includes: determining the number of slice units obtained by the data segment corresponding to the current index according to the number of slices of the data segment corresponding to the current index in the slicing rules; determining the slice identification of each slice unit according to the rules for identifying the slice units in the slicing rules.

[0009] In an optional embodiment, the above-mentioned slicing rules include the slicing size of the slicing unit; the above-mentioned step of determining the slicing length and slicing position of each slicing unit of the data segment corresponding to the current index based on the length information and the slicing rules includes: determining the slicing length and slicing position of each slicing unit in the data segment corresponding to the current index based on the length information of the data segment corresponding to the current index, the number of slicing units and the slicing size in the slicing rules.

[0010] In an optional embodiment, the above-mentioned step of determining the length information of the data segment corresponding to the current index from the preset node includes: sending a data acquisition request to the preset CDN node based on the acquisition address of the data segment corresponding to the current index stored in the index file, so that the CDN node returns the data segment corresponding to the current index; and determining the length information of the data segment corresponding to the current index based on the returned data segment.

[0011] In an optional embodiment, if the third node in the peer network saves the length information of the data segment corresponding to the current index, and the slicing rule in the third node is consistent with the pre-saved slicing rule; the above-mentioned step of determining the length information of the data segment corresponding to the current index from the preset node includes: sending a length acquisition request to the third node, so that the third node returns the length information of the data segment corresponding to the current index; and receiving the returned length information.

[0012] In an optional embodiment, the step of interacting with the second node in the peer-to-peer network based on the slice information includes:

[0013] If a data access request is received from the second node, extract the slicing rule carried in the data access request;

[0014] Determine whether the extracted slicing rules are consistent with the pre-saved slicing rules; if they are consistent, process the data access request according to the slicing information carried in the data access request, and return the processing result to the second node.

[0015] In a second aspect, the present invention provides a data interaction device in a peer-to-peer network, which is arranged at a first node in the peer-to-peer network, and includes: an index determination module, which is used to determine the index of each data fragment in a plurality of data fragments indicated by an index file based on an acquired index file; a data slicing module, which is used to slice the data fragment corresponding to the current index according to a pre-saved slicing rule for each index, and obtain slicing information of the data fragment corresponding to the current index; wherein the slicing information includes: the number of slice units obtained after slicing the data fragment corresponding to the current index, and the slice identifier, slice length and slice position of each slice unit; a data interaction module, which is used to interact with the second node in the peer-to-peer network based on the slicing information.

[0016] In a third aspect, the present invention provides an electronic device comprising a processor and a memory, wherein the memory stores machine-executable instructions that can be executed by the processor, and the processor executes the machine-executable instructions to implement the data interaction method in a peer-to-peer network of any of the aforementioned embodiments.

[0017] In a fourth aspect, the present invention provides a machine-readable storage medium storing machine-executable instructions. When the machine-executable instructions are called and executed by a processor, the machine-executable instructions prompt the processor to implement the data interaction method in the peer-to-peer network described in any one of the aforementioned embodiments.

[0018] The embodiments of the present invention bring the following beneficial effects:

[0019] The present invention provides a data interaction method, device, and electronic device in a peer-to-peer network. The method is applied to a first node in the peer-to-peer network. First, based on an acquired index file, the index of each data segment in the multiple data segments indicated by the index file is determined. Then, for each index, the data segment corresponding to the current index is sliced ​​according to a pre-saved slicing rule to obtain slicing information of the data segment corresponding to the current index. The slicing information includes: the number of slice units obtained after slicing the data segment corresponding to the current index, and the slice identifier, slice length, and slice position of each slice unit. Then, based on the slicing information, the first node interacts with the second node in the peer-to-peer network. In this method, the nodes in the peer-to-peer network further slice the data segments corresponding to the index file using a preset slicing rule, and perform P2P transmission in the peer-to-peer network through the sliced ​​slice information. Since the amount of sliced ​​data is reduced, the transmission efficiency of the P2P node is improved. At the same time, the slicing operation is implemented on the node devices in the peer-to-peer network, so there is no need for unified standards between CDN manufacturers, which reduces the burden on CDN nodes.

[0020] Other features and advantages of the present invention will be set forth in the following description, or some features and advantages may be inferred or unambiguously determined from the description, or may be learned by implementing the above-mentioned technology of the present invention.

[0021] In order to make the above-mentioned objects, features and advantages of the present invention more obvious and easy to understand, preferred embodiments are specifically listed below and described in detail with reference to the accompanying drawings. BRIEF DESCRIPTION OF THE DRAWINGS

[0022] In order to more clearly illustrate the specific embodiments of the present invention or the technical solutions in the prior art, the following briefly introduces the drawings required for use in the specific embodiments or the description of the prior art. Obviously, the drawings described below are some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.

[0023] Figure 1 A flowchart of a data interaction method in a peer-to-peer network provided by an embodiment of the present invention;

[0024] Figure 2 A flowchart of another data interaction method in a peer-to-peer network provided by an embodiment of the present invention;

[0025] Figure 3 A schematic diagram of data slicing provided by an embodiment of the present invention;

[0026] Figure 4 A flowchart of another data interaction method in a peer-to-peer network provided by an embodiment of the present invention;

[0027] Figure 5 A schematic structural diagram of a data interaction device in a peer-to-peer network provided by an embodiment of the present invention;

[0028] Figure 6 A schematic structural diagram of an electronic device provided by an embodiment of the present invention. DETAILED DESCRIPTION

[0029] To make the objectives, technical solutions, and advantages of the embodiments of the present invention more clear, the technical solutions of the embodiments of the present invention will be clearly and completely described below in conjunction with the accompanying drawings of the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Generally, the components of the embodiments of the present invention described and shown in the drawings herein can be arranged and designed in various different configurations.

[0030] Therefore, the following detailed description of the embodiments of the present invention provided in the accompanying drawings is not intended to limit the scope of the invention as claimed, but rather merely represents selected embodiments of the present invention. All other embodiments derived by persons of ordinary skill in the art based on the embodiments of the present invention without creative effort are intended to fall within the scope of protection of the present invention.

[0031] When only the index of the media segment is recorded in the m3u8 file table, for on-demand playback, the client only needs to download a series of media segment resources recorded in the internal information corresponding to the m3u8 file in sequence and play them once.

[0032] During multimedia playback, data exchange can only be performed in the smallest unit: a single media segment. This approach can affect playback quality, especially for long segments, and can also reduce P2P transmission efficiency.

[0033] Therefore, in the related art, CDN manufacturers usually divide the multimedia resources stored in the CDN nodes into the smallest possible media segments, or slice them again based on the original media segments to obtain smaller slice resources. The first method mentioned above increases the number of files storing media segments in the CDN nodes (that is, the CDN nodes need to store each media segment separately, so the more media segments there are, the more small files there are), which may affect the performance of the CDN nodes, and it is impossible to unify the slicing rules among different CDN manufacturers; the second method requires the cooperation of the CDN nodes, and it is necessary to define a unified standard among different CDN manufacturers. Therefore, the method in the related art increases the burden on the CDN nodes and increases the difficulty of unifying standards among different manufacturers.

[0034] Based on the above problems, the embodiments of the present invention provide a data interaction method, device and electronic device in a peer-to-peer network. The technology can be applied to scenarios such as data slicing, data transmission and data sharing in a peer-to-peer network. To facilitate understanding of this embodiment, first, a data interaction method in a peer-to-peer network disclosed in an embodiment of the present invention is applied to a first node in a peer-to-peer network. The peer-to-peer network includes multiple peer nodes, and the peer node can both transmit data and obtain data. The above-mentioned first node can be any peer node in the peer-to-peer network; Figure 1 As shown, the method includes the following specific steps:

[0035] Step S102: Based on the acquired index file, determine the index of each data segment in the multiple data segments indicated by the index file.

[0036] The above-mentioned index file is usually a plain text file (for example, an m3u8 file) that records the index. Through the index file, the corresponding data file can be found, and the audio and video data is stored in the data file. In specific implementation, the above-mentioned data files and index files are usually stored in a CDN node. The CDN node usually divides the target data into multiple data fragments in advance, and each data fragment is stored in a data file. Therefore, the index file also stores information such as the acquisition address and storage location of each data fragment. Each peer node in the peer-to-peer network can access the CDN node.

[0037] The index of the above data segment can be a unique identifier corresponding to the data segment, which can be set according to user needs. For example, if the index file indicates that there are indexes of 8 data segments, then the indexes of these 8 data segments can be represented as ts1, ts2, ts3, ts4, ts5, ts6, ts7 and ts8.

[0038] Step S104: For each index, slice the data segment corresponding to the current index according to the pre-saved slicing rules to obtain slicing information of the data segment corresponding to the current index; wherein the slicing information includes: the number of slicing units obtained after slicing the data segment corresponding to the current index, and the slicing identifier, slicing length and slicing position of each slicing unit.

[0039] The above-mentioned slicing rules are pre-saved in the first node. The slicing rules can be set according to user needs. The slicing rules may include the number of slices corresponding to each data segment (for example, the number of slices is 10 or 5, etc.) or the slice size of the slice unit corresponding to each data segment (the slice size is 100M or 150M, etc.), as well as the rules for identifying each slice unit (using numbers, letters or strings, etc. for identification), etc.

[0040] In practical applications, for the index of each data segment, the data segment corresponding to the index needs to be sliced ​​according to the slicing rules saved in the first node to obtain the slicing information of multiple slicing units corresponding to the data segment; wherein the slicing information includes the number of slicing units, as well as the slicing identifier, slicing length and slicing position of each slicing unit.

[0041] Step S106: Based on the slice information, data is exchanged with the second node in the peer network.

[0042] The second node in the above-mentioned peer-to-peer network can be any peer node in the peer-to-peer network except the first node, and the minimum unit for data interaction between the second node and the first node is a slice unit. In a specific implementation, the second node can send a data acquisition request to the first node, and the data acquisition request carries the slice information of the slice unit to be acquired. The data segment where the slice unit to be acquired is located can be determined by the slice identifier in the slice information, and then the slice data corresponding to the slice unit can be accurately determined according to the slice length and slice position in the slice information. Since each peer node in the peer-to-peer network performs data slicing, the first node can also send a data acquisition request to the second node to obtain the desired data from the second node.

[0043] In some embodiments, data interaction between peer nodes and CDN nodes in a peer-to-peer network supports both data segments and slice units.

[0044] An embodiment of the present invention provides a data interaction method in a peer-to-peer network. First, based on an acquired index file, the index of each data segment in the multiple data segments indicated by the index file is determined. Then, for each index, the data segment corresponding to the current index is sliced ​​according to a pre-saved slicing rule to obtain slicing information of the data segment corresponding to the current index. Then, based on the slicing information, a first node interacts with a second node in the peer-to-peer network. In this method, the nodes in the peer-to-peer network further slice the data segments corresponding to the index file using a preset slicing rule, and the sliced ​​slicing information is transmitted P2P in the peer-to-peer network. Since the amount of sliced ​​data is reduced, the transmission efficiency of the P2P nodes is improved. At the same time, the slicing operation is implemented on the node devices in the peer-to-peer network, so there is no need for unified standards between CDN manufacturers, which reduces the burden on CDN nodes.

[0045] The embodiment of the present invention also provides another data interaction method in a peer-to-peer network, which is implemented on the basis of the method of the above embodiment; the method focuses on describing the specific process of slicing the data fragment corresponding to the current index according to the pre-stored slicing rules to obtain the slicing information of the data fragment corresponding to the current index (implemented by the following steps S204-S208); Figure 2 As shown, the method includes the following specific steps:

[0046] Step S202: Based on the acquired index file, determine the index of each data segment in the multiple data segments indicated by the index file.

[0047] The above index file can be any one of all m3u8 files, that is, the present invention is applicable to all m3u8 files.

[0048] Step S204 : for each index, according to the pre-stored slicing rules, determine the number of slicing units obtained by the data segment corresponding to the current index and the slicing identifier of each slicing unit.

[0049] When slicing data, the first node in a peer-to-peer network usually determines the number of slice units corresponding to each index based on the slicing rules, and sets a slice identifier for each slice unit. In specific implementations, the slicing rules include the number of slices corresponding to each data segment and the rules for identifying the slice units; the number of slices corresponding to each data segment may be the same or different, depending on user needs; the rules for identifying the slice units can also be set according to user needs, for example, the slice units can be numbered using letters, symbols, or numbers. In actual applications, the above step S204 can be determined through the following steps 10-11:

[0050] Step 10: Determine the number of slice units obtained by the data segment corresponding to the current index according to the number of slices of the data segment corresponding to the current index in the slicing rule.

[0051] Step 11: Determine the slice identifier of each slice unit according to the rule for identifying the slice unit in the slicing rule.

[0052] like Figure 3 FIG. 1 is a schematic diagram of a data slice provided by an embodiment of the present invention. Figure 3 In the index, ts1 to tsN represent the indexes corresponding to the N data fragments in the index file, and picec1 to piece-n represent the slice identifiers corresponding to the n slice units corresponding to each data fragment. That is, the slice identifier of each slice unit is only used to occupy the slice unit, and the data fragment is not sliced.

[0053] Step S206: Determine the length information of the data segment corresponding to the current index from the preset node.

[0054] The above-mentioned preset node can be a peer node in a peer-to-peer network that stores the length information of the data segment corresponding to the current index; it can also be a CDN node that stores the data file corresponding to the index file, and the data segment is stored in the data file. In specific implementation, the above-mentioned step S206 can be implemented by the following steps 20-21:

[0055] Step 20: Based on the retrieval address of the data segment corresponding to the current index stored in the index file, a data retrieval request is sent to a preset CDN node, so that the CDN node returns the data segment corresponding to the current index. The data retrieval request carries the retrieval address of the data segment corresponding to the current index. The CDN node can extract the retrieval address from the received data retrieval request, query the data segment corresponding to the retrieval address, and return the data segment to the first node that sent the data retrieval request.

[0056] Step 21: Determine the length information of the data segment corresponding to the current index based on the returned data segment. The first node can determine the length information of the data segment based on the acquired data segment.

[0057] In some embodiments, if the third node in the peer-to-peer network stores the length information of the data segment corresponding to the current index, and the slicing rule in the third node is consistent with the pre-stored slicing rule, the above step S206 can also be implemented by the following steps 30-31:

[0058] Step 30: Send a length acquisition request to the third node, so that the third node returns the length information of the data segment corresponding to the current index.

[0059] The third node can be any peer node in the peer-to-peer network other than the first node. If the slicing rules in the third node are consistent with the slicing rules pre-stored in the first node, it means that the slicing rules of the two nodes have been successfully verified, that is, the slicing information in the two nodes is consistent. In some embodiments, this verification information can also be saved in the slicing information.

[0060] In a specific implementation, the length information of the data segment corresponding to the current index stored in the third node may be obtained in advance by the third node from a CDN node or other peer nodes.

[0061] Step 31: Receive the returned length information.

[0062] Step S208 : Determine the slice length and slice position of each slice unit of the data segment corresponding to the current index according to the above length information and the slice rule.

[0063] In a specific implementation, the slicing rule includes the slice size of the slice unit. A specific implementation of step S208 may be to determine the slice length and slice position of each slice unit in the data segment corresponding to the current index based on the length information of the data segment corresponding to the current index, the number of slice units, and the slice size in the slicing rule. Alternatively, it can be understood that the slice length of the slice unit can be obtained based on the slice size in the slicing rule, and the slice position of each slice unit corresponding to the data segment can be determined based on the length information, slice length, and number of slices of the data segment.

[0064] Step S210: Based on the slice information, data is exchanged with the second node in the peer network.

[0065] The data interaction method in the peer-to-peer network first determines the index of each of the multiple data segments indicated by the index file based on the obtained index file. Then, for each index, the number of slice units obtained for the data segment corresponding to the current index and the slice identifier of each slice unit are determined according to a pre-stored slicing rule. The length information of the data segment corresponding to the current index is determined from a preset node. Based on this length information and the slicing rule, the slice length and slice position of each slice unit of the data segment corresponding to the current index are determined. Then, based on the slice information, data is interacted with a second node in the peer-to-peer network. This method improves P2P efficiency and does not require consideration of CDN vendors, reducing the burden of secondary slicing on CDN nodes.

[0066] The embodiment of the present invention also provides another data interaction method in a peer-to-peer network, which is implemented on the basis of the method of the above embodiment; the method focuses on describing the specific process of determining the index of each data fragment in the multiple data fragments indicated by the index file based on the obtained index file (implemented by the following steps S402-S404), and the specific process of interacting with the second node in the peer-to-peer network based on the slice information (implemented by the following steps S408-S410); Figure 4 As shown, the method includes the following specific steps:

[0067] Step S402: Obtain an index file from a preset CDN node, and parse the index file to obtain file description information.

[0068] In a specific implementation, the above-mentioned CDN node stores an index file of the target data. The first node in the peer-to-peer network can request the index file from the CDN node so that the first node can play the index file. The first node can also parse the index file to obtain the description information of the index file (equivalent to the above-mentioned file description information). The description information of the index file usually includes information such as the acquisition address of each data fragment in the multiple data fragments indicated by the index file.

[0069] Step S404: Generate an index for each of the multiple data segments indicated by the index file based on the file description information.

[0070] In a specific implementation, the acquisition address of each data segment corresponds to an index of the data segment.

[0071] Step S406: For each index, slice the data segment corresponding to the current index according to the pre-saved slicing rules to obtain the slicing information of the data segment corresponding to the current index; the slicing information includes: the number of slicing units obtained after slicing the data segment corresponding to the current index, and the slicing identifier, slicing length and slicing position of each slicing unit.

[0072] Step S408: If a data access request is received from the second node, extract the slicing rules carried in the data access request.

[0073] The second node is any peer node in the peer-to-peer network other than the first node. The data access request can be a request to obtain one or more slice units, or a request to obtain one or more data fragments. In a specific implementation, the data access request carries the slicing rules stored in the node sending the request, as well as slice information of the specified data to be accessed.

[0074] Step S410, determine whether the extracted slicing rule is consistent with the pre-saved slicing rule; if they are consistent, execute step S412; otherwise, execute step S414.

[0075] Before the first node processes a received data access request, it must first determine whether the slicing rule carried in the request is consistent with the slicing rule pre-stored in the first node. If they are consistent, the slicing information and obtained slicing units of the two nodes are consistent. At this point, the two nodes can transmit data. If they are inconsistent, the slicing information and slicing units obtained by the first and second nodes are inconsistent, and the two nodes cannot transmit data.

[0076] Step S412: Process the data access request according to the slice information carried in the data access request, and return the processing result to the second node.

[0077] The above processing result can be the slice unit obtained by the first node based on the slice information carried in the data access request, or the length information of a certain data fragment, etc. The specific processing result is determined according to the slice information carried in the data access request.

[0078] Step S414: Return a message indicating that the access failed.

[0079] The data interaction method in the above-mentioned peer-to-peer network first obtains the index file from the preset CDN node, parses the index file to obtain file description information, and based on the file description information, generates an index for each data segment in the multiple data segments indicated by the index file; then, for each index, slices the data segment corresponding to the current index according to the pre-saved slicing rules to obtain the slicing information of the data segment corresponding to the current index; if a data access request sent by the second node is received, the slicing rules carried in the data access request are extracted, and it is determined whether the extracted slicing rules are consistent with the pre-saved slicing rules; if they are consistent, the data access request is processed according to the slicing information carried in the data access request, and the processing result is returned to the third node. In this method, the nodes in the peer-to-peer network can adopt an autonomous slicing strategy for the index file, slice each data segment corresponding to the index file, and then perform P2P according to the slicing information of the data segment. This method not only improves the P2P transmission efficiency, but also does not rely on CDN manufacturers, thereby enabling better P2P data sharing.

[0080] In view of the embodiment of the data interaction method in the above-mentioned peer-to-peer network, an embodiment of the present invention provides a data interaction device in a peer-to-peer network, which is arranged at a first node in the peer-to-peer network, such as Figure 5 As shown, the device includes:

[0081] The index determination module 50 is configured to determine, based on the acquired index file, the index of each data segment among the multiple data segments indicated by the index file.

[0082] The data slicing module 51 is used to slice the data segment corresponding to the current index according to the pre-saved slicing rules for each index, and obtain the slicing information of the data segment corresponding to the current index; wherein the slicing information includes: the number of slicing units obtained after slicing the data segment corresponding to the current index, and the slicing identifier, slicing length and slicing position of each slicing unit.

[0083] The data interaction module 52 is used to interact with the second node in the peer network based on the slice information.

[0084] The data interaction device in the above-mentioned peer-to-peer network first determines the index of each data segment among the multiple data segments indicated by the index file based on the obtained index file; then, for each index, the data segment corresponding to the current index is sliced ​​according to a pre-stored slicing rule to obtain slicing information of the data segment corresponding to the current index; then, based on the slicing information, the first node interacts with the second node in the peer-to-peer network. In this method, the nodes in the peer-to-peer network further slice the data segments corresponding to the index file using the preset slicing rules, and the sliced ​​slicing information is transmitted P2P in the peer-to-peer network. Since the amount of sliced ​​data is reduced, the transmission efficiency of the P2P nodes is improved; at the same time, the slicing operation is implemented on the node devices in the peer-to-peer network, so there is no need for unified standards among CDN manufacturers, which reduces the burden on CDN nodes.

[0085] Furthermore, the above-mentioned data slicing module 51 includes: a quantity determination module, which is used to determine the number of slice units obtained by the data segment corresponding to the current index and the slice identifier of each slice unit according to the slicing rule; a length acquisition module, which is used to determine the length information of the data segment corresponding to the current index from the preset node; and an information determination module, which is used to determine the slice length and slice position of each slice unit of the data segment corresponding to the current index according to the length information and the slicing rule.

[0086] Specifically, the above-mentioned slicing rules include the number of slices corresponding to each data segment and the rules for identifying the slice units; the above-mentioned quantity determination module is used to: determine the number of slice units obtained by the data segment corresponding to the current index according to the number of slices of the data segment corresponding to the current index in the slicing rules; determine the slice identification of each slice unit according to the rules for identifying the slice units in the slicing rules.

[0087] In a specific implementation, the above-mentioned slicing rules include the slicing size of the slicing unit; the above-mentioned information determination module is also used to determine the slicing length and slicing position of each slicing unit in the data segment corresponding to the current index based on the length information of the data segment corresponding to the current index, the number of slicing units and the slicing size in the slicing rules.

[0088] In a specific implementation, the above-mentioned length acquisition module is used to: send a data acquisition request to a preset CDN node based on the acquisition address of the data segment corresponding to the current index stored in the index file, so that the CDN node returns the data segment corresponding to the current index; and determine the length information of the data segment corresponding to the current index based on the returned data segment.

[0089] In some embodiments, if the third node in the peer network saves the length information of the data segment corresponding to the current index, and the slicing rule in the third node is consistent with the pre-saved slicing rule; the above-mentioned length acquisition module is also used to: send a length acquisition request to the third node so that the third node returns the length information of the data segment corresponding to the current index; and receive the returned length information.

[0090] Furthermore, the above-mentioned data interaction module 52 is used to: if a data access request sent by the second node is received, extract the slicing rules carried in the data access request; determine whether the extracted slicing rules are consistent with the pre-saved slicing rules; if they are consistent, process the data access request according to the slicing information carried in the data access request, and return the processing result to the second node.

[0091] The data interaction device in the peer-to-peer network provided in the embodiment of the present invention has the same implementation principle and technical effects as those of the aforementioned method embodiment. For the sake of brief description, for matters not mentioned in the device embodiment, reference can be made to the corresponding content in the aforementioned method embodiment.

[0092] The embodiment of the present invention further provides an electronic device, such as Figure 6 As shown, the electronic device includes a processor 101 and a memory 100. The memory 100 stores machine-executable instructions that can be executed by the processor 101. The processor 101 executes the machine-executable instructions to implement the above-mentioned data interaction method in the peer-to-peer network.

[0093] Furthermore, Figure 6 The electronic device shown further includes a bus 102 and a communication interface 103 , and the processor 101 , the communication interface 103 and the memory 100 are connected via the bus 102 .

[0094] The memory 100 may include a high-speed random access memory (RAM), and may also include a non-volatile memory, such as at least one disk storage. The communication connection between the system network element and at least one other network element is achieved through at least one communication interface 103 (which may be wired or wireless), and the Internet, wide area network, local area network, metropolitan area network, etc. may be used. The bus 102 may be an ISA bus, a PCI bus, or an EISA bus. The bus can be divided into an address bus, a data bus, a control bus, etc. For ease of representation, Figure 4 Only one bidirectional arrow is used in the diagram, but this does not mean that there is only one bus or one type of bus.

[0095] The processor 101 may be an integrated circuit chip with signal processing capabilities. During implementation, each step of the above method can be completed by hardware integrated logic circuits in the processor 101 or by software instructions. The above processor 101 may be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc.; it may also be a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field-programmable gate array (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, or discrete hardware components. The various methods, steps, and logic block diagrams disclosed in the embodiments of the present invention can be implemented or executed. The general-purpose processor may be a microprocessor or any conventional processor. The steps of the method disclosed in conjunction with the embodiments of the present invention can be directly implemented as being executed by a hardware decoding processor, or can be executed by a combination of hardware and software modules in the decoding processor. The software module can be located in a storage medium well-known in the art, such as a random access memory, flash memory, read-only memory, programmable read-only memory, electrically erasable programmable memory, or register. The storage medium is located in the memory 100, and the processor 101 reads the information in the memory 100 and, in conjunction with its hardware, completes the steps of the method of the aforementioned embodiment.

[0096] An embodiment of the present invention also provides a machine-readable storage medium, which stores machine-executable instructions. When the machine-executable instructions are called and executed by a processor, the machine-executable instructions prompt the processor to implement the above-mentioned data interaction method in the peer-to-peer network. The specific implementation can be found in the method embodiment and will not be repeated here.

[0097] If the functions are implemented in the form of software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, 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. The computer software product is stored in a storage medium and includes several instructions for enabling a computer device (which can be a personal computer, server, or network device, etc.) to execute all or part of the steps of the method described in each embodiment of the present invention. The aforementioned storage medium includes various media that can store program codes, such as a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk, or an optical disk.

[0098] Finally, it should be noted that the above-described embodiments are only specific implementation methods of the present invention, which are used to illustrate the technical solutions of the present invention, rather than to limit them. The scope of protection of the present invention is not limited thereto. Although the present invention has been described in detail with reference to the above-described embodiments, those skilled in the art should understand that any person skilled in the art can modify or easily conceive of changes to the technical solutions described in the above-described embodiments within the technical scope disclosed by the present invention, or replace some of the technical features therein with equivalents. Such modifications, changes, or replacements do not deviate from the spirit and scope of the technical solutions of the embodiments of the present invention, and should be included in the scope of protection of the present invention. Therefore, the scope of protection of the present invention shall be subject to the scope of protection of the claims.

Claims

1. A data interaction method in a peer-to-peer network, characterized in that: The method is applied to a first node in a peer-to-peer network, where the peer-to-peer network includes multiple peer nodes, and the first node is any one of the peer nodes in the peer-to-peer network; the method includes: Determining, based on the acquired index file, an index of each of the plurality of data segments indicated by the index file; For each of the indexes, slicing the data segment corresponding to the current index according to a pre-stored slicing rule to obtain slicing information of the data segment corresponding to the current index; wherein the slicing information includes: the number of slicing units obtained after slicing the data segment corresponding to the current index, and the slice identifier, slice length, and slice position of each slicing unit; Based on the slice information, interact with a second node in the peer-to-peer network; The step of slicing the data segment corresponding to the current index according to the pre-stored slicing rule to obtain slicing information of the data segment corresponding to the current index includes: Determine, according to the slicing rule, the number of slice units obtained from the data segment corresponding to the current index and a slice identifier for each of the slice units; the slicing rule includes the number of slices corresponding to each data segment and a rule for identifying the slice units; the number of slices corresponding to each data segment is the same or different; Determining the length information of the data segment corresponding to the current index from a preset node; the preset node is a peer node in the peer-to-peer network that stores the length information of the data segment corresponding to the current index; According to the length information and the slicing rule, the slice length and slice position of each slice unit of the data segment corresponding to the current index are determined.

2. The method according to claim 1, characterized in that The step of determining the number of slice units obtained from the data segment corresponding to the current index and the slice identifier of each slice unit according to the slice rule includes: Determine the number of slice units obtained for the data segment corresponding to the current index according to the number of slices of the data segment corresponding to the current index in the slicing rule; According to the rule for identifying the slice unit in the slicing rule, the slice identifier of each of the slice units is determined.

3. The method according to claim 1, characterized in that The slicing rule includes the slicing size of the slicing unit; The step of determining the slice length and slice position of each slice unit of the data segment corresponding to the current index according to the length information and the slicing rule includes: Based on the length information of the data segment corresponding to the current index, the number of the slicing units and the slice size in the slicing rule, the slice length and slice position of each of the slicing units in the data segment corresponding to the current index are determined.

4. The method according to claim 1, wherein The step of determining the length information of the data segment corresponding to the current index from the preset node includes: Based on the acquisition address of the data segment corresponding to the current index stored in the index file, sending a data acquisition request to a preset CDN node, so that the CDN node returns the data segment corresponding to the current index; Determine the length of the data segment corresponding to the current index based on the returned data segment.

5. The method according to claim 1, wherein If a third node in the peer-to-peer network stores length information of the data segment corresponding to the current index, and a slicing rule in the third node is consistent with a pre-stored slicing rule, the step of determining the length information of the data segment corresponding to the current index from the preset node includes: Sending a length acquisition request to the third node, so that the third node returns the length information of the data segment corresponding to the current index; Receive the returned length information.

6. The method according to claim 1, characterized in that The step of interacting with the second node in the peer-to-peer network based on the slice information includes: If a data access request sent by the second node is received, extracting the slicing rule carried in the data access request; Determine whether the extracted slicing rules are consistent with the pre-saved slicing rules; if they are consistent, process the data access request according to the slicing information carried by the data access request, and return the processing result to the second node.

7. A data interaction device in a peer-to-peer network, characterized in that: The device is set at a first node in a peer-to-peer network, the peer-to-peer network includes multiple peer nodes, and the first node is any peer node in the peer-to-peer network; the device includes: An index determination module, configured to determine, based on the acquired index file, an index of each of the plurality of data segments indicated by the index file; a data slicing module, configured to slice the data segment corresponding to the current index according to a pre-stored slicing rule for each of the indexes, and obtain slicing information of the data segment corresponding to the current index; wherein the slicing information includes: the number of slicing units obtained after slicing the data segment corresponding to the current index, and the slice identifier, slice length, and slice position of each slicing unit; A data interaction module, configured to interact with a second node in the peer-to-peer network based on the slice information; The data slicing module includes: a quantity determination module, configured to determine, according to the slicing rule, the number of slice units obtained by the data segment corresponding to the current index, and a slice identifier for each of the slice units; the slicing rule includes the number of slices corresponding to each data segment and a rule for identifying the slice units; the number of slices corresponding to each data segment is the same or different; a length obtaining module, configured to determine the length information of the data segment corresponding to the current index from a preset node; the preset node being a peer node in a peer-to-peer network that stores the length information of the data segment corresponding to the current index; An information determination module is used to determine the slice length and slice position of each slice unit of the data segment corresponding to the current index based on the length information and the slicing rule.

8. An electronic device, characterized in that: The electronic device includes a processor and a memory, the memory stores machine-executable instructions that can be executed by the processor, and the processor executes the machine-executable instructions to implement the data interaction method in a peer-to-peer network according to any one of claims 1 to 6.

9. A machine-readable storage medium, characterized in that The machine-readable storage medium stores machine-executable instructions. When the machine-executable instructions are called and executed by the processor, the machine-executable instructions prompt the processor to implement the data interaction method in the peer-to-peer network according to any one of claims 1 to 6.

Citation Information

Patent Citations

  • Streaming media data transmission method, equipment and device and computer storage medium

    CN111064969A