CN108710681A - File acquisition method, device, equipment and storage medium - Google Patents
File acquisition method, device, equipment and storage medium Download PDFInfo
- Publication number
- CN108710681A CN108710681A CN201810482561.8A CN201810482561A CN108710681A CN 108710681 A CN108710681 A CN 108710681A CN 201810482561 A CN201810482561 A CN 201810482561A CN 108710681 A CN108710681 A CN 108710681A
- Authority
- CN
- China
- Prior art keywords
- node
- file
- memory node
- account book
- memory
- 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.)
- Granted
Links
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/10—File systems; File servers
- G06F16/18—File system types
- G06F16/182—Distributed file systems
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/10—File systems; File servers
- G06F16/13—File access structures, e.g. distributed indices
- G06F16/134—Distributed indices
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/10—File systems; File servers
- G06F16/16—File or folder operations, e.g. details of user interfaces specifically adapted to file systems
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/10—File systems; File servers
- G06F16/17—Details of further file system functions
- G06F16/172—Caching, prefetching or hoarding of files
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F21/00—Security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
- G06F21/60—Protecting data
- G06F21/62—Protecting access to data via a platform, e.g. using keys or access control rules
- G06F21/6218—Protecting access to data via a platform, e.g. using keys or access control rules to a system of files or objects, e.g. local or distributed file system or database
-
- Y—GENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
- Y02—TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
- Y02D—CLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
- Y02D10/00—Energy efficient computing, e.g. low power processors, power management or thermal management
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Physics & Mathematics (AREA)
- Databases & Information Systems (AREA)
- General Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- Data Mining & Analysis (AREA)
- Bioethics (AREA)
- Software Systems (AREA)
- Computer Security & Cryptography (AREA)
- Computer Hardware Design (AREA)
- General Health & Medical Sciences (AREA)
- Health & Medical Sciences (AREA)
- Human Computer Interaction (AREA)
- Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
Abstract
Description
技术领域technical field
本申请涉及网络技术领域,特别涉及一种文件获取方法、装置、设备及存储介质。The present application relates to the field of network technology, and in particular to a file acquisition method, device, equipment and storage medium.
背景技术Background technique
不良服务提供商通常会将其它服务提供商提供的文件(或服务)的统一资源定位符(Uniform Resource Locator,URL)存储到自己的数据库中,当用户访问不良服务提供商的网络平台时,访问和/或下载的文件的URL即为被盗链文件的URL。Bad service providers usually store Uniform Resource Locators (Uniform Resource Locators, URLs) of files (or services) provided by other service providers in their own databases. When users access the network platform of bad service providers, the access and/or the URL of the downloaded file is the URL of the hotlinked file.
相关技术中,为了防止在网络平台上发布的文件被盗链,服务提供商通常会不定期地修改文件名来防止文件被盗链,由于修改文件名会相应地改变被盗链文件的URL,因此会导致不良服务商存储的被盗链文件的URL失效,从而实现防盗链的目的。In related technologies, in order to prevent the files published on the network platform from being hotlinked, the service provider usually modifies the file name irregularly to prevent the file from being hotlinked, because modifying the file name will change the URL of the hotlinked file accordingly, Therefore, the URL of the hotlinked file stored by the bad service provider will become invalid, thereby realizing the purpose of anti-hotlinking.
不定期地修改文件名会使URL被修改,当合法用户在访问和/或下载文件的时候,该文件的URL被修改会导致合法用户的访问和/或下载行为失败。Modifying the file name irregularly will cause the URL to be modified. When the legitimate user accesses and/or downloads the file, the URL of the file is modified, which will cause the legitimate user's access and/or download behavior to fail.
发明内容Contents of the invention
本申请实施例提供了一种文件获取方法、装置、设备及存储介质,可以用于解决相关技术中采用不定期地修改文件名来防止文件被盗链,导致合法用户访问和/或下载文件失败的问题。所述技术方案如下:The embodiment of the present application provides a file acquisition method, device, device, and storage medium, which can be used to solve the problem of modifying file names irregularly in related technologies to prevent files from being hotlinked, resulting in failure of legitimate users to access and/or download files The problem. Described technical scheme is as follows:
一方面,本申请实施例提供了一种文件获取方法,所述方法应用于分布式文件存储系统的第一存储节点中,所述方法包括:On the one hand, an embodiment of the present application provides a file acquisition method, the method is applied to a first storage node of a distributed file storage system, and the method includes:
向所述分布式文件存储系统中的第二存储节点发送第一账本;所述分布式文件存储系统中的存储节点中存储有账本,所述账本包括所述存储节点对存储在所述分布式文件存储系统中的文件片段进行操作的操作记录,所述第一账本是所述第一存储节点中存储的所述账本;Sending a first ledger to a second storage node in the distributed file storage system; a ledger is stored in a storage node in the distributed file storage system, and the ledger includes a pair of storage nodes stored in the distributed file storage system. An operation record of operations performed on file fragments in the file storage system, the first ledger is the ledger stored in the first storage node;
接收所述第二存储节点发送的连接建立指令,所述连接建立指令是所述第二存储节点确定所述第一账本和第二账本匹配后发送的,所述第二账本是所述第二存储节点中存储的所述账本;receiving a connection establishment instruction sent by the second storage node, the connection establishment instruction is sent by the second storage node after determining that the first ledger and the second ledger match, and the second ledger is the second ledger storing the ledger stored in the node;
根据所述连接建立指令和所述第二存储节点建立连接,向所述第二存储节点发送需求文件片段的唯一识别信息;Establishing a connection with the second storage node according to the connection establishment instruction, and sending the unique identification information of the required file segment to the second storage node;
接收所述第二存储节点发送的所述需求文件片段,并合并得到需求文件;所述需求文件片段是所述第二存储节点根据所述唯一识别信息在本地查询得到的。receiving the demand file fragments sent by the second storage node, and combining them to obtain a demand file; the demand file fragments are obtained by the second storage node through local query according to the unique identification information.
一方面,本申请实施例提供了一种文件获取装置,所述装置应用于分布式文件存储系统的第一存储节点中,所述装置包括:On the one hand, the embodiment of the present application provides a file acquisition device, the device is applied to the first storage node of the distributed file storage system, and the device includes:
发送模块,用于向所述分布式文件存储系统中的第二存储节点发送第一账本;所述分布式文件存储系统中的存储节点中存储有账本,所述账本包括所述存储节点对存储在所述分布式文件存储系统中的文件片段进行操作的操作记录,所述第一账本是所述第一存储节点中存储的所述账本;A sending module, configured to send a first ledger to a second storage node in the distributed file storage system; a ledger is stored in a storage node in the distributed file storage system, and the ledger includes the pair of storage nodes stored by the storage node An operation record of operations performed on file fragments in the distributed file storage system, the first ledger is the ledger stored in the first storage node;
接收模块,用于接收所述第二存储节点发送的连接建立指令,所述连接建立指令是所述第二存储节点确定所述第一账本和第二账本匹配后发送的,所述第二账本是所述第二存储节点中存储的所述账本;A receiving module, configured to receive a connection establishment instruction sent by the second storage node, the connection establishment instruction is sent by the second storage node after determining that the first ledger matches the second ledger, and the second ledger is the ledger stored in the second storage node;
所述发送模块,还用于根据所述连接建立指令和所述第二存储节点建立连接,向所述第二存储节点发送需求文件片段的唯一识别信息;The sending module is further configured to establish a connection with the second storage node according to the connection establishment instruction, and send the unique identification information of the required file segment to the second storage node;
所述接收模块,还用于接收所述第二存储节点发送的所述需求文件片段;所述需求文件片段是所述第二存储节点根据所述唯一识别信息在本地查询得到的;The receiving module is further configured to receive the demand file fragment sent by the second storage node; the demand file fragment is obtained by the second storage node through local query according to the unique identification information;
处理模块,用于并合所述需求文件片段并得到需求文件。The processing module is used to combine the requirement file fragments to obtain the requirement file.
一方面,本申请实施例提供了一种文件获取装置,所述装置应用于分布式文件存储系统中的第二存储节点中,所述装置包括:On the one hand, an embodiment of the present application provides a file acquisition device, the device is applied to a second storage node in a distributed file storage system, and the device includes:
接收模块,用于接收所述分布式文件存储系统中的第一存储节点发送的第一账本;所述分布式文件存储系统中的存储节点中存储有账本,所述账本包括所述存储节点对存储在所述分布式文件存储系统中的文件片段进行操作的操作记录,所述第一账本是所述第一存储节点中存储的所述账本;The receiving module is configured to receive the first ledger sent by the first storage node in the distributed file storage system; the ledger is stored in the storage node in the distributed file storage system, and the ledger includes the pair of storage nodes An operation record of operations performed on file fragments stored in the distributed file storage system, the first ledger is the ledger stored in the first storage node;
发送模块,用于若所述第一账本和所述第二账本匹配,向所述第一存储节点发送连接建立指令,所述连接建立指令用于指示所述第一存储节点和所述第二存储节点建立连接,所述第二账本是所述第二存储节点中存储的所述账本;a sending module, configured to send a connection establishment instruction to the first storage node if the first ledger matches the second ledger, and the connection establishment instruction is used to instruct the first storage node and the second The storage node establishes a connection, and the second ledger is the ledger stored in the second storage node;
处理模块,用于与所述第一存储节点建立连接;a processing module, configured to establish a connection with the first storage node;
所述接收模块,还用于接收所述第一存储节点发送的需求文件片段的唯一识别信息;The receiving module is further configured to receive the unique identification information of the required file segment sent by the first storage node;
发送模块,还用于向所述第一存储节点发送需求文件片段;所述需求文件片段是根据所述唯一识别信息在本地查询得到的。The sending module is further configured to send a demand file fragment to the first storage node; the demand file fragment is obtained through local query according to the unique identification information.
一方面,本申请实施例提供了一种电子设备,所述电子设备包括处理器和存储器,所述存储器中存储有至少一条指令,所述至少一条指令由所述处理器加载并执行以实现如上所述的文件获取方法。On the one hand, an embodiment of the present application provides an electronic device, the electronic device includes a processor and a memory, at least one instruction is stored in the memory, and the at least one instruction is loaded and executed by the processor to implement the above The described method of obtaining the file.
一方面,本申请实施例提供了一种电子设备所述电子设备包括处理器和存储器,所述存储器中存储有至少一条指令,所述至少一条指令由所述处理器加载并执行以实现如上所述的文件存储方法。On the one hand, an embodiment of the present application provides an electronic device. The electronic device includes a processor and a memory, at least one instruction is stored in the memory, and the at least one instruction is loaded and executed by the processor to realize the above-mentioned The file storage method described above.
一方面,本申请实施例提供了一种计算机可读存储介质,所述计算机可读存储介质中存储有至少一条指令,至少一条指令由处理器加载并执行以实现如上所述的文件获取方法。On the one hand, the embodiment of the present application provides a computer-readable storage medium, at least one instruction is stored in the computer-readable storage medium, and the at least one instruction is loaded and executed by a processor to implement the file acquisition method as described above.
一方面,本申请实施例提供了一种计算机可读存储介质,所述计算机可读存储介质中存储有至少一条指令,至少一条指令由处理器加载并执行以实现如上所述的文件存储方法。On the one hand, an embodiment of the present application provides a computer-readable storage medium, at least one instruction is stored in the computer-readable storage medium, and at least one instruction is loaded and executed by a processor to implement the file storage method as described above.
本申请实施例提供的技术方案带来的有益效果至少为:The beneficial effects brought by the technical solutions provided by the embodiments of the present application are at least:
通过当第二存储节点检测到第一存储节点的第一账本是和第二存储节点中的第二账本匹配时,向第一存储节点发送需求文件片段,由于第一账本中包含第一存储节点对分布式文件存储系统中存储的文件片段的操作记录,因此第二存储节点可根据判断第一账本是否和第二账本匹配从而判断第一节点是否是分布式文件存储系统中的合法用户,解决了相关技术中通过不定期修改文件名防盗链所可能导致的合法用户的访问和/或下载行为失败的问题,在实现防盗链的基础上,由于降低了合法用户下载和/或访问文件的失败率,提高了用户获取文件的流畅度。When the second storage node detects that the first ledger of the first storage node matches the second ledger in the second storage node, it sends the required file fragment to the first storage node, since the first ledger contains the first storage node The operation records of the file fragments stored in the distributed file storage system, so the second storage node can determine whether the first node is a legitimate user in the distributed file storage system based on whether the first ledger matches the second ledger, and solve Solve the problem of the access and/or download behavior failure of legal users that may be caused by irregularly modifying the file name anti-hotlinking in related technologies. On the basis of realizing anti-hotlinking, the failure of legitimate users to download and/or access files The rate improves the fluency of users obtaining files.
附图说明Description of drawings
为了更清楚地说明本申请实施例中的技术方案,下面将对实施例描述中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图仅仅是本申请的一些实施例,对于本领域普通技术人员来讲,在不付出创造性劳动的前提下,还可以根据这些附图获得其它的附图。In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings that need to be used in the description of the embodiments will be briefly introduced below. Obviously, the drawings in the following description are only some embodiments of the present application. For those skilled in the art, other drawings can also be obtained based on these drawings without creative effort.
图1是本申请一个示例性实施例提供的文件获取方法的实施环境的示意图;Fig. 1 is a schematic diagram of an implementation environment of a file acquisition method provided by an exemplary embodiment of the present application;
图2是本申请一个示例性实施例提供的文件获取方法的方法流程图;Fig. 2 is a method flowchart of a file acquisition method provided by an exemplary embodiment of the present application;
图3是本申请一个示例性实施例提供的文件获取方法的一个具体实施例的架构图;Fig. 3 is a structure diagram of a specific embodiment of a file acquisition method provided by an exemplary embodiment of the present application;
图4是本申请一个示例性实施例提供的文件获取方法的方法流程图;Fig. 4 is a method flowchart of a file acquisition method provided by an exemplary embodiment of the present application;
图5是本申请一个示例性实施例提供的文件获取方法的方法流程图;Fig. 5 is a method flowchart of a file acquisition method provided by an exemplary embodiment of the present application;
图6是本申请一个示例性实施例提供的文件获取方法的一个具体实施例的架构图;Fig. 6 is a structure diagram of a specific embodiment of a file acquisition method provided by an exemplary embodiment of the present application;
图7是本申请一个示例性实施例提供的文件获取方法的方法流程图;Fig. 7 is a method flowchart of a file acquisition method provided by an exemplary embodiment of the present application;
图8是本申请一个示例性实施例提供的文件存储方法的方法流程图;Fig. 8 is a method flowchart of a file storage method provided by an exemplary embodiment of the present application;
图9是本申请一个示例性实施例提供的文件存储方法的一个具体实施例的架构图;Fig. 9 is a structure diagram of a specific embodiment of a file storage method provided by an exemplary embodiment of the present application;
图10是本申请一个示例性实施例提供的文件存储和获取方法的一个具体实施例的架构图;Fig. 10 is an architecture diagram of a specific embodiment of a file storage and acquisition method provided by an exemplary embodiment of the present application;
图11是本申请一个示例性实施例提供的文件获取装置的装置框图;Fig. 11 is a device block diagram of a file acquisition device provided by an exemplary embodiment of the present application;
图12是本申请一个示例性实施例提供的文件获取装置的装置框图;Fig. 12 is a device block diagram of a file acquisition device provided by an exemplary embodiment of the present application;
图13是本申请一个示例性实施例提供的电子设备的装置框图;Fig. 13 is a device block diagram of an electronic device provided by an exemplary embodiment of the present application;
图14是本申请一个示例性实施例提供的电子设备的装置框图。Fig. 14 is a device block diagram of an electronic device provided by an exemplary embodiment of the present application.
具体实施方式Detailed ways
为使本申请的目的、技术方案和优点更加清楚,下面将结合附图对本申请实施方式作进一步地详细描述。In order to make the purpose, technical solution and advantages of the present application clearer, the implementation manners of the present application will be further described in detail below in conjunction with the accompanying drawings.
为了方便理解,下面对本申请实施例中涉及的名词进行解释:For the convenience of understanding, the nouns involved in the embodiments of the present application are explained below:
分布式文件存储系统:是将一个文件分割成多个文件片段存储在至少两个电子设备中的存储系统;或,将一个文件的多个子文件存储在至少两个电子设备中;本申请在表述中将文件片段和子文件统称为文件片段。可选的,本申请中的分布式文件存储系统是星际文件系统。Distributed file storage system: It is a storage system that divides a file into multiple file fragments and stores them in at least two electronic devices; or stores multiple sub-files of a file in at least two electronic devices; this application expresses File fragments and sub-files are collectively referred to as file fragments in . Optionally, the distributed file storage system in this application is an interplanetary file system.
存储节点:是分布式文件存储系统中存储文件片段的电子设备,每个存储节点中存储有账本。Storage node: It is an electronic device that stores file fragments in a distributed file storage system, and each storage node stores a ledger.
索引节点:是分布式文件存储系统中存储有每个文件片段的操作记录的电子设备,每个索引节点存储有存储入分布式文件存储系统的文件的唯一识别信息以及总账本。其中,每个文件片段的操作记录是指分布式文件存储系统中每个存储节点对存储在分布式文件存储系统中的文件片段的操作记录,存储节点可通过索引节点查询到存储有需求文件片段的其它存储节点;可选的,分布式存储节点中的索引节点可以构成区块链平台,每个索引节点可以是区块链平台中的区块链节点。示例性的,本申请实施例中,以区块链平台为例,指代分布式文件存储系统的索引节点。Index node: It is an electronic device that stores the operation records of each file fragment in the distributed file storage system. Each index node stores the unique identification information of the files stored in the distributed file storage system and the general ledger. Among them, the operation record of each file segment refers to the operation record of each storage node in the distributed file storage system on the file segment stored in the distributed file storage system, and the storage node can query and store the required file segment through the index node other storage nodes; optionally, the index nodes in the distributed storage nodes can constitute a blockchain platform, and each index node can be a blockchain node in the blockchain platform. Exemplarily, in the embodiment of this application, the block chain platform is taken as an example, which refers to the index node of the distributed file storage system.
星际文件系统(Inter Planetary File System,IPFS):是一个面向全球的、点对点的分布式文件存储系统。Inter Planetary File System (IPFS): It is a global, peer-to-peer distributed file storage system.
账本:是存储节点对存储在分布式文件存储系统中的文件片段进行操作的操作记录。可选地,账本包括发送清单、已获取清单、修改清单、删除清单、未完成清单中的至少一种。发送清单是存储节点向其他存储节点发送的文件片段的操作记录,其包括存储节点发送的文件片段的唯一识别信息、以及发送对象的设备标识;已获取清单是存储节点从其他存储节点获取的文件片段的操作记录,其包括存储节点已获取的文件片段唯一识别信息、发送该文件片段的存储节点的设备标识、以及对该文件片段进行修改、发送和/或接收过的存储节点的设备标识;修改清单是存储节点修改过的文件片段的唯一识别信息;删除清单是是存储节点曾获取过但又删除掉的文件片段的唯一识别信息;未完成清单是存储节点响应其他存储节点的获取请求,但未完成发送的文件片段的唯一识别信息。Ledger: It is the operation record of storage nodes operating on file fragments stored in the distributed file storage system. Optionally, the ledger includes at least one of a sent list, an acquired list, a modified list, a deleted list, and an unfinished list. The sending list is the operation record of the file fragment sent by the storage node to other storage nodes, which includes the unique identification information of the file fragment sent by the storage node and the device identification of the sending object; the obtained list is the file obtained by the storage node from other storage nodes Fragment operation records, which include the unique identification information of the file fragment acquired by the storage node, the device identifier of the storage node that sent the file fragment, and the device identifier of the storage node that modified, sent and/or received the file fragment; The modification list is the unique identification information of the file fragments modified by the storage node; the deletion list is the unique identification information of the file fragments that the storage node has acquired but deleted; the unfinished list is the storage node’s response to the acquisition requests of other storage nodes. Unique identification information for file fragments that have not yet been sent.
例如,存储节点1向存储节点2发送了文件片段A,接收存储节点3发送的文件片段B,修改了文件片段C,删除了文件片段D,需要向存储节点4发送文件E,则存储节点1的账本1的发送清单中包含文件片段A的唯一识别信息和存储节点2的设备标识;账本1的已获取清单中包含文件片段B的唯一识别信息和存储节点3的设备标识;账本1的修改清单包含文件片段C的唯一识别信息和/或修改后的文件片段C的唯一识别信息;账本1的删除清单包含文件片段D的唯一识别信息;账本1的未完成清单中包含文件片段E的唯一识别信息。For example, storage node 1 sends file segment A to storage node 2, receives file segment B sent by storage node 3, modifies file segment C, deletes file segment D, and needs to send file E to storage node 4, then storage node 1 The sending list of ledger 1 contains the unique identification information of file fragment A and the device identifier of storage node 2; the acquired list of ledger 1 contains the unique identification information of file fragment B and the device identifier of storage node 3; the modification of ledger 1 The list contains the unique identification information of file fragment C and/or the unique identification information of the modified file fragment C; the deletion list of ledger 1 contains the unique identification information of file fragment D; the unfinished list of ledger 1 contains the unique identification information of file fragment E identifying information.
设备标识:是存储节点和索引节点在分布式文件存储系统中的编号标识,分布式文件存储系统中的任一存储节点或索引节点可通过设备标识与该设备标识对应的电子设备建立连接。Device ID: It is the number identification of storage nodes and index nodes in the distributed file storage system. Any storage node or index node in the distributed file storage system can establish a connection with the electronic device corresponding to the device ID through the device ID.
唯一识别信息:是分布式文件存储系统中存储的文件片段所对应的唯一的编码信息,存储节点可根据文件片段生成该文件片段的唯一识别信息。其中,每个文件或文件片段的唯一识别信息是唯一的。可选的,在分布式文件存储系统中,唯一识别可以是文件以及文件片段的哈希值,以下的描述中以哈希值为例,指代文件以及文件片段的唯一识别信息。Unique identification information: It is the unique coded information corresponding to the file fragment stored in the distributed file storage system, and the storage node can generate the unique identification information of the file fragment according to the file fragment. Wherein, the unique identification information of each file or file fragment is unique. Optionally, in the distributed file storage system, the unique identification may be the hash value of the file and the file fragment. In the following description, the hash value is used as an example to refer to the unique identification information of the file and the file fragment.
区块链平台:是由分布式存储系统中的索引节点构成的网络平台,在区块链平台中,索引节点被称为区块链节点,每个区块链节点存储有存储入分布式文件存储系统的文件的哈希值以及总账本。区块链平台包括至少两个通信连接的索引节点构成,每个索引节点为区块链平台中的一个区块链节点,每个区块链节点存储有区块链平台的总账本。至少两个区块链节点之间通过有线或无线网络同步各自存储的总账本。区块链平台与分布式文件存储系统中至少一个存储节点通信连接,接收分布式文件存储系统中至少一个存储节点发送的账本。Blockchain platform: It is a network platform composed of index nodes in the distributed storage system. In the blockchain platform, the index nodes are called blockchain nodes, and each blockchain node stores data stored in distributed files. The hash value of the file of the storage system and the general ledger. The blockchain platform includes at least two index nodes connected by communication, each index node is a blockchain node in the blockchain platform, and each blockchain node stores the general ledger of the blockchain platform. At least two blockchain nodes synchronize their respective stored ledgers through a wired or wireless network. The blockchain platform communicates with at least one storage node in the distributed file storage system, and receives the ledger sent by at least one storage node in the distributed file storage system.
总账本:是分布式文件存储系统中每个存储节点的账本,其包含存入分布式文件存储系统中的每个文件片段的操作记录、每个存储节点的设备标识以及该存储节点的账本的内容。General ledger: It is the ledger of each storage node in the distributed file storage system, which contains the operation record of each file fragment stored in the distributed file storage system, the device identification of each storage node, and the ledger of the storage node. content.
领导节点(Leader Node):是区块链平台中负责和存储节点通信的区块链节点。领导节点是从响应存储节点向区块链平台发送的存放请求的区块链节点中选举产生的。Leader Node: It is the blockchain node responsible for communicating with storage nodes in the blockchain platform. The leader node is elected from the blockchain nodes that respond to the deposit request sent by the storage node to the blockchain platform.
请参考图1,其示出了本申请一个示例性实施例提供的文件获取方法的实施环境的示意图,如图1所示,该实施环境包括区块链平台100和分布式文件存储系统200。Please refer to FIG. 1 , which shows a schematic diagram of an implementation environment of a file acquisition method provided by an exemplary embodiment of the present application. As shown in FIG. 1 , the implementation environment includes a blockchain platform 100 and a distributed file storage system 200 .
如图所示,区块链平台100包括多个区块链节点110、111、112、113、114、 115等等,每个区块链节点存储有区块链平台的总账本,多个区块链节点可通过有线或无线网络同步总账本。As shown in the figure, the block chain platform 100 includes a plurality of block chain nodes 110, 111, 112, 113, 114, 115, etc., each block chain node stores the general ledger book of the block chain platform, and multiple block chain nodes Block chain nodes can synchronize the ledger through wired or wireless networks.
例如,当区块链节点110中存储的总账本发生变更时,区块链节点110向区块链平台100中其它区块链节点广播变更后的总账本,其它区块链节点接收到该广播后,更新其存储的总账本。其中,总账本包括分布式文件存储系统200 中的每个存储节点对分布式文件存储系统200中存储的文件的操作记录,区块链平台100通过和分布式文件存储系统200中的存储节点的通信连接获取存储节点发送的账本,从而得到每个存储节点对分布式文件存储系统200中存储的文件的操作记录。For example, when the general ledger stored in the blockchain node 110 changes, the blockchain node 110 broadcasts the changed general ledger to other blockchain nodes in the blockchain platform 100, and other blockchain nodes receive the broadcast After that, update the general ledger it stores. Among them, the general ledger includes the operation records of each storage node in the distributed file storage system 200 on the files stored in the distributed file storage system 200, and the block chain platform 100 and the storage nodes in the distributed file storage system 200 The communication connection acquires the ledger sent by the storage nodes, so as to obtain the operation record of each storage node on the files stored in the distributed file storage system 200 .
分布式文件存储系统200包括多个存储节点210、211、212、213、214等等,用户可将需要存储的目标文件分割成至少两个目标文件片段存储在至少两个存储节点中。分布式文件存储系统200中的每个存储节存储有该存储节点自身的账本。The distributed file storage system 200 includes a plurality of storage nodes 210, 211, 212, 213, 214, etc., and a user can divide a target file to be stored into at least two target file segments and store them in at least two storage nodes. Each storage node in the distributed file storage system 200 stores its own ledger.
例如,存储节点210向存储节点211发送了文件片段X,则在存储节点210 的账本中的发送清单中存储有文件片段X的哈希值及存储节点211的设备标识,表示已向存储节点211发送文件片段X;同时,存储节点211的账本中的已获取清单中存储有文件片段X的哈希值及存储节点210的设备标识,表示已从存储节点210获取文件片段X。存储节点对文件片段进行操作,例如发送文件片段,或对文件片段进行修改、删除、复制等,都会记录在账本中对账本进行更新,并将更新后的账本以广播的形式向区块链平台100发送,区块链平台100中至少一个区块链节点接收到更新后的账本后,对存储在该节点的总账本进行更新,并向其他区块链节点广播更新后的总账本,使得每个区块链节点上保存的总账本是同步且一致的。For example, the storage node 210 has sent the file fragment X to the storage node 211, then the hash value of the file fragment X and the device identification of the storage node 211 are stored in the delivery list in the ledger of the storage node 210, indicating that the file fragment X has been sent to the storage node 211. Send the file fragment X; at the same time, the hash value of the file fragment X and the device identifier of the storage node 210 are stored in the acquired list in the ledger of the storage node 211, indicating that the file fragment X has been obtained from the storage node 210. Storage nodes operate on file fragments, such as sending file fragments, or modifying, deleting, and copying file fragments, etc., will be recorded in the ledger to update the ledger, and broadcast the updated ledger to the blockchain platform 100, after at least one blockchain node in the blockchain platform 100 receives the updated account book, it updates the general ledger stored in the node, and broadcasts the updated general ledger to other blockchain nodes, so that every The general ledgers stored on each blockchain node are synchronized and consistent.
请参考图2,其示出了本申请一个示例性实施例提供的文件获取方法的方法流程图。该方法可应用于如图1所示的实施环境中的分布式存储节点的第一存储节点中,该方法包括:Please refer to FIG. 2 , which shows a method flow chart of a file acquisition method provided by an exemplary embodiment of the present application. The method can be applied to the first storage node of the distributed storage nodes in the implementation environment shown in Figure 1, and the method includes:
步骤201,向分布式文件存储系统中的第二存储节点发送第一账本。Step 201, sending the first ledger to the second storage node in the distributed file storage system.
第一存储节点向第二存储节点发送第一账本。通常来说,第一存储节点向至少两个第二存储节点发送第一账本,但是在特定的情况下,例如,在第一存储节点仅剩一个文件片段未能获取到,且已经获取到其它的文件片段时,向一个第二存储节点发送第一账本。The first storage node sends the first ledger to the second storage node. Generally speaking, the first storage node sends the first ledger to at least two second storage nodes. When the file fragment of , send the first ledger to a second storage node.
可选的,第一账本中包含第一存储节点对分布式文件存储系统中存储的文件片段的操作记录。例如,第一存储节点接收了第三存储节点发送的文件片段X,且第一存储节点对文件片段X做出了修改,则在第一账本中的已获取清单中存储有文件片段X的唯一识别信息,以及第三存储节点的设备标识;在第一账本的修改清单中存储有文件片段X的唯一识别信息和/或修改后的文件片段X的唯一识别信息。Optionally, the first ledger includes operation records of the first storage node on the file fragments stored in the distributed file storage system. For example, if the first storage node receives the file fragment X sent by the third storage node, and the first storage node modifies the file fragment X, then the unique ID of the file fragment X is stored in the acquired list in the first ledger. Identification information, and the device identification of the third storage node; the unique identification information of the file fragment X and/or the unique identification information of the modified file fragment X are stored in the modification list of the first ledger.
需要说明的是,存储节点既可以是请求获取文件片段的存储节点,也可以是发送文件片段或存储文件片段的存储节点,本申请中仅为了表述上的区别,用第一存储节点指代请求获取文件片段的存储节点,用第二存储节点指代发送文件片段和存储文件片段的存储节点。It should be noted that a storage node can be a storage node that requests to obtain a file fragment, or a storage node that sends a file fragment or stores a file fragment. In this application, the first storage node is used to refer to the request The storage node of the file fragment is obtained, and the second storage node refers to the storage node that sends the file fragment and stores the file fragment.
步骤202,接收第二存储节点发送的连接建立指令,该连接建立指令是第二存储节点确定第一账本和第二账本匹配后发送的。Step 202: Receive a connection establishment instruction sent by the second storage node, where the connection establishment instruction is sent by the second storage node after determining that the first ledger matches the second ledger.
第一存储节点接收第二存储节点发送的连接建立指令。The first storage node receives the connection establishment instruction sent by the second storage node.
示例性的,第二存储节点在接收到第一账本后,检测第一账本是否和第二存储节点中存储的第二账本匹配,若第一账本和第二账本匹配,则向第一存储节点发送连接建立指令,该连接建立指令用于指示第一存储节点和第二存储节点建立连接。Exemplarily, after receiving the first ledger, the second storage node detects whether the first ledger matches the second ledger stored in the second storage node, and if the first ledger matches the second ledger, sends the first ledger to the first storage node Sending a connection establishment instruction, where the connection establishment instruction is used to instruct the first storage node to establish a connection with the second storage node.
第一账本和第二账本匹配是指第二账本中记录的第一存储节点的操作行为和第一账本中记录的第一存储节点的操作行为相同。The matching between the first ledger and the second ledger means that the operation behavior of the first storage node recorded in the second ledger is the same as that of the first storage node recorded in the first ledger.
例如,若第一存储节点将文件片段Y发送至分布式文件存储系统中的第三存储节点后,第三存储节点中存储的第三账本的已获取清单中会记录文件片段Y 的唯一识别信息以及第一存储节点的设备标识;若第三存储节点将文件片段Y 发送至第二存储节点后,第二账本的已获取清单上会记录文件片段Y的唯一识别信息、第三存储节点的设备标识、以及第一存储节点的设备标识;因此,当第一账本的已发送清单上记录了文件片段Y的唯一识别信息和第三存储节点的设备标识,而第二账本的已获取清单上记录有文件片段Y的唯一识别信息、第三存储节点的设备标识以及第一存储节点的设备标识,说明第一账本中记录的第一存储节点对文件片段Y的操作(即发送文件片段Y至第三节点)和第二账本中记录的第一节点对文件片段Y的操作(即第二存储节点从第三存储节点接收文件片段Y,第三存储节点从第一存储节点接收文件片段Y)是匹配的,因此第一账本和第二账本匹配。For example, if the first storage node sends the file fragment Y to the third storage node in the distributed file storage system, the unique identification information of the file fragment Y will be recorded in the acquired list of the third ledger stored in the third storage node And the device identification of the first storage node; if the third storage node sends the file fragment Y to the second storage node, the unique identification information of the file fragment Y and the device of the third storage node will be recorded on the acquired list of the second ledger. identification, and the device identification of the first storage node; therefore, when the unique identification information of the file segment Y and the device identification of the third storage node are recorded on the sent list of the first ledger, and the obtained list of the second ledger records There is the unique identification information of the file fragment Y, the device identifier of the third storage node and the device identifier of the first storage node, indicating the operation of the first storage node recorded in the first ledger on the file fragment Y (that is, sending the file fragment Y to the first storage node Three nodes) and the operation of the first node recorded in the second account book on the file segment Y (that is, the second storage node receives the file segment Y from the third storage node, and the third storage node receives the file segment Y from the first storage node) is Matched, so the first ledger and the second ledger match.
可选的,建立连接指令是第二存储节点确定第一账本和第二账本匹配,且第一存储节点的负债率不高于负债率阈值后发送的。负债率用于指示第一存储节点需要向分布式存储节点发送,但并未发送的文件片段在第一存储节点传输的文件片段中所占的比例。Optionally, the connection establishment instruction is sent by the second storage node after determining that the first ledger matches the second ledger, and the debt ratio of the first storage node is not higher than the debt ratio threshold. The debt ratio is used to indicate the proportion of the file fragments that the first storage node needs to send to the distributed storage nodes but have not sent to the file fragments transmitted by the first storage node.
示例性的,第二存储节点在确定第一账本和第二账本匹配后,根据第一账单中的已发送清单中的文件片段数目,以及未完成清单中的文件片段数据,计算第一存储节点的负债率。若该负债率高于负债率阈值,则确定第一存储节点为作恶节点,停止与第一存储节点的通信;若该负债率不高于负债率阈值,则向第一存储节点发送建立连接指令。其中,作恶节点是指负债率较高的存储节点。通常负债率较高的节点通常是存在系统故障的存储节点,作恶节点会向其他存储节点发送错误的账本,或,在响应了其他存储节点的传输请求后并没有发送其他存储节点请求的文件片段。Exemplarily, after the second storage node determines that the first ledger matches the second ledger, according to the number of file fragments in the sent list in the first bill and the file fragment data in the unfinished list, the first storage node calculates debt ratio. If the debt ratio is higher than the debt ratio threshold, determine that the first storage node is a malicious node, and stop communicating with the first storage node; if the debt ratio is not higher than the debt ratio threshold, send a connection establishment instruction to the first storage node . Among them, malicious nodes refer to storage nodes with a high debt ratio. Nodes with a high debt ratio are usually storage nodes with system failures. Evil nodes will send wrong ledgers to other storage nodes, or, after responding to transmission requests from other storage nodes, do not send file fragments requested by other storage nodes .
步骤203,根据连接建立指令和第二存储节点建立连接,向第二存储节点发送需求文件片段的唯一识别信息。Step 203: Establish a connection with the second storage node according to the connection establishment instruction, and send the unique identification information of the required file segment to the second storage node.
第一存储节点根据第二存储节点发送的建立连接指令,和第二存储节点建立连接后,向第二存储节点发送需求文件片段的唯一识别信息。可选的,该需求文件片段的唯一识别信息是需求文件片段的哈希值。After the first storage node establishes a connection with the second storage node according to the connection establishment instruction sent by the second storage node, it sends the unique identification information of the required file segment to the second storage node. Optionally, the unique identification information of the requirement file segment is a hash value of the requirement file segment.
示例性的,当第一存储节点和第二存储节点建立连接后,若第一存储节点需求的为需求文件片段A、需求文件片段B以及需求文件片段C,则第一存储节点向第二存储节点发送需求文件片段A的唯一识别信息、需求文件片段B的唯一识别信息以及需求文件片段C的唯一识别信息。Exemplarily, when the connection between the first storage node and the second storage node is established, if the first storage node requires file fragment A, file fragment B, and file fragment C, the first storage node sends The node sends the unique identification information of the requirement file fragment A, the unique identification information of the requirement file fragment B, and the unique identification information of the requirement file fragment C.
步骤204,接收第二存储节点发送的需求文件片段,并合并得到需求文件。Step 204: Receive the demand file fragments sent by the second storage node, and combine them to obtain the demand file.
第一存储节点接收第二存储节点发送的需求文件片段,将需求文件片段合并为需求文件。The first storage node receives the demand file fragments sent by the second storage node, and merges the demand file fragments into a demand file.
示例性的,第二存储节点接收到需求文件片段A的唯一识别信息、需求文件片段B的唯一识别信息以及需求文件片段C的唯一识别信息后,根据获取的需求文件片段的唯一识别信息,通过第二账本中的已获取清单检测本地是否存储有需求文件片段A、需求文件片段B和/或需求文件片段C,若本地存储有需求文件片段A,则向第一存储节点发送需求文件片段A;若本地存储有需求文件片段A以及需求文件片段B,则向第一存储节点发送需求文件片段A以及需求文件片段B;若本地存储有需求文件片段A以及需求文件片段C,则向第一存储节点发送需求文件片段A以及需求文件片段C;若本地存储有需求文件片段B以及需求文件片段C,则向第一存储节点发送需求文件片段B以及需求文件片段C。第一存储节点接收到至少两个第二存储节点发送的需求文件片段A、需求文件片段B以及需求文件片段C,将需求文件片段A、需求文件片段B以及需求文件片段C合并为需求文件。Exemplarily, after the second storage node receives the unique identification information of the required file segment A, the unique identification information of the required file segment B, and the unique identification information of the required file segment C, according to the acquired unique identification information of the required file segment, through The obtained list in the second account book detects whether there is a required file fragment A, a required file fragment B and/or a required file fragment C locally, and if the required file fragment A is stored locally, then send the required file fragment A to the first storage node ; If there are demand file fragment A and demand file fragment B stored locally, then send demand file fragment A and demand file fragment B to the first storage node; if locally store demand file fragment A and demand file fragment C, send to the first storage node The storage node sends the required file segment A and the required file segment C; if the required file segment B and the required file segment C are stored locally, the required file segment B and the required file segment C are sent to the first storage node. The first storage node receives demand file fragment A, demand file fragment B and demand file fragment C sent by at least two second storage nodes, and merges demand file fragment A, demand file fragment B and demand file fragment C into a demand file.
图3是本申请一个示例性实施例提供的文件获取方法的一个具体实施例的架构图。如图所示,分布式文件存储系统中的用户B在步骤1中首先初始化自身的账本;在步骤2中向存储节点发送公开信息和自身的账本,其中,公开信息用于向区块链平台广播用户B和存储节点将发生数据交换;在步骤3中,存储节点判断用户B的账本和自身的账本是否匹配;在步骤4中,存储节点判断用户B的账本和自身的账本匹配后,和用户B建立连接;在步骤5中,用户B 向存储节点发送需求清单;在步骤6中,存储节点检测本地是否存储有需求清单中的内容;在步骤7中,存储节点计算用户B的负债率;在步骤8中,当存储节点中存储有需求清单中的内容且用户B的负债率不高,存储节点向用户B 发送用户B需求的内容。Fig. 3 is a structure diagram of a specific embodiment of a file acquisition method provided by an exemplary embodiment of the present application. As shown in the figure, user B in the distributed file storage system first initializes its own ledger in step 1; in step 2, it sends the public information and its own ledger to the storage node, where the public information is used to send to the blockchain platform Broadcast user B and the storage node will exchange data; in step 3, the storage node judges whether user B’s ledger matches its own ledger; in step 4, after the storage node judges that user B’s ledger matches its own ledger, and User B establishes a connection; in step 5, user B sends the demand list to the storage node; in step 6, the storage node detects whether the content in the demand list is stored locally; in step 7, the storage node calculates user B's debt ratio ; In step 8, when the content in the demand list is stored in the storage node and the debt ratio of user B is not high, the storage node sends the content required by user B to user B.
综上所述,本申请实施例中,通过当第二存储节点检测到第一存储节点的第一账本是和第二存储节点中的第二账本匹配时,向第一存储节点发送需求文件片段,由于第一账本中包含第一存储节点对分布式文件存储系统中存储的文件片段的操作记录,因此第二存储节点可根据判断第一账本是否和第二账本匹配从而判断第一节点是否是分布式文件存储系统中的合法用户,解决了相关技术中通过不定期修改文件名防盗链所可能导致的合法用户的访问和/或下载行为失败的问题,在实现防盗链的基础上,由于降低了合法用户下载和/或访问文件的失败率,提高了用户获取文件的流畅度。To sum up, in this embodiment of the present application, when the second storage node detects that the first ledger of the first storage node matches the second ledger in the second storage node, the required file fragment is sent to the first storage node , since the first ledger contains the operation records of the first storage node on the file fragments stored in the distributed file storage system, the second storage node can determine whether the first node is The legal user in the distributed file storage system solves the problem of the legitimate user’s access and/or download failure that may be caused by irregularly modifying the file name anti-leech link in related technologies. On the basis of realizing the anti-leech link, due to reducing This reduces the failure rate of legitimate users downloading and/or accessing files, and improves the fluency of users obtaining files.
可选地,本申请实施例中的第二存储节点通过第一账本计算第一存储节点的负债率,当负债率不高于负债率阈值时,向第一存储节点发送连接建立指令,避免了作恶节点占用分布式文件存储系统的资源,提高了分布式文件存储系统的工作效率。Optionally, the second storage node in the embodiment of the present application calculates the debt ratio of the first storage node through the first ledger, and when the debt ratio is not higher than the debt ratio threshold, sends a connection establishment instruction to the first storage node, avoiding Evil nodes occupy the resources of the distributed file storage system, which improves the work efficiency of the distributed file storage system.
由于每个文件存储在多个第二存储节点上,当第一存储节点需要获取需求文件时,第一存储节点可通过区块链平台查询到该需求文件对应的至少两个第二存储节点(也即存储有需求文件片段的第二存储节点),从而向至少两个存储节点发送第一账本建立连接。其中,区块链平台与分布式文件存储系统中至少一个存储节点通信连接,获取分布式文件存储系统中至少一个节点广播的账本。图3的实施例将对第一存储节点通过区块链平台确定需求文件对应的至少两个第二存储节点做阐述。Since each file is stored on a plurality of second storage nodes, when the first storage node needs to obtain a demand file, the first storage node can query at least two second storage nodes ( That is, the second storage node that stores the required file fragment), so as to send the first ledger to at least two storage nodes to establish a connection. Wherein, the blockchain platform communicates with at least one storage node in the distributed file storage system, and obtains the ledger broadcast by at least one node in the distributed file storage system. The embodiment in FIG. 3 will illustrate that the first storage node determines at least two second storage nodes corresponding to the demand file through the blockchain platform.
请参考图3,其示出了本申请一个示例性实施例提供的文件获取方法的方法流程图。该方法可应用于如图1所示的实施环境中的分布式存储节点的第一存储节点中,该方法可以是图1实施例步骤201之前的步骤,该方法包括:Please refer to FIG. 3 , which shows a method flow chart of a method for obtaining files provided by an exemplary embodiment of the present application. The method can be applied to the first storage node of the distributed storage nodes in the implementation environment shown in FIG. 1, and the method can be a step before step 201 in the embodiment of FIG. 1, and the method includes:
步骤301,向区块链平台发送需求文件片段的哈希值。Step 301, sending the hash value of the required file fragment to the blockchain platform.
第一存储节点向区块链平台广播需求文件片段的哈希值。其中,区块链平台与分布式文件存储系统中至少一个存储节点通信连接,获取分布式文件存储系统中至少一个节点广播的账本。The first storage node broadcasts the hash value of the required file segment to the blockchain platform. Wherein, the blockchain platform communicates with at least one storage node in the distributed file storage system, and obtains the ledger broadcast by at least one node in the distributed file storage system.
区块链平台存储有总账本,该总账本包括存入分布式文件存储系统中的每个文件的操作记录,其包括存储到分布式文件存储系统中的文件的哈希值、存储到分布式文件存储系统中的文件对应的文件片段的哈希值、分布式文件存储系统中每个存储节点中存储的账本、以及每个账本对应的存储节点的设备标识。The blockchain platform stores a general ledger, which includes the operation record of each file stored in the distributed file storage system, including the hash value of the file stored in the distributed file storage system, the hash value stored in the distributed file storage system The hash value of the file segment corresponding to the file in the file storage system, the ledger stored in each storage node in the distributed file storage system, and the device identifier of the storage node corresponding to each ledger.
示例性的,分布式文件存储系统中的存储节点1将文件Z存储到分布式文件存储系统中时,会在区块链平台登记文件Z的哈希值,由于文件Z存入分布式文件存储系统需要分割为文件片段M和文件片段N,并将文件片段M存入存储节点2中,将文件片段M存入存储节点3中,则总账本中记录有文件Z的哈希值、文件Z的哈希值对应的存储节点1的设备标识、文件Z和文件片段M、文件片段N的对应关系、文件片段M和存储节点2的对应关系、以及文件片段N和存储节点3的对应关系。Exemplarily, when storage node 1 in the distributed file storage system stores file Z in the distributed file storage system, it will register the hash value of file Z on the blockchain platform, since file Z is stored in the distributed file storage The system needs to be divided into file fragment M and file fragment N, and file fragment M is stored in storage node 2, and file fragment M is stored in storage node 3, then the general ledger records the hash value of file Z, file Z The device identifier of storage node 1 corresponding to the hash value of , the correspondence between file Z and file fragment M, file fragment N, the correspondence between file fragment M and storage node 2, and the correspondence between file fragment N and storage node 3.
示例性的,若第一存储节点需求的为需求文件X,则向区块链平台一个区块链节点发送需求文件X的名字,该区块链节点根据需求文件X的名字查询到对应的需求文件X的哈希值,以及需求文件X对应的需求文件片段A、需求文件片段B以及需求文件片段C的哈希值,向第一存储节点发送需求文件片段A、需求文件片段B以及需求文件片段C的哈希值,第一存储节点将需求文件片段 A、需求文件片段B以及需求文件片段C的哈希值记录在需求文件清单中。Exemplarily, if the first storage node requires a demand file X, then send the name of the demand file X to a blockchain node on the blockchain platform, and the blockchain node can query the corresponding demand according to the name of the demand file X The hash value of file X, and the hash values of demand file fragment A, demand file fragment B, and demand file fragment C corresponding to demand file X, and send demand file fragment A, demand file fragment B, and demand file to the first storage node For the hash value of fragment C, the first storage node records the hash values of required file fragment A, required file fragment B, and required file fragment C in the required file list.
第一存储节点向区块链平台广播需求文件片段A的哈希值、需求文件片段 B的哈希值以及需求文件C的哈希值,区块链平台中的一个区块链节点响应第一存储节点的广播吗,在总账本上查询到存储有需求文件片段A的第二存储节点4的设备标识、存储有需求文件片段B和需求片段C的第二存储节点5的设备标识。The first storage node broadcasts the hash value of required file fragment A, the hash value of required file fragment B, and the hash value of required file C to the blockchain platform, and a blockchain node in the blockchain platform responds with the first Whether the storage node is broadcasting, the device identification of the second storage node 4 storing the required file segment A, the device identification of the second storage node 5 storing the required file segment B and the required segment C are queried on the general ledger.
步骤302,接收区块链平台发送的至少两个第二存储节点的设备标识。Step 302, receiving device identifications of at least two second storage nodes sent by the blockchain platform.
第一存储节点接收区块链平台发送的至少两个第二存储节点的设备标识。The first storage node receives the device identifications of at least two second storage nodes sent by the blockchain platform.
示例性的,若区块链平台查询到第二存储节点4存储有需求文件片段A,第二存储节点5存储有需求文件片段B和需求文件片段C,则向第一存储节点发送第二存储节点4和第二存储节点5的设备标识。Exemplarily, if the blockchain platform inquires that the second storage node 4 stores the required file segment A, and the second storage node 5 stores the required file segment B and the required file segment C, then the second storage node is sent to the first storage node. Node 4 and the device ID of the second storage node 5.
步骤303,根据至少两个第二存储节点的设备标识,向至少两个第二存储节点发送第一账本。Step 303: Send the first ledger to at least two second storage nodes according to the device identifiers of the at least two second storage nodes.
第一存储节点根据至少两个第二存储节点的设备标识,向至少两个第二存储节点发送第一账本。The first storage node sends the first ledger to the at least two second storage nodes according to the device identifiers of the at least two second storage nodes.
示例性的,第一存储节点在接收到区块链平台发送的第二存储节点4和第二存储节点5的设备标识后,向第二存储节点4和第二存储节点5发送第一账本。Exemplarily, the first storage node sends the first ledger to the second storage node 4 and the second storage node 5 after receiving the device identifications of the second storage node 4 and the second storage node 5 sent by the blockchain platform.
综上所述,本申请实施例中,第一存储节点通过向区块链平台发送需求文件片段的哈希值,区块链平台根据需求片段的哈希值在总账中查询存储有需求文件片段的至少两个第二存储节点,向第一存储节点发送至少两个第二存储节点的设备标识,从而使第一存储节点能够准确的和存储有需求文件片段的至少两个第二存储节点建立连接。To sum up, in the embodiment of this application, the first storage node sends the hash value of the required file fragment to the blockchain platform, and the blockchain platform queries and stores the required file fragment in the general ledger according to the hash value of the required fragment. at least two second storage nodes, and send the device identifiers of the at least two second storage nodes to the first storage node, so that the first storage node can accurately establish the connect.
请参考图5,其示出了本申请一个示例性实施例提供的文件获取方法的方法流程图。该方法可应用于如图1所示的实施环境中的分布式存储节点的第一存储节点中,该方法可以是图1实施例步骤204之后的步骤,该方法包括:Please refer to FIG. 5 , which shows a flowchart of a method for obtaining files provided by an exemplary embodiment of the present application. The method can be applied to the first storage node of the distributed storage nodes in the implementation environment shown in Figure 1, and the method can be a step after step 204 in the embodiment of Figure 1, and the method includes:
步骤401,接收第二存储节点发送的需求文件片段的哈希值。Step 401: Receive the hash value of the required file segment sent by the second storage node.
第二存储节点向第一存储节点发送需求文件片段的同时,发送该需求文件片段的哈希值。When the second storage node sends the required file segment to the first storage node, it also sends the hash value of the required file segment.
步骤402,根据第二存储节点发送的需求文件片段的哈希值,检测第二存储节点发送的需求文件片段是否是第一存储节点需要获取的需求文件片段。Step 402: According to the hash value of the required file segment sent by the second storage node, it is detected whether the required file segment sent by the second storage node is the required file segment to be acquired by the first storage node.
第一存储节点根据第二存储节点发送的需求文件片段的哈希值,通过第一账本中的需求清单,检测第二存储节点发送的需求文件片段是否是第一存储节点需要获取的需求文件片段。According to the hash value of the demand file fragment sent by the second storage node, the first storage node detects whether the demand file fragment sent by the second storage node is the demand file fragment to be obtained by the first storage node through the demand list in the first ledger .
步骤403,若确定第二存储节点发送的需求文件片段是第一存储节点需要获取的需求文件片段,则将需求文件片段的哈希值从需求清单中删除,并将需求文件片段的哈希值添加到已获取清单中,得到更新后的第一账本。Step 403, if it is determined that the demand file segment sent by the second storage node is the demand file segment to be acquired by the first storage node, then delete the hash value of the demand file segment from the demand list, and save the hash value of the demand file segment Add it to the acquired list to get the updated first ledger.
若第二存储节点发送的需求文件片段的哈希值和需求清单中存储的需求文件片段的哈希值匹配,则确定第二存储节点发送的需求文件片段是第一存储节点需要获取的需求文件片段,将需求文件片段的哈希值从需求清单中删除,并将需求文件片段的哈希值添加到已获取清单中,得到更新后的第一账本。If the hash value of the demand file segment sent by the second storage node matches the hash value of the demand file segment stored in the demand list, it is determined that the demand file segment sent by the second storage node is the demand file that the first storage node needs to obtain Fragment, delete the hash value of the required file fragment from the requirement list, and add the hash value of the required file fragment to the acquired list to obtain the updated first ledger.
步骤404,向区块链平台发送更新后的第一账本,用于使区块链平台更新总账本。Step 404, sending the updated first ledger to the blockchain platform for updating the general ledger on the blockchain platform.
第一存储节点向区块链平台广播更新后的第一账本,区块链平台中的一个区块链节点响应该广播后,根据更新后的第一账本更新本地存储的总账本,并向区块链平台中的其它区块链节点广播更新后的总账本以同步总账本。The first storage node broadcasts the updated first ledger to the blockchain platform. After a blockchain node in the blockchain platform responds to the broadcast, it updates the locally stored general ledger according to the updated first ledger, and reports to the district Other blockchain nodes in the blockchain platform broadcast the updated ledger to synchronize the ledger.
图6是本申请一个示例性实施例提供的文件获取方法的一个具体实施例的架构图。如图所示,在步骤1中,分布式文件存储系统中的用户B校验从存储节点中接收到的内容的哈希值是否存在于需求清单中;在步骤2中,若校验通过,则向存储节点返回认证;在步骤3中,存储节点根据用户B返回的认证更新自身的账本;在步骤4中,存储节点向区块链平台广播更新后的自身账本,以更新区块链平台的总账本;在步骤5中,用户B把接收内容从需求清单中删除,增加到已获取清单中;在步骤6中,用户B更新自身的账本;在步骤7中,用户B向区块链平台广播更新后的自身账本,以更新区块链平台的总账本。Fig. 6 is a structure diagram of a specific embodiment of a file acquisition method provided by an exemplary embodiment of the present application. As shown in the figure, in step 1, user B in the distributed file storage system verifies whether the hash value of the content received from the storage node exists in the demand list; in step 2, if the verification is passed, Then return the authentication to the storage node; in step 3, the storage node updates its own ledger according to the authentication returned by user B; in step 4, the storage node broadcasts the updated own ledger to the blockchain platform to update the blockchain platform ledger; in step 5, user B deletes the received content from the demand list and adds it to the obtained list; in step 6, user B updates his own ledger; in step 7, user B sends the blockchain The platform broadcasts the updated self-ledger to update the general ledger of the blockchain platform.
综上所述,本申请实施例中,第一存储节点通过第二存储节点发送的需求文件片段的哈希值验证第二存储节点发送的需求文件片段是否是第一存储节点需要获取的需求文件片段,提高了文件片段获取的准确度。To sum up, in the embodiment of this application, the first storage node verifies whether the demand file fragment sent by the second storage node is the demand file that the first storage node needs to obtain through the hash value of the demand file fragment sent by the second storage node Fragments, improving the accuracy of file fragment acquisition.
进一步的,本申请实施例中,通过第一存储节点向区块链平台广播更新后的第一账本,区块链平台根据更新后的第一账本更新总账本,提高了区块链平台中存储的总账本的时效性。Further, in the embodiment of the present application, the updated first ledger is broadcast to the blockchain platform through the first storage node, and the blockchain platform updates the general ledger according to the updated first ledger, which improves the storage capacity of the blockchain platform. The timeliness of the general ledger.
请参考图7,其示出了本申请一个示例性实施例提供的文件获取方法的方法流程图。该方法可应用于如图1所示的实施环境中的分布式存储节点的第一存储节点中,该方法包括:Please refer to FIG. 7 , which shows a flow chart of a method for obtaining files provided by an exemplary embodiment of the present application. The method can be applied to the first storage node of the distributed storage nodes in the implementation environment shown in Figure 1, and the method includes:
步骤501,第一存储节点向区块链平台发送需求文件片段的哈希值。Step 501, the first storage node sends the hash value of the required file segment to the blockchain platform.
第一存储节点向区块链平台广播需求文件片段的哈希值。其中,需求文件片段是第一存储节点所需要获取文件的文件片段。The first storage node broadcasts the hash value of the required file segment to the blockchain platform. Wherein, the required file fragment is a file fragment of the file that the first storage node needs to obtain.
步骤502,区块链平台根据需求文件片段的哈希值,通过总账本查询到存储有需求文件片段的至少两个第二存储节点的设备标识。In step 502, the blockchain platform queries the device identifiers of at least two second storage nodes storing the required file segments through the general ledger according to the hash values of the required file segments.
区块链平台中的一个区块链节点响应第一存储节点的广播,根据需求文件片段的哈希值,在总账本中查询到存储有需求文件片段的至少两个第二存储节点的设备标识。A block chain node in the block chain platform responds to the broadcast of the first storage node, and according to the hash value of the required file segment, queries the device identification of at least two second storage nodes storing the required file segment in the general ledger .
步骤503,区块链平台向第一存储节点发送至少两个第二存储节点的设备标识。Step 503, the blockchain platform sends at least two device identifications of the second storage node to the first storage node.
区块链平台中的一个区块链节点向第一存储节点发送至少两个第二存储节点的标识。A block chain node in the block chain platform sends identifications of at least two second storage nodes to the first storage node.
步骤504,第一存储节点根据至少两个第二存储节点的设备标识,向该至少两个第二存储节点发送第一账本。Step 504, the first storage node sends the first ledger to the at least two second storage nodes according to the device identifiers of the at least two second storage nodes.
第一存储节点根据区块链平台发送的至少两个第二存储节点的设备标识,向该至少两个第二存储节点发送第一账本。The first storage node sends the first ledger to the at least two second storage nodes according to the device identifiers of the at least two second storage nodes sent by the blockchain platform.
步骤505,第二存储节点在确定第一账本是和第二账本匹配后,根据第一账本计算第一存储节点的负债率。In step 505, the second storage node calculates the debt ratio of the first storage node according to the first ledger after determining that the first ledger matches the second ledger.
第二存储节点在接收到第一账本后,检测第一账本是否和第二存储节点中存储的第二账本匹配,若第一账本和第二账本匹配,则根据第一账单中的已发送清单中的文件片段数目,以及未完成清单中的文件片段数据,计算第一存储节点的负债率。After receiving the first ledger, the second storage node detects whether the first ledger matches the second ledger stored in the second storage node, and if the first ledger matches the second ledger, then according to the sent list in the first bill The number of file fragments in , and the file fragment data in the unfinished list, calculate the debt ratio of the first storage node.
其中,第一账本和第二账本匹配是指第二账本中记录的第一存储节点的操作行为和第一账本中记录的第一存储节点的操作行为相同。Wherein, the matching between the first ledger and the second ledger means that the operation behavior of the first storage node recorded in the second ledger is the same as the operation behavior of the first storage node recorded in the first ledger.
步骤506,若第一账本和第二账本匹配,且第一存储节点的负债率不高于负债率阈值,则第二存储节点向第一存储节点发送连接建立指令。Step 506: If the first ledger matches the second ledger and the debt ratio of the first storage node is not higher than the debt ratio threshold, the second storage node sends a connection establishment instruction to the first storage node.
确定第一账本和第二账本匹配,则确定第一存储节点是分布式文件存储系统中的合法用户,不是盗链用户,确定第一存储节点的负债率不高于负债率阈值,则确定第一存储节点不是作恶节点,则第二存储节点向第一存储节点发送连接建立指令。If it is determined that the first ledger and the second ledger match, then it is determined that the first storage node is a legitimate user in the distributed file storage system, not a hotlink user, and it is determined that the debt ratio of the first storage node is not higher than the debt ratio threshold, then it is determined that the second If one storage node is not a malicious node, the second storage node sends a connection establishment instruction to the first storage node.
可选的,第二存储节点根据第一存储节点的负债率在所有有效节点中排名,按照排名从后到前的顺序向第一存储节点发送连接建立指令。其中,有效节点是分布式文件存储系统中,向第二存储节点发送了账本且负债率不高于负债率阈值的节点。Optionally, the second storage node ranks all valid nodes according to the debt ratio of the first storage node, and sends the connection establishment instruction to the first storage node in order of ranking from back to front. Wherein, the valid node is a node in the distributed file storage system that has sent the ledger to the second storage node and whose debt ratio is not higher than the debt ratio threshold.
第二存储节点可能响应了多个其它存储节点的发送请求,因此第二存储节点需要对发送文件片段的顺序进行排序。第二存储节点在计算了所有有效节点的负债率之后,得到第一存储节点的负债率在所有有效节点中排名,若有效节点为10个,第一存储节点的的负债率在所有有效节点中排名第3,则第二存储节点向第一存储节点发送文件片段的顺位是第7。The second storage node may have responded to the sending requests of multiple other storage nodes, so the second storage node needs to sort the order of sending file segments. After the second storage node calculates the debt ratio of all valid nodes, the debt ratio of the first storage node ranks among all valid nodes. If there are 10 valid nodes, the debt ratio of the first storage node ranks among all valid nodes If the ranking is third, the order in which the second storage node sends file fragments to the first storage node is seventh.
步骤507,第一存储节点根据连接建立指令和第二存储节点建立连接,向第二存储节点发送需求文件片段的哈希值。Step 507, the first storage node establishes a connection with the second storage node according to the connection establishment instruction, and sends the hash value of the required file segment to the second storage node.
第一存储节点根据第二存储节点发送的建立连接指令,和第二存储节点建立连接后,向第二存储节点发送需求文件片段的哈希值。After the first storage node establishes a connection with the second storage node according to the connection establishment instruction sent by the second storage node, it sends the hash value of the required file segment to the second storage node.
步骤508,第二存储节点根据第一存储节点发送的需求文件片段的哈希值,向第一存储节点发送需求文件片段以及需求文件片段的哈希值。Step 508, the second storage node sends the required file segment and the hash value of the required file segment to the first storage node according to the hash value of the required file segment sent by the first storage node.
示例性的,第二存储节点接收到需求文件片段的哈希值后,通过第二账本中的已获取清单检测本地是否存储有需求文件片段,若本地存储有需求文件片段,则向第一存储节点发送该需求文件片段以及该需求文件片段的哈希值。Exemplarily, after the second storage node receives the hash value of the required file fragment, it detects whether there is a required file fragment stored locally through the obtained list in the second ledger, and if there is a required file fragment stored locally, it sends a request to the first storage node. The node sends the requirement file fragment and the hash value of the requirement file fragment.
步骤509,第一存储节点接收第二存储节点发送的需求文件片段,并合并得到需求文件。Step 509, the first storage node receives the demand file fragments sent by the second storage node, and combines them to obtain the demand file.
第一存储节点接收到至少两个第二存储节点发送的需求文件片段后,将需求文件片段合并为需求文件。After receiving the demand file fragments sent by at least two second storage nodes, the first storage node merges the demand file fragments into a demand file.
步骤510,第一存储节点根据第二存储节点发送的需求文件片段的哈希值,检测第二存储节点发送的需求文件片段是否是第一存储节点需要获取的需求文件片段。Step 510, the first storage node detects whether the required file segment sent by the second storage node is the required file segment to be acquired by the first storage node according to the hash value of the required file segment sent by the second storage node.
第一存储节点根据第二存储节点发送的需求文件片段的哈希值,通过第一账本中的需求清单,检测第二存储节点发送的需求文件片段是否是第一存储节点需要获取的需求文件片段。According to the hash value of the demand file fragment sent by the second storage node, the first storage node detects whether the demand file fragment sent by the second storage node is the demand file fragment to be obtained by the first storage node through the demand list in the first ledger .
若需求文件片段是第一存储节点需要获取的需求文件片段,则进入步骤 511;若需求文件片段不是第一存储节点需要获取的需求文件片段,则向区块链平台重新发送传送错误的需求文件片段的哈希值。If the demand file fragment is the demand file fragment that the first storage node needs to obtain, then enter step 511; if the demand file fragment is not the demand file fragment that the first storage node needs to obtain, then resend the wrong demand file to the block chain platform The fragment's hash value.
步骤511,第一存储节点确定第二存储节点发送的需求文件片段是第一存储节点需要获取的需求文件片段后,将需求文件片段的哈希值从需求清单中删除,并将需求文件片段的哈希值添加到已获取清单中,得到更新后的第一账本。Step 511, after the first storage node determines that the required file segment sent by the second storage node is the required file segment to be obtained by the first storage node, delete the hash value of the required file segment from the demand list, and save the required file segment The hash value is added to the acquired list to obtain the updated first ledger.
若第二存储节点发送的需求文件片段的哈希值和需求清单中存储的需求文件片段的哈希值匹配,则确定第二存储节点发送的需求文件片段是第一存储节点需要获取的需求文件片段,将需求文件片段的哈希值从需求清单中删除,并将需求文件片段的哈希值添加到已获取清单中,得到更新后的第一账本。If the hash value of the demand file segment sent by the second storage node matches the hash value of the demand file segment stored in the demand list, it is determined that the demand file segment sent by the second storage node is the demand file that the first storage node needs to obtain Fragment, delete the hash value of the required file fragment from the requirement list, and add the hash value of the required file fragment to the acquired list to obtain the updated first ledger.
步骤512,第一存储节点向区块链平台发送更新后的第一账本,用于使区块链平台更新总账本。Step 512, the first storage node sends the updated first ledger to the blockchain platform, so that the blockchain platform can update the general ledger.
第一存储节点向区块链平台广播更新后的第一账本,区块链平台中的多个区块链节点在查询区块链平台中的广播内容,其中的一个区块链节点响应第一存储节点的广播后,根据更新后的第一账本更新本地存储的总账本,并向区块链平台中的其它区块链节点广播更新后的总账本以同步总账本。The first storage node broadcasts the updated first account book to the blockchain platform, and multiple blockchain nodes in the blockchain platform are querying the broadcast content in the blockchain platform, and one of the blockchain nodes responds to the first After the broadcast of the storage node, the locally stored general ledger is updated according to the updated first ledger, and the updated general ledger is broadcast to other blockchain nodes in the blockchain platform to synchronize the general ledger.
步骤513,第一存储节点向第二存储节点发送确认结果。Step 513, the first storage node sends a confirmation result to the second storage node.
第一存储节点确定第二存储节点发送的需求文件片段是第一存储节点需要获取的需求文件片段后,向第二存储节点发送确认结果,该确认结果用于告知第二存储节点其发送的需求文件片段是第一存储节点需求的需求文件片段。After the first storage node determines that the demand file segment sent by the second storage node is the demand file segment that the first storage node needs to obtain, it sends a confirmation result to the second storage node, and the confirmation result is used to inform the second storage node of the demand file it sends The file fragment is a demand file fragment required by the first storage node.
步骤514,第二存储节点将需求文件片段的哈希值添加到第二账本的发送清单中,得到更新后的第二账本。In step 514, the second storage node adds the hash value of the required file segment to the delivery list of the second ledger to obtain an updated second ledger.
第二存储节点接收到第一存储节点发送的确认结果后,将需求文件片段的哈希值添加到第二账本的发送清单中,得到更新后的第二账本。After receiving the confirmation result sent by the first storage node, the second storage node adds the hash value of the required file fragment to the delivery list of the second ledger to obtain an updated second ledger.
步骤515,发送更新后的第二账本。Step 515, sending the updated second ledger.
第二存储节点向区块链平台广播更新后的第二账本,区块链平台中的多个区块链节点在查询区块链平台中的广播内容,其中的一个区块链节点响应第二存储节点的广播后,根据更新后的第二账本更新本地存储的总账本,并向区块链平台中的其它区块链节点广播更新后的总账本以同步总账本。The second storage node broadcasts the updated second account book to the blockchain platform, and multiple blockchain nodes in the blockchain platform are querying the broadcast content in the blockchain platform, and one of the blockchain nodes responds to the second After the broadcast of the storage node, the locally stored general ledger is updated according to the updated second ledger, and the updated general ledger is broadcast to other blockchain nodes in the blockchain platform to synchronize the general ledger.
综上所述,本申请实施例中,通过当第二存储节点检测到第一存储节点的第一账本是和第二存储节点中的第二账本匹配时,向第一存储节点发送需求文件片段,由于第一账本中包含第一存储节点对分布式文件存储系统中存储的文件片段的操作记录,因此第二存储节点可根据判断第一账本是否和第二账本匹配从而判断第一节点是否是分布式文件存储系统中的合法用户,解决了相关技术中通过不定期修改文件名防盗链所可能导致的合法用户的访问和/或下载行为失败的问题,在实现防盗链的基础上,由于降低了合法用户下载和/或访问文件的失败率,提高了用户获取文件的流畅度。To sum up, in this embodiment of the present application, when the second storage node detects that the first ledger of the first storage node matches the second ledger in the second storage node, the required file fragment is sent to the first storage node , since the first ledger contains the operation records of the first storage node on the file fragments stored in the distributed file storage system, the second storage node can determine whether the first node is The legal user in the distributed file storage system solves the problem of the legitimate user’s access and/or download failure that may be caused by irregularly modifying the file name anti-leech link in related technologies. On the basis of realizing the anti-leech link, due to reducing This reduces the failure rate of legitimate users downloading and/or accessing files, and improves the fluency of users obtaining files.
可选的,本申请实施例中的第二存储节点通过第一账本计算第一存储节点的负债率,当负债率不高于负债率阈值时,向第一存储节点发送连接建立指令,避免了作恶节点占用分布式文件存储系统的资源,提高了分布式文件存储系统的工作效率。Optionally, the second storage node in the embodiment of the present application calculates the debt ratio of the first storage node through the first ledger, and when the debt ratio is not higher than the debt ratio threshold, sends a connection establishment instruction to the first storage node, avoiding Evil nodes occupy the resources of the distributed file storage system, which improves the work efficiency of the distributed file storage system.
可选地,本申请实施例中的第一存储节点通过向区块链平台发送需求文件片段的哈希值,区块链平台根据需求片段的哈希值在总账中查询存储有需求文件片段的至少两个第二存储节点,向第一存储节点发送至少两个第二存储节点的设备标识,从而使第一存储节点能够准确的和存储有需求文件片段的至少两个第二存储节点建立连接。Optionally, the first storage node in the embodiment of the present application sends the hash value of the required file fragment to the blockchain platform, and the blockchain platform queries the general ledger for storing the required file fragment according to the hash value of the required file fragment. At least two second storage nodes, sending device identifications of at least two second storage nodes to the first storage node, so that the first storage node can accurately establish a connection with at least two second storage nodes storing required file segments .
可选地,本申请实施例中的第一存储节点通过第二存储节点发送的需求文件片段的哈希值验证第二存储节点发送的需求文件片段是否是第一存储节点需要获取的需求文件片段,避免了因为第二存储节点的系统故障导致第一存储节点接收到错误文件片段,提高了文件片段获取的准确度。Optionally, the first storage node in the embodiment of the present application verifies whether the demand file fragment sent by the second storage node is the demand file fragment that the first storage node needs to obtain by using the hash value of the demand file fragment sent by the second storage node This prevents the first storage node from receiving an incorrect file segment due to a system failure of the second storage node, and improves the accuracy of obtaining the file segment.
可选地,本申请实施例中,通过第一存储节点和第二存储节点向区块链平台广播更新后的第一账本和更新后的第二账本,区块链平台根据更新后的第一账本和更新后的第二账本更新总账本,提高了区块链平台中存储的总账本的时效性。Optionally, in this embodiment of the application, the updated first ledger and the updated second ledger are broadcast to the blockchain platform through the first storage node and the second storage node, and the blockchain platform The ledger and the updated second ledger update the general ledger, which improves the timeliness of the general ledger stored in the blockchain platform.
在第一存储节点从至少两个第二存储节点获取需求文件片段之前,至少两个第二存储节点中的一个第二存储节点可以将目标文件存储至分布式文件存储系统中。图8和图9的实施例将对第二存储节点将目标文件存入分布式文件存储系统的存储过程做阐述。Before the first storage node acquires the required file segments from the at least two second storage nodes, one second storage node of the at least two second storage nodes may store the target file in the distributed file storage system. The embodiments of FIG. 8 and FIG. 9 will illustrate the storage process of the second storage node storing the target file in the distributed file storage system.
请参考图8,其示出了本申请一个示例性实施例提供的文件存储方法的方法流程图。该方法可应用于如图1所示的实施环境中的分布式存储节点的一个第二存储节点中,该方法可以是图2实施例中的步骤201之前的方法,该方法包括:Please refer to FIG. 8 , which shows a method flowchart of a file storage method provided by an exemplary embodiment of the present application. The method can be applied to a second storage node of the distributed storage nodes in the implementation environment shown in FIG. 1, and the method can be the method before step 201 in the embodiment of FIG. 2, and the method includes:
步骤601,第二存储节点向区块链平台发送存放请求。Step 601, the second storage node sends a storage request to the blockchain platform.
第二存储节点向区块链平台广播存放请求,该存放请求用于向区块链平台告知第二存储节点请求在分布式文件存储系统中存储目标文件。The second storage node broadcasts a storage request to the blockchain platform, and the storage request is used to inform the blockchain platform that the second storage node requests to store the target file in the distributed file storage system.
步骤602,区块链平台中的n个区块链节点根据存放请求启动一个随机时长的计时器,n为自然数,n≥2。Step 602, n blockchain nodes in the blockchain platform start a timer with a random duration according to the storage request, n is a natural number, n≥2.
示例性的,n个区块链节点响应第二存储节点的存放请求,在经过第一时间段后,n个区块链节点进入激活状态,相互之间发送激活信令;在经过第二时间段后,处于激活状态的n个区块链节点在同一时刻启动一个随机时长的计时器。Exemplarily, n blockchain nodes respond to the storage request of the second storage node, and after the first time period passes, the n blockchain nodes enter the activation state and send activation signaling to each other; after the second time period After a period, the n blockchain nodes in the activated state start a timer with a random duration at the same time.
步骤603,n个区块链节点中的第i个区块链节点在计时器超时后,向n个区块链节点中除去第i个区块链节点的其它n-1个区块链节点发送第i个计时完成信令,i为自然数,1≤i≤n。Step 603, the i-th blockchain node among the n blockchain nodes removes the other n-1 blockchain nodes of the i-th blockchain node from the n blockchain nodes after the timer expires Send the i-th timing completion signaling, i is a natural number, 1≤i≤n.
第i个区块链节点在计时器超时后,向n个区块链节点中的其它n-1个区块链节点发送第i个计时完成信令。其中,第i个计时完成信令携带有第i个区块链节点的计时器超时的时刻和第i个区块链节点的设备标识。After the timer expires, the i-th blockchain node sends the i-th timing completion signaling to the other n-1 blockchain nodes among the n blockchain nodes. Wherein, the i-th timing completion signaling carries the time when the timer of the i-th blockchain node expires and the device identifier of the i-th blockchain node.
步骤604,n个区块链节点中的第j个区块链节点在接收到计时完成信令时,若第j个区块链节点的计时器没有超时,则停止计时器,向n个区块链节点中除去第j个区块链节点的其它n-1个区块链节点发送已接收信令,j为自然数,1≤ j≤n。Step 604, when the j-th blockchain node among the n blockchain nodes receives the timing completion signaling, if the timer of the j-th blockchain node has not timed out, stop the timer and send to the n districts The other n-1 blockchain nodes except the jth blockchain node among the blockchain nodes send received signaling, j is a natural number, 1≤j≤n.
第j个区块链节点在接收到其它区块链节点发送的计时完成信令时,若第j 个区块链节点的计时器没有超时,则停止计时器,向其它n-1个区块链节点发送已接收信令。其中,第j个已接收信令携带有第j个区块链节点的设备标识。When the j-th blockchain node receives the timing completion signaling sent by other blockchain nodes, if the timer of the j-th blockchain node has not timed out, it will stop the timer and send data to other n-1 blocks Chain nodes send received signaling. Among them, the jth received signaling carries the device identification of the jth blockchain node.
步骤605,n个区块链节点两两之间在接收到计时完成信令和已接收信令后,根据计时完成信令,将计时器超时时刻最早的区块链节点作为领导节点。Step 605, after receiving the timing completion signaling and the received signaling between the n blockchain nodes, according to the timing completion signaling, the blockchain node with the earliest timer timeout time is taken as the leader node.
n个区块链节点中的任一区块链节点在接收到其它区块链节点发送的信令后,根据计时完成信令中携带的计时完成时刻和区块链节点的设备标识,将计时完成时刻最早的区块链节点选举为领导节点,该领导节点用于和第二存储节点进行通信和转发第二存储节点发送的信息。After receiving the signaling sent by other blockchain nodes, any blockchain node in the n blockchain nodes will time the timing according to the timing completion time carried in the timing completion signaling and the The blockchain node with the earliest completion time is elected as the leader node, which is used to communicate with the second storage node and forward the information sent by the second storage node.
步骤606,第二存储节点向领导节点发送目标文件的哈希值。Step 606, the second storage node sends the hash value of the target file to the leader node.
第二存储节点计算得到需要存储的目标文件的哈希值,向领导节点发送该目标文件片段的哈希值。The second storage node calculates the hash value of the target file to be stored, and sends the hash value of the target file fragment to the leader node.
步骤607,领导节点向区块链平台中的其它区块链节点发送目标文件的哈希值。Step 607, the leader node sends the hash value of the target file to other blockchain nodes in the blockchain platform.
领导节点接收到目标文件的哈希值后,向其它(n-1)个区块链节点发送目标文件的哈希值。After the leader node receives the hash value of the target file, it sends the hash value of the target file to other (n-1) blockchain nodes.
步骤608,领导节点和其它区块链节点分别检测目标文件的哈希值是否存在于区块链平台中,得到节点核验结果。Step 608, the leader node and other blockchain nodes respectively detect whether the hash value of the target file exists in the blockchain platform, and obtain node verification results.
领导节点和其它区块链节点分别检测目标文件的哈希值是否存在总账本中,得到节点核验结果。若领导节点或其它区块链节点确定总账本中不包含目标文件片段的哈希值,则节点核验结果为通过。目标文件片段的哈希值不存在于总账本上,说明分布式文件存储系统上任一存储节点均没有存储目标文件片段,从而确定目标文件是第二存储节点原创的,而不是剽窃的内容。The leader node and other blockchain nodes respectively detect whether the hash value of the target file exists in the general ledger, and obtain the node verification results. If the leader node or other blockchain nodes determine that the general ledger does not contain the hash value of the target file fragment, the node verification result is passed. The hash value of the target file fragment does not exist on the general ledger, indicating that any storage node on the distributed file storage system does not store the target file fragment, so it is determined that the target file is the original content of the second storage node, not plagiarized content.
区块链平台的总账本中记录了存储到分布式文件存储系统中的文件的哈希值,领导节点和其它区块链节点通过查询自身的总账本中是否存在目标文件的哈希值判断是否有其它存储节点将目标文件存储到分布式文件存储系统中,从而判断目标文件的原创性。The general ledger of the blockchain platform records the hash value of the file stored in the distributed file storage system. The leader node and other blockchain nodes judge whether there is a hash value of the target file in their own general ledger. There are other storage nodes to store the target file in the distributed file storage system, so as to judge the originality of the target file.
步骤609,领导节点确定节点核验结果中包含(n/2+1)个节点核验结果为通过时,则确定核验结果为通过,向第二存储节点发送用于表示通过的核验结果。Step 609 , when the leader node determines that the verification results of the nodes include (n/2+1) nodes whose verification results are passed, then determine that the verification results are passed, and send the verification result to the second storage node to indicate the passed.
领导节点统计领导节点和其它区块链节点的节点核验结果,若确定节点核验结果中包含(n/2+1)个节点核验结果为通过,则确定核验结果为通过,向第二存储节点发送用于表示通过的核验结果;若确定节点核验结果中不包含 (n/2+1)个节点核验结果为通过,则确定核验结果为不通过,向第二存储节点发送用于表示不通过的核验结果,该不通过的核验结果用于禁止第二存储节点在分布式文件存储系统中存储目标文件片段。The leader node counts the node verification results of the leader node and other blockchain nodes. If it is determined that (n/2+1) node verification results are passed in the node verification result, then the verification result is determined to be passed and sent to the second storage node. It is used to indicate the verification result of passing; if it is determined that the node verification result does not contain (n/2+1) node verification results are passed, then it is determined that the verification result is not passed, and the second storage node is sent to the second storage node. A verification result, where the failed verification result is used to prohibit the second storage node from storing the target file segment in the distributed file storage system.
步骤610,第二存储节点根据通过的核验结果在分布式文件存储系统存储目标文件片段。Step 610, the second storage node stores the target file segment in the distributed file storage system according to the passed verification result.
第二存储节点根据用于表示通过的核验结果,在分布式文件存储系统存储目标文件片段。The second storage node stores the target file segment in the distributed file storage system according to the verification result indicating passing.
图9是本申请一个示例性实施例提供的文件存储方法的一个具体实施例的架构图。如图所示,在步骤1中,用户A生产内容并计算内容的哈希值;在步骤2中,用户A向区块链平台广播存放请求,至少一个区块链节点组成的验证组响应其广播;在步骤3中,验证组选举产生领导节点;在步骤4中,领导节点回复用户A的存放请求;在步骤5中,用户A向领导节点发送核验请求,该请求携带有需要存放的内容的哈希值;在步骤7和步骤8中,验证组中的各个区块链节点核验区块链总账本中是否保存有需要存放的内容的哈希值;在步骤8 中,验证组两两之间发送各自的验证结果,开始形成共识;在步骤9中,领导节点统计核验结果;在步骤10中,领导节点向用户A发送核验结果。Fig. 9 is a structural diagram of a specific embodiment of a file storage method provided by an exemplary embodiment of the present application. As shown in the figure, in step 1, user A produces content and calculates the hash value of the content; in step 2, user A broadcasts a storage request to the blockchain platform, and a verification group composed of at least one blockchain node responds to its Broadcast; in step 3, the verification group elects a leader node; in step 4, the leader node replies to user A’s storage request; in step 5, user A sends a verification request to the leader node, which carries the content to be stored hash value; in steps 7 and 8, each blockchain node in the verification group checks whether the hash value of the content to be stored is saved in the blockchain general ledger; in step 8, the verification group Send their verification results to each other to start to form a consensus; in step 9, the leader node counts the verification results; in step 10, the leader node sends the verification result to user A.
图10是本申请一个示例性实施例提供的文件存储和获取方法的一个具体实施例的架构图。如图所示,该架构分为两部分,一个部分是用户A将产生的内容存储到IPFS系统中,另一个部分是用户B从IPFS系统中获取用户A存储的内容,具体实现方式可参考图3、图6以及图9中的实施方式,在此不做赘述。Fig. 10 is an architecture diagram of a specific embodiment of a file storage and retrieval method provided by an exemplary embodiment of the present application. As shown in the figure, the architecture is divided into two parts. One part is that user A stores the generated content in the IPFS system, and the other part is that user B obtains the content stored by user A from the IPFS system. The specific implementation method can refer to the figure 3. The implementation manners in FIG. 6 and FIG. 9 will not be repeated here.
综上所述,本申请实施例中,通过第二存储节点向领导节点发送目标文件的哈希值,领导节点和其它区块链节点检测目标文件的哈希值是否存在于区块链平台上得到核验结果,若目标文件的哈希值不存在于区块链平台上,则说明目标文件是第二存储节点原创的而不是剽窃,进而允许第二存储节点在分布式文件存储系统上存储目标文件,降低了分布式文件存储系统上存储的文件的侵权风险。To sum up, in the embodiment of this application, the second storage node sends the hash value of the target file to the leader node, and the leader node and other blockchain nodes detect whether the hash value of the target file exists on the blockchain platform Get the verification result, if the hash value of the target file does not exist on the blockchain platform, it means that the target file is original and not plagiarized by the second storage node, and then allows the second storage node to store the target file on the distributed file storage system files, reducing the risk of infringement of files stored on the distributed file storage system.
请参考图11,其示出了本申请一个示例性的实施例提供的文件获取装置的结构框图,如图所示,该装置可应用于如图1所示的实施环境中的存储节点的一个第一存储节点中,该装置包括发送模块810、接收模块820以及处理模块 830:Please refer to FIG. 11 , which shows a structural block diagram of a file acquisition device provided by an exemplary embodiment of the present application. As shown in the figure, the device can be applied to one of the storage nodes in the implementation environment shown in FIG. 1 In the first storage node, the device includes a sending module 810, a receiving module 820, and a processing module 830:
发送模块810,用于执行实现上述图2、图3、图5或图7实施例中的步骤 201、步骤203、步骤301、步骤303、步骤404、步骤501、步骤504、步骤507、步骤512、步骤513等发送步骤,以及其它隐含的发送步骤。The sending module 810 is configured to implement step 201, step 203, step 301, step 303, step 404, step 501, step 504, step 507, and step 512 in the above-mentioned embodiment of FIG. 2, FIG. 3, FIG. 5 or FIG. , step 513 and other sending steps, and other implicit sending steps.
接收模块820,用于执行实现上述图2、图3、图5或图7实施例中的步骤 202、步骤204、步骤302、步骤401、步骤503、步骤506、步骤508,以及其它隐含的接收步骤。The receiving module 820 is configured to implement step 202, step 204, step 302, step 401, step 503, step 506, step 508, and other implicit Receive steps.
处理模块830,用于执行实现上述图5或图7实施例中的步骤402、步骤403、步骤509、步骤510、步骤511,以及其它隐含的处理步骤。The processing module 830 is configured to implement step 402, step 403, step 509, step 510, step 511, and other implicit processing steps in the above embodiment in FIG. 5 or FIG. 7 .
请参考图12,其示出了本申请一个示例性的实施例提供的文件获取装置的结构框图,如图所示,该装置可应用于如图1所示的实施环境中的存储节点的一个第二存储节点中,该装置包括发送模块910、接收模块920以及处理模块 930:Please refer to FIG. 12 , which shows a structural block diagram of a file acquisition device provided by an exemplary embodiment of the present application. As shown in the figure, the device can be applied to one of the storage nodes in the implementation environment shown in FIG. 1 In the second storage node, the device includes a sending module 910, a receiving module 920, and a processing module 930:
发送模块910,用于执行实现上述图7实施例中的步骤506、步骤508、步骤515等发送步骤,以及其它隐含的发送步骤。The sending module 910 is configured to implement sending steps such as step 506, step 508, and step 515 in the above-mentioned embodiment in FIG. 7, and other implicit sending steps.
接收模块920,用于执行实现上述图7实施例中的步骤504、步骤507、步骤513,以及其它隐含的接收步骤。The receiving module 920 is configured to implement step 504, step 507, step 513, and other implicit receiving steps in the above embodiment in FIG. 7 .
处理模块930,用于执行实现上述图7实施例中的步骤505,以及其它隐含的处理步骤。The processing module 930 is configured to implement step 505 in the above embodiment of FIG. 7 and other implicit processing steps.
请参见图13,其示出了本申请一个示例性的实施例提供的电子设备的结构框图。该设备包括:处理器1010、存储器1020以及通信接口1030。Please refer to FIG. 13 , which shows a structural block diagram of an electronic device provided by an exemplary embodiment of the present application. The device includes: a processor 1010 , a memory 1020 and a communication interface 1030 .
处理器1010可以是中央处理器(英文:central processing unit,CPU),网络处理器(英文:network processor,NP)或者CPU和NP的组合。处理器1010 还可以进一步包括硬件芯片。上述硬件芯片可以是专用集成电路(英文: application-specific integratedcircuit,ASIC),可编程逻辑器件(英文: programmable logic device,PLD)或其组合。上述PLD可以是复杂可编程逻辑器件(英文:complex programmable logic device,CPLD),现场可编程逻辑门阵列(英文:field-programmable gate array,FPGA),通用阵列逻辑(英文:generic array logic,GAL)或其任意组合。The processor 1010 may be a central processing unit (English: central processing unit, CPU), a network processor (English: network processor, NP) or a combination of CPU and NP. The processor 1010 may further include a hardware chip. The aforementioned hardware chip may be an application-specific integrated circuit (English: application-specific integrated circuit, ASIC), a programmable logic device (English: programmable logic device, PLD) or a combination thereof. The above-mentioned PLD may be a complex programmable logic device (English: complex programmable logic device, CPLD), field-programmable logic gate array (English: field-programmable gate array, FPGA), general array logic (English: generic array logic, GAL) or any combination thereof.
存储器1020通过总线或其它方式与处理器1010相连,存储器1020中存储有至少一条指令、至少一段程序、代码集或指令集,上述至少一条指令、至少一段程序、代码集或指令集由处理器1010加载并执行以实现上述实施例中的文件获取方法。存储器1020可以为易失性存储器(英文:volatile memory),非易失性存储器(英文:non-volatile memory)或者它们的组合。易失性存储器可以为随机存取存储器(英文:random-access memory,RAM),例如静态随机存取存储器(英文:static random access memory,SRAM),动态随机存取存储器(英文:dynamic random access memory,DRAM)。非易失性存储器可以为只读存储器(英文:read only memory image,ROM),例如可编程只读存储器(英文: programmable read onlymemory,PROM),可擦除可编程只读存储器(英文: erasable programmable read onlymemory,EPROM),电可擦除可编程只读存储器 (英文:electrically erasableprogrammable read-only memory,EEPROM)。非易失性存储器也可以为快闪存储器(英文:flash memory),磁存储器,例如磁带 (英文:magnetic tape),软盘(英文:floppy disk),硬盘。非易失性存储器也可以为光盘。The memory 1020 is connected to the processor 1010 through a bus or other means, at least one instruction, at least one section of program, code set or instruction set is stored in the memory 1020, and the above-mentioned at least one instruction, at least one section of program, code set or instruction set is controlled by the processor 1010 Load and execute to realize the file acquisition method in the above embodiment. The memory 1020 may be a volatile memory (English: volatile memory), a non-volatile memory (English: non-volatile memory) or a combination thereof. The volatile memory can be random access memory (English: random-access memory, RAM), such as static random access memory (English: static random access memory, SRAM), dynamic random access memory (English: dynamic random access memory) , DRAM). The non-volatile memory can be read-only memory (English: read only memory image, ROM), such as programmable read-only memory (English: programmable read only memory, PROM), erasable programmable read-only memory (English: erasable programmable read only memory, EPROM), electrically erasable programmable read-only memory (English: electrically erasable programmable read-only memory, EEPROM). The non-volatile memory may also be a flash memory (English: flash memory), a magnetic memory, such as a magnetic tape (English: magnetic tape), a floppy disk (English: floppy disk), and a hard disk. The non-volatile memory can also be an optical disk.
通信接口1030通过总线或其它方式与存储器1020和处理器1010相连,电子设备可通过通信接口1030向其它存储节点或区块链节点发送信息,或,通过通信接口1030接收其它存储节点或区块链节点发送的信息。The communication interface 1030 is connected to the memory 1020 and the processor 1010 through a bus or other means, and the electronic device can send information to other storage nodes or blockchain nodes through the communication interface 1030, or receive information from other storage nodes or blockchain nodes through the communication interface 1030. The information sent by the node.
本申请还提供一种计算机可读存储介质,所述存储介质中存储有至少一条指令、至少一段程序、代码集或指令集,所述至少一条指令、所述至少一段程序、所述代码集或指令集由所述处理器加载并执行以实现上述方法实施例提供的文件获取方法。The present application also provides a computer-readable storage medium, wherein at least one instruction, at least one program, code set or instruction set is stored in the storage medium, and the at least one instruction, the at least one program, the code set or The instruction set is loaded and executed by the processor to implement the file acquisition method provided by the above method embodiment.
本申请还提供了一种包含指令的计算机程序产品,当其在计算机上运行时,使得计算机执行上述各方面所述的文件获取方法。The present application also provides a computer program product containing instructions, which, when run on a computer, causes the computer to execute the file acquisition method described in the above aspects.
请参见图14,其示出了本申请一个示例性的实施例提供的电子设备的结构框图。该设备包括:处理器1110、存储器1120以及通信接口1130。Please refer to FIG. 14 , which shows a structural block diagram of an electronic device provided by an exemplary embodiment of the present application. The device includes: a processor 1110 , a memory 1120 and a communication interface 1130 .
处理器1110可以是中央处理器(英文:central processing unit,CPU),网络处理器(英文:network processor,NP)或者CPU和NP的组合。处理器1110 还可以进一步包括硬件芯片。上述硬件芯片可以是专用集成电路(英文: application-specific integratedcircuit,ASIC),可编程逻辑器件(英文: programmable logic device,PLD)或其组合。上述PLD可以是复杂可编程逻辑器件(英文:complex programmable logic device,CPLD),现场可编程逻辑门阵列(英文:field-programmable gate array,FPGA),通用阵列逻辑(英文:generic array logic,GAL)或其任意组合。The processor 1110 may be a central processing unit (English: central processing unit, CPU), a network processor (English: network processor, NP) or a combination of CPU and NP. The processor 1110 may further include a hardware chip. The aforementioned hardware chip may be an application-specific integrated circuit (English: application-specific integrated circuit, ASIC), a programmable logic device (English: programmable logic device, PLD) or a combination thereof. The above-mentioned PLD may be a complex programmable logic device (English: complex programmable logic device, CPLD), field-programmable logic gate array (English: field-programmable gate array, FPGA), general array logic (English: generic array logic, GAL) or any combination thereof.
存储器1120通过总线或其它方式与处理器1110相连,存储器1120中存储有至少一条指令、至少一段程序、代码集或指令集,上述至少一条指令、至少一段程序、代码集或指令集由处理器1110加载并执行以实现上述实施例中的文件存储方法。存储器1120可以为易失性存储器(英文:volatile memory),非易失性存储器(英文:non-volatile memory)或者它们的组合。易失性存储器可以为随机存取存储器(英文:random-access memory,RAM),例如静态随机存取存储器(英文:static random access memory,SRAM),动态随机存取存储器(英文:dynamic random access memory,DRAM)。非易失性存储器可以为只读存储器(英文:read only memory image,ROM),例如可编程只读存储器(英文: programmable read onlymemory,PROM),可擦除可编程只读存储器(英文: erasable programmable read onlymemory,EPROM),电可擦除可编程只读存储器 (英文:electrically erasableprogrammable read-only memory,EEPROM)。非易失性存储器也可以为快闪存储器(英文:flash memory),磁存储器,例如磁带 (英文:magnetic tape),软盘(英文:floppy disk),硬盘。非易失性存储器也可以为光盘。The memory 1120 is connected to the processor 1110 through a bus or in other ways, at least one instruction, at least one section of program, code set or instruction set is stored in the memory 1120, and the above-mentioned at least one instruction, at least one section of program, code set or instruction set is controlled by the processor 1110 Load and execute to implement the file storage method in the above embodiment. The memory 1120 may be a volatile memory (English: volatile memory), a non-volatile memory (English: non-volatile memory) or a combination thereof. The volatile memory can be random access memory (English: random-access memory, RAM), such as static random access memory (English: static random access memory, SRAM), dynamic random access memory (English: dynamic random access memory) , DRAM). The non-volatile memory can be read-only memory (English: read only memory image, ROM), such as programmable read-only memory (English: programmable read only memory, PROM), erasable programmable read-only memory (English: erasable programmable read only memory, EPROM), electrically erasable programmable read-only memory (English: electrically erasable programmable read-only memory, EEPROM). The non-volatile memory may also be a flash memory (English: flash memory), a magnetic memory, such as a magnetic tape (English: magnetic tape), a floppy disk (English: floppy disk), and a hard disk. The non-volatile memory can also be an optical disk.
通信接口1130通过总线或其它方式与存储器1120和处理器1110相连,电子设备可通过通信接口1130向其它存储节点或区块链节点发送信息,或,通过通信接口1130接收其它存储节点或区块链节点发送的信息。The communication interface 1130 is connected to the memory 1120 and the processor 1110 through a bus or other means, and the electronic device can send information to other storage nodes or blockchain nodes through the communication interface 1130, or receive information from other storage nodes or blockchain nodes through the communication interface 1130. The information sent by the node.
本申请还提供一种计算机可读存储介质,所述存储介质中存储有至少一条指令、至少一段程序、代码集或指令集,所述至少一条指令、所述至少一段程序、所述代码集或指令集由所述处理器加载并执行以实现上述方法实施例提供的文件存储方法。The present application also provides a computer-readable storage medium, wherein at least one instruction, at least one program, code set or instruction set is stored in the storage medium, and the at least one instruction, the at least one program, the code set or The instruction set is loaded and executed by the processor to implement the file storage method provided by the above method embodiments.
本申请还提供了一种包含指令的计算机程序产品,当其在计算机上运行时,使得计算机执行上述各方面所述的文件存储方法。The present application also provides a computer program product containing instructions, which, when run on a computer, causes the computer to execute the file storage method described in the above aspects.
应当理解的是,在本文中提及的“多个”是指两个或两个以上。“和/或”,描述关联对象的关联关系,表示可以存在三种关系,例如,A和/或B,可以表示:单独存在A,同时存在A和B,单独存在B这三种情况。字符“/”一般表示前后关联对象是一种“或”的关系。It should be understood that the "plurality" mentioned herein refers to two or more than two. "And/or" describes the association relationship of associated objects, indicating that there may be three types of relationships, for example, A and/or B may indicate: A exists alone, A and B exist simultaneously, and B exists independently. The character "/" generally indicates that the contextual objects are an "or" relationship.
上述本申请实施例序号仅仅为了描述,不代表实施例的优劣。The serial numbers of the above embodiments of the present application are for description only, and do not represent the advantages and disadvantages of the embodiments.
本领域普通技术人员可以理解实现上述实施例的全部或部分步骤可以通过硬件来完成,也可以通过程序来指令相关的硬件完成,所述的程序可以存储于一种计算机可读存储介质中,上述提到的存储介质可以是只读存储器,磁盘或光盘等。Those of ordinary skill in the art can understand that all or part of the steps for implementing the above embodiments can be completed by hardware, and can also be completed by instructing related hardware through a program. The program can be stored in a computer-readable storage medium. The above-mentioned The storage medium mentioned may be a read-only memory, a magnetic disk or an optical disk, and the like.
以上所述仅为本申请的较佳实施例,并不用以限制本申请,凡在本申请的精神和原则之内,所作的任何修改、等同替换、改进等,均应包括在本申请的保护范围之内。The above descriptions are only preferred embodiments of the application, and are not intended to limit the application. Any modifications, equivalent replacements, improvements, etc. made within the spirit and principles of the application shall be included in the protection of the application. within range.
Claims (21)
Priority Applications (2)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202010047750.XA CN111291000B (en) | 2018-05-18 | 2018-05-18 | Blockchain-based file acquisition methods, equipment and storage media |
CN201810482561.8A CN108710681B (en) | 2018-05-18 | 2018-05-18 | File acquisition method, device, device and storage medium |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201810482561.8A CN108710681B (en) | 2018-05-18 | 2018-05-18 | File acquisition method, device, device and storage medium |
Related Child Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202010047750.XA Division CN111291000B (en) | 2018-05-18 | 2018-05-18 | Blockchain-based file acquisition methods, equipment and storage media |
Publications (2)
Publication Number | Publication Date |
---|---|
CN108710681A true CN108710681A (en) | 2018-10-26 |
CN108710681B CN108710681B (en) | 2022-02-22 |
Family
ID=63869123
Family Applications (2)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202010047750.XA Active CN111291000B (en) | 2018-05-18 | 2018-05-18 | Blockchain-based file acquisition methods, equipment and storage media |
CN201810482561.8A Active CN108710681B (en) | 2018-05-18 | 2018-05-18 | File acquisition method, device, device and storage medium |
Family Applications Before (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202010047750.XA Active CN111291000B (en) | 2018-05-18 | 2018-05-18 | Blockchain-based file acquisition methods, equipment and storage media |
Country Status (1)
Country | Link |
---|---|
CN (2) | CN111291000B (en) |
Cited By (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN109831527A (en) * | 2019-03-13 | 2019-05-31 | 试金石信用服务有限公司 | Document handling method, user terminal, server and readable storage medium storing program for executing |
CN111563083A (en) * | 2020-04-30 | 2020-08-21 | 中国银行股份有限公司 | Report data query method, device and system |
CN111767427A (en) * | 2019-04-02 | 2020-10-13 | 浙江宇视科技有限公司 | Video information storage method and data storage domain |
CN112069165A (en) * | 2019-06-11 | 2020-12-11 | 国际商业机器公司 | Document editing and coordination |
CN112100171A (en) * | 2020-08-12 | 2020-12-18 | 北京大学 | Method and device for establishing content index for random consensus diagram book |
Families Citing this family (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN112054990B (en) * | 2020-07-21 | 2022-09-16 | 杜晓楠 | Method for preventing Hash flood attack in blockchain system, computer readable medium and blockchain system |
CN112311798A (en) * | 2020-11-02 | 2021-02-02 | 大连理工大学 | Data block exchange method based on peer-to-peer hypermedia distribution protocol |
CN112749144B (en) * | 2021-01-15 | 2023-06-30 | 云南云电同方科技有限公司 | System and method for storing persistent file based on blockchain |
EP4191976A1 (en) * | 2021-12-06 | 2023-06-07 | Wyplay | Methods and devices for content distribution |
Citations (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN102752326A (en) * | 2011-04-19 | 2012-10-24 | 腾讯科技(深圳)有限公司 | Method, client, server and system for processing data in file downloading |
US8990248B1 (en) * | 2006-12-13 | 2015-03-24 | Cisco Technology, Inc. | Peer-to-peer network image distribution hierarchy |
CN104731516A (en) * | 2013-12-18 | 2015-06-24 | 腾讯科技(深圳)有限公司 | Method and device for accessing files and distributed storage system |
CN105068757A (en) * | 2015-07-23 | 2015-11-18 | 浙江大学 | File semantics and system real-time state based redundant data deduplication method |
CN106911751A (en) * | 2015-12-23 | 2017-06-30 | 北京奇虎科技有限公司 | File acquisition method, device and system |
CN107172090A (en) * | 2017-07-03 | 2017-09-15 | 郑州云海信息技术有限公司 | The acquisition methods and acquisition device of a kind of file |
Family Cites Families (12)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN101599994B (en) * | 2009-06-01 | 2012-07-18 | 中兴通讯股份有限公司 | Distributed file system (DFS), access node (AN) and method of transmitting file data among nodes |
US9881176B2 (en) * | 2015-06-02 | 2018-01-30 | ALTR Solutions, Inc. | Fragmenting data for the purposes of persistent storage across multiple immutable data structures |
US10491378B2 (en) * | 2016-11-16 | 2019-11-26 | StreamSpace, LLC | Decentralized nodal network for providing security of files in distributed filesystems |
CN106815530B (en) * | 2016-12-26 | 2020-04-24 | 北京爱接力科技发展有限公司 | Data storage method, data verification method and device |
CN107147704B (en) * | 2017-04-21 | 2019-12-13 | 杭州趣链科技有限公司 | block chain-oriented universal service middleware system |
CN107171829B (en) * | 2017-04-24 | 2019-12-24 | 杭州趣链科技有限公司 | Dynamic node management method realized based on BFT consensus algorithm |
CN107273410B (en) * | 2017-05-03 | 2020-07-07 | 上海点融信息科技有限责任公司 | Block chain based distributed storage |
CN107239940A (en) * | 2017-05-11 | 2017-10-10 | 北京博晨技术有限公司 | Network trading method and device based on block catenary system |
CN107147735B (en) * | 2017-05-12 | 2020-08-11 | 北京博晨技术有限公司 | Distributed account book system based on hierarchical structure |
CN107819891B (en) * | 2017-10-16 | 2020-01-24 | 平安科技(深圳)有限公司 | Data processing method, data processing device, computer equipment and storage medium |
CN107944868A (en) * | 2017-12-07 | 2018-04-20 | 杭州趣链科技有限公司 | A kind of electronics deposit system and management method based on block chain intelligence contract |
CN107819789A (en) * | 2017-12-07 | 2018-03-20 | 北京泛融科技有限公司 | A kind of content anti-hijack system and method based on block chain |
-
2018
- 2018-05-18 CN CN202010047750.XA patent/CN111291000B/en active Active
- 2018-05-18 CN CN201810482561.8A patent/CN108710681B/en active Active
Patent Citations (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US8990248B1 (en) * | 2006-12-13 | 2015-03-24 | Cisco Technology, Inc. | Peer-to-peer network image distribution hierarchy |
CN102752326A (en) * | 2011-04-19 | 2012-10-24 | 腾讯科技(深圳)有限公司 | Method, client, server and system for processing data in file downloading |
CN104731516A (en) * | 2013-12-18 | 2015-06-24 | 腾讯科技(深圳)有限公司 | Method and device for accessing files and distributed storage system |
CN105068757A (en) * | 2015-07-23 | 2015-11-18 | 浙江大学 | File semantics and system real-time state based redundant data deduplication method |
CN106911751A (en) * | 2015-12-23 | 2017-06-30 | 北京奇虎科技有限公司 | File acquisition method, device and system |
CN107172090A (en) * | 2017-07-03 | 2017-09-15 | 郑州云海信息技术有限公司 | The acquisition methods and acquisition device of a kind of file |
Cited By (8)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN109831527A (en) * | 2019-03-13 | 2019-05-31 | 试金石信用服务有限公司 | Document handling method, user terminal, server and readable storage medium storing program for executing |
CN109831527B (en) * | 2019-03-13 | 2021-12-28 | 试金石信用服务有限公司 | File processing method, user side, server and readable storage medium |
CN111767427A (en) * | 2019-04-02 | 2020-10-13 | 浙江宇视科技有限公司 | Video information storage method and data storage domain |
CN111767427B (en) * | 2019-04-02 | 2024-04-05 | 浙江宇视科技有限公司 | Video information storage method and data storage domain |
CN112069165A (en) * | 2019-06-11 | 2020-12-11 | 国际商业机器公司 | Document editing and coordination |
US12248590B2 (en) | 2019-06-11 | 2025-03-11 | International Business Machines Corporation | Document redaction and reconciliation |
CN111563083A (en) * | 2020-04-30 | 2020-08-21 | 中国银行股份有限公司 | Report data query method, device and system |
CN112100171A (en) * | 2020-08-12 | 2020-12-18 | 北京大学 | Method and device for establishing content index for random consensus diagram book |
Also Published As
Publication number | Publication date |
---|---|
CN111291000B (en) | 2023-11-03 |
CN111291000A (en) | 2020-06-16 |
CN108710681B (en) | 2022-02-22 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN111291000B (en) | Blockchain-based file acquisition methods, equipment and storage media | |
CN110263035B (en) | Block chain-based data storage and query method and device and electronic equipment | |
CN109522330B (en) | Cloud platform data processing method, device, equipment and medium based on block chain | |
CN109656873B (en) | Block chain-based data archiving method and device and terminal equipment | |
WO2020063763A1 (en) | Data storage method, apparatus and system, and server, control node and medium | |
CN111200657B (en) | Method for managing resource state information and resource downloading system | |
CN108683668B (en) | Resource checking method, device, storage medium and equipment in content distribution network | |
US20170134495A1 (en) | Method and apparatus for sharing collaboratively edited document | |
US20200153889A1 (en) | Method for uploading and downloading file, and server for executing the same | |
US20210158353A1 (en) | Methods, systems, apparatuses, and devices for processing request in consortium blockchain | |
CN111506589B (en) | Block chain data service system, access method and storage medium based on alliance chain | |
WO2022134797A1 (en) | Data fragmentation storage method and apparatus, a computer device, and a storage medium | |
US8086629B2 (en) | Content delivery apparatus, content delivery method, and content delivery program | |
CN112513830A (en) | Back-source method and related device in content distribution network | |
CN104636437A (en) | Event notification method and device and monitor processing method | |
CN110311855B (en) | User message processing method and device, electronic equipment and storage medium | |
WO2022057525A1 (en) | Method and device for data retrieval, electronic device, and storage medium | |
US20190372825A1 (en) | Communication apparatus, communication method, and recording medium | |
CN110807203B (en) | Data processing method, service operation center platform, system and storage medium | |
CN114936254A (en) | Food safety big data sharing management method and system under cloud chain fusion mechanism | |
US8655835B2 (en) | Information generating device where information is distributed among node devices, information generating method where information is distributed among node devices, and computer readable recording medium for generating information which is distributed among node devices | |
US20090083379A1 (en) | Enabling connections for use with a network | |
WO2023160040A1 (en) | Data processing method and apparatus based on blockchain, and device and readable storage medium | |
CN117376364A (en) | Data processing method and related equipment | |
JP5110306B2 (en) | COMMUNICATION LIMIT SYSTEM, COMMUNICATION LIMIT DEVICE, COMMUNICATION LIMIT METHOD, AND COMMUNICATION LIMIT PROGRAM |
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 | ||
GR01 | Patent grant | ||
GR01 | Patent grant |