WO2020143317A1 - 分片文件验证方法及终端设备 - Google Patents

分片文件验证方法及终端设备 Download PDF

Info

Publication number
WO2020143317A1
WO2020143317A1 PCT/CN2019/118145 CN2019118145W WO2020143317A1 WO 2020143317 A1 WO2020143317 A1 WO 2020143317A1 CN 2019118145 W CN2019118145 W CN 2019118145W WO 2020143317 A1 WO2020143317 A1 WO 2020143317A1
Authority
WO
WIPO (PCT)
Prior art keywords
data
file
target
fragment
fragmented
Prior art date
Application number
PCT/CN2019/118145
Other languages
English (en)
French (fr)
Inventor
雷琼
Original Assignee
平安科技(深圳)有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 平安科技(深圳)有限公司 filed Critical 平安科技(深圳)有限公司
Publication of WO2020143317A1 publication Critical patent/WO2020143317A1/zh

Links

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L65/00Network arrangements, protocols or services for supporting real-time applications in data packet communication
    • H04L65/40Support for services or applications

Definitions

  • the present application belongs to the field of computer application technology, and particularly relates to a method for verifying a fragmented file, a terminal device, and a computer non-volatile readable storage medium.
  • the traditional network storage system uses a centralized storage server to store all data.
  • the storage server becomes the bottleneck of system performance, and is also the focus of reliability and security. It cannot meet the needs of large-scale storage applications.
  • the scalable network structure of the distributed network storage system uses multiple storage servers to share the storage load and the location server to locate the storage information. It not only improves the reliability, availability, and access efficiency of the system, but is also easy to expand. .
  • the embodiments of the present application provide a fragmented file verification method, terminal device, and computer non-volatile readable storage medium to solve the problem that the storage nodes in the distributed network in the prior art cannot guarantee the cloud server nodes.
  • a first aspect of an embodiment of the present application provides a method for verifying fragmented files, including:
  • the verification data is generated according to the target file location in the challenge code and a preset data generation algorithm
  • Target data Generate target data according to the target fragment summary and the data generation algorithm, compare the verification data with the target data, and if the target data is consistent with the verification data, determine that the fragment file is correct .
  • a second aspect of an embodiment of the present application provides a terminal device, including a memory, a processor, and computer-readable instructions stored in the memory and executable on the processor, and the processor executes the computer
  • the method of the first aspect described above can be realized when the instructions are readable.
  • a third aspect of the embodiments of the present application provides a terminal device, including various units for implementing the method of the first aspect described above.
  • a fourth aspect of the embodiments of the present application provides a computer nonvolatile readable storage medium.
  • the computer storage medium stores computer readable instructions.
  • the computer readable instructions include program instructions. When the processor executes, the processor is caused to execute the method of the first aspect.
  • the challenge verification code is generated by slicing the digest of the slicing file to perform shard verification, thereby reducing the data processing and transmission volume, and improving the efficiency of data possession verification.
  • FIG. 1 is a flowchart of a method for verifying a fragmented file provided in Embodiment 1 of the present application;
  • FIG. 2 is a flowchart of a method for verifying a fragmented file provided in Embodiment 2 of the present application;
  • FIG. 3 is a schematic diagram of a terminal device provided in Embodiment 3 of this application.
  • FIG. 4 is a schematic diagram of a terminal device provided in Embodiment 4 of the present application.
  • FIG. 1 is a flowchart of a method for verifying a fragmented file according to Embodiment 1 of the present application.
  • the execution subject of the slice file verification method is a terminal.
  • Terminals include but are not limited to mobile terminals such as smart phones, tablet computers, and wearable devices, and may also be desktop computers.
  • the method for verifying a fragmented file as shown in the figure may include the following steps:
  • S101 Select data of a preset data amount at at least two target file locations in a slice file to be verified as a target slice summary.
  • Fragmentation divides a complete piece of data into different parts according to certain conditions. Different servers store the divided content. Each content is called a slice. For the outside world, obviously do not want to know where the data came from and how many pieces were divided, because for the application, what you need to see is a complete piece of data, and you don’t want your business logic to be mixed with it. Taking this data is not a business-related issue. Therefore, while sharding, the data is physically stored and processed separately, which is still a complete logically.
  • a complete source file may be composed of multiple sharded data after being processed by sharding, and the sharded data is stored in different storage nodes to reduce the load of the source storage node.
  • the storage node may delete or modify the local sharded data because it wants to improve storage efficiency, resulting in data errors and unable to process data normally. In this case, we perform Spot check to verify whether the fragmented data in the storage node is correct.
  • a complete source file can be divided into multiple shard files, and each shard file is stored in a different storage node.
  • Perform data verification by determining a shard file in a storage node.
  • the determination method may be that, according to the file identification of each fragment file, random extraction is performed to determine the fragment file to be verified.
  • the shard file with the longest time from the last verification time to the current time is selected as the shard file to be verified.
  • a shard file multiple shard digests may be stored, and at least two shard digests are randomly selected as target shard digests.
  • each piece of data in the sharded file has its file position in the file.
  • the target file location can be selected in real time for the segment file, and the target segment summary can be extracted in real time.
  • You can also extract a preset number of file locations and their corresponding fragment summaries, and store the summary information to randomly select a preset number of target file locations from the pre-stored summary information when data verification is required later And the corresponding target segment summary.
  • each shard data takes an average of 16M of data as a shard file.
  • Each location takes 2 bytes of data as a fragment digest, and stores the 20 addresses and its fragment digest.
  • S102 Randomly combine all the target file locations to obtain a challenge code in the form of a string, and send the challenge code to a storage node that stores the fragmented file.
  • a challenge code is generated according to the target file location combination, and the challenge code is sent to the storage node that stores the fragment node to send the verification challenge to the storage node through the challenge code.
  • the challenge code when generating the challenge code, you can randomly combine all the target file locations and add the algorithm name for the combined data to obtain a string. Use this string as the challenge code to The challenge code is sent to the storage node for data completion detection.
  • This way of randomly selecting the target file location to generate the challenge code and verifying the fragmented data stored by the storage node can avoid the large amount of data calculation during traditional data verification and the large amount of data storage of the summary data obtained, and The problem of slow transmission speed during transmission can improve the speed and accuracy of sharded data verification in this way, without affecting the normal operation of the storage node.
  • S103 Receive verification data sent by the storage node; the verification data is generated according to the target file location in the challenge code and a preset data generation algorithm.
  • the storage node After receiving the challenge code, the storage node can parse through the preset challenge code format to obtain the target file location in the challenge code, and read the corresponding target fragment summary locally through the target file location, and according to the analysis
  • the algorithm in the challenge code is processed by the corresponding algorithm on the parsed target fragment digest to generate verification data.
  • the target file location k3, k6, k7, k8, k20, together with the challenge code generated by the combined character algorithm name "SHA-1" to the storage node.
  • the storage node receives the challenge code
  • the first 15 bytes in the challenge code are the target file location, and the latter byte is the corresponding algorithm name.
  • the 15 bytes include 5 target file locations, and then use these 5 target file locations to read the summary data corresponding to each file location from the local, and calculate all the summary data through the algorithm corresponding to the algorithm name in the challenge code to obtain verify the data.
  • the verification data is sent to the data owner's terminal to trigger the data owner's terminal to perform verification based on the verification data, and a conclusion is obtained whether the fragmented data stored by the storage node is correct.
  • S104 Generate target data according to the target fragment summary and the data generation algorithm, compare the verification data with the target data, and if the target data is consistent with the verification data, determine the fragment The file is correct.
  • the data owner’s terminal generates target data according to the target shard summary and data generation algorithm.
  • the target data is generated in the same way as the storage node generates verification data.
  • the target shard data is first combined, and then combined.
  • the data generates target data according to the data generation algorithm.
  • the data generation algorithm here and the verification data generation algorithm are the same, but it is not limited to the secure hash algorithm (Secure) in the above example Hash Algorithm 1, SHA-l), can also be other digest algorithms, such as Secure Hash Algorithm (Secure Hash Algorithm 256, SHA-256), Message Digest Algorithm (Message-Digest Algorithm, MD5), etc., not limited here.
  • the verification data and the target data are compared. If the target data and the verification data are consistent, the fragment file is determined to be correct; if the two data are inconsistent, the fragment file is determined to be incorrect.
  • FIG. 2 is a flowchart of a method for verifying a fragmented file provided in Embodiment 2 of the present application.
  • the execution subject of the slice file verification method is a terminal.
  • Terminals include but are not limited to mobile terminals such as smart phones, tablet computers, and wearable devices, and may also be desktop computers.
  • the method for verifying a fragmented file as shown in the figure may include the following steps:
  • Peer-to-peer Peer to Peer, P2P
  • P2P Peer to Peer
  • This embodiment is mainly directed to the problem of data integrity, because in many cases, we store data with a large amount of data in a P2P node, and the node cannot guarantee the security, privacy and integrity of the data, but is complete Sex is a more important data attribute than privacy. If integrity is threatened, our data processing system will not have a complete and safe data operation foundation, and P2P nodes are vulnerable to attacks or storage and processing. In the event of a failure, the integrity of the data in the P2P node currently storing the source data needs to be detected in a timely manner. By adding the salinity value to the data in the P2P node, it is verified whether the data stored in the current node is the same as the source data, and whether the original data is completely stored.
  • the source data is used to represent the initial data, that is, the standard data for data storage. These data are stored in the local server, used to compare these data with the data stored in the P2P node, and verify the P2P node. The accuracy of the data.
  • the data owner is used to represent the owner and user of the source data.
  • the data owner can process the data and send the data, but because of the large amount of source data, the data owner will All data is sent to other storage nodes. Therefore, in this solution, the storage node is the node used to store the fragmented data of the original data of all the data winners.
  • the original data in this embodiment is used to represent a large file before fragmentation. Because this file is larger, it brings greater pressure for data processing, storage, and transmission. Therefore, we divide it by fragmentation. Stored in different storage nodes.
  • the way of obtaining the original data in this solution can be obtained by wired transmission or wireless transmission.
  • the time of obtaining the original data can be obtained after the original data is generated, or it can be obtained at the same time when the original data is generated. After the generation process ends, the process of acquiring the original data also ends.
  • the acquisition method and the acquisition time of the original data to be stored in the fragment are not limited.
  • S202 Fragment the original data according to a preset fragmentation method to obtain a fragment file, and send the fragment file to a storage node for storage.
  • step S202 in this embodiment may specifically include S2021 to S2024:
  • S2021 Determine the data information of the original data, and determine the storage space capacity occupied by each fragment file corresponding to the original data according to the data information.
  • Fragmentation is the basic unit of distributed data distribution. Different types of applications have different fragmentation methods and strategies. With sharding to distribute data on different physical devices, more devices are introduced to serve the same data. Regardless of the probability, each device has a certain chance of failure.
  • the probability of failure is the product of the probability of failure and the device data.
  • redundancy is needed, which is the copy mentioned here. Its purpose is that when there is a problem with a device in the cluster, a device with the same data as him will immediately replace its location to provide services to the outside world, so that from the outside it seems that the entire cluster is still healthy.
  • the existence of a copy also provides an additional use, which is the separation of read and write.
  • step S2021 may specifically include steps S20211 to S20212:
  • S20211 Determine the data importance, the data oldness and the data amount of the original data.
  • the data information in this embodiment may include data importance, data old and new, and data volume, and these data information are all preset.
  • Data importance is used to measure the data importance of an original data. For example, we can divide the data into primary, secondary, and tertiary levels according to the importance level; the old and new data is used to measure the time between the original data and the current time. Time difference, when a customer's data is relatively new, it can be determined that the data may be used more times, but when the data is relatively old, it may already be quite stale data, we can divide these relatively stale data into Larger shard files, because their calling frequency will be very low; the amount of data is used to represent the storage space occupied by an original data. When the amount of data is larger, a larger number of shards may be required for balanced Sharding and storage.
  • S20212 Determine the occupied space of the fragment file of the original data according to the data importance, the old and new data, and the amount of data.
  • the occupied space of the fragmented files of the original data is determined according to the data importance, the newness, and oldness, and the data volume.
  • S2022 Fragment the original data according to the storage space capacity to obtain a fragment file and a fragment number.
  • the way of slicing can be to divide the original data evenly according to the size of the occupied space to obtain the shard file and the corresponding shard Quantity.
  • the fragmentation can be randomly performed, and after the fragmentation according to the file location, the remaining data can be integrated into components Piece file.
  • S2023 Obtain the operating parameters of each storage node in the network, and determine the same number of target storage nodes as the number of shards according to the operating parameters.
  • the operating parameters may include data such as the memory occupancy rate and storage space occupancy rate of the storage node at the current moment.
  • S2024 Send each of the fragmented files to the corresponding target storage node.
  • the target storage node After determining the target storage node, we send the shard file to the corresponding target storage node. It should be noted that the number of target storage nodes and the number of sharded files in this solution are the same, and are used to efficiently and orderly send and store sharded files to corresponding storage files.
  • the number of storage nodes can be less than the number of shard files. It is used to store two or more shard files in one storage node. This situation applies to a small number of storage nodes in the network. Or the number of storage nodes available for storing sharded files is small. We can increase the utilization of storage nodes by storing at least two sharded files in one storage node.
  • S203 According to the file location of each piece of data in the shard file, randomly select a preset number of data with a predetermined occupied space from the shard file as the shard summary of the shard file.
  • a predetermined amount of data is randomly extracted from the shard file as a shard summary. It should be noted that the extracted data Not one byte of data, but the data that occupies space by default.
  • the fragment summary is stored according to the way that the lookup table stores the MAP.
  • S205 Select data of a preset data amount at at least two target file locations in the slice file to be verified as the target slice summary.
  • S205 is implemented in exactly the same way as S101 in the embodiment corresponding to FIG. 1.
  • S101 in the embodiment corresponding to FIG. 1
  • S206 Randomly combine all the target file locations to obtain a challenge code in the form of a character string, and send the challenge code to a storage node that stores the fragmented file.
  • S206 is implemented in exactly the same way as S102 in the embodiment corresponding to FIG. 1.
  • S102 in the embodiment corresponding to FIG. 1
  • S206 is implemented in exactly the same way as S102 in the embodiment corresponding to FIG. 1.
  • S102 in the embodiment corresponding to FIG. 1
  • details are not described herein again.
  • S207 Receive verification data sent by the storage node; the verification data is generated according to the target file location in the challenge code and a preset data generation algorithm.
  • S207 is implemented in exactly the same way as S103 in the embodiment corresponding to FIG. 1.
  • S103 in the embodiment corresponding to FIG. 1
  • S207 is implemented in exactly the same way as S103 in the embodiment corresponding to FIG. 1.
  • S208 Generate target data according to the target fragment summary and the data generation algorithm, compare the verification data with the target data, and if the target data is consistent with the verification data, determine the fragment The file is correct.
  • the data owner’s terminal generates target data according to the target shard summary and data generation algorithm.
  • the target data is generated in the same way as the storage node generates verification data.
  • the target shard data is first combined, and then combined.
  • the data generates target data according to the data generation algorithm.
  • the data generation algorithm here is the same as the verification data generation algorithm, but it is not limited to the SHAl algorithm in the above example, but can also be other digest algorithms, such as SHA256, MD5, etc., which are not limited here .
  • the verification data and the target data are compared. If the target data and the verification data are consistent, the shard file is determined to be correct,
  • this embodiment may further include steps S2081 to S2083:
  • the verification data and the target data are compared. If the two data are inconsistent, the shard file is determined to be incorrect.
  • the storage node may modify or delete the stored fragmented data by itself, or the storage node may fail to cause data storage problems, resulting in inconsistency between the target data and the verification data.
  • S2082 According to the verification data and the target data, determine the inconsistent data and the file location in the fragment file.
  • the accuracy requirement for determining only the inconsistent data is high, we can determine the file area where the inconsistent data is located. By determining the location of the inconsistent file regionally, the difficulty of finding errors can be reduced, and the efficiency of data correction can be improved.
  • the data owner since the fragmented data in the storage node has already made an error, the data owner has the right to troubleshoot the cause of the data error on the storage node, so as to perform corresponding processing on the storage node through the cause, such as restrictions Storage node permissions, etc.
  • the original data to be stored by fragmentation is obtained; the original data is fragmented according to a preset fragmentation method to obtain a fragmentation file, and the fragmentation file is sent to a storage node for storage; Describe the file location of each data in the shard file, randomly extract a preset number of data with a predetermined occupied space from the shard file as the shard summary of the shard file; according to each shard summary At the file location in the fragmented file, the fragmented summary is stored according to the manner in which the lookup table stores MAP.
  • the original data is fragmented according to a preset fragmentation method to obtain fragmented data, and the fragmented data is sent to the corresponding storage node, according to each
  • the sharding data generates corresponding sharding summaries, and stores all the sharding summaries, and performs verification of ownership of the sharding data according to the sharding summary, thereby improving the efficiency of data ownership verification.
  • FIG. 3 is a schematic diagram of a terminal device provided in Embodiment 3 of the present application.
  • Each unit included in the terminal device is used to execute each step in the embodiments corresponding to FIG. 1 to FIG. 2.
  • the terminal device 300 of this embodiment includes:
  • the selection unit 301 is configured to select data of a preset data amount in at least two target file locations in the slice file to be verified as the target slice summary;
  • the sending unit 302 is configured to randomly combine all the target file positions to obtain a challenge code in the form of a character string, and send the challenge code to a storage node that stores the fragmented file;
  • the receiving unit 303 is configured to receive verification data sent by the storage node; the verification data is generated according to the target file location in the challenge code and a preset data generation algorithm;
  • the comparison unit 304 is configured to generate target data according to the target segment summary and the data generation algorithm, compare the verification data with the target data, and determine if the target data is consistent with the verification data The fragment file is correct.
  • the terminal device may further include:
  • the obtaining unit is used to obtain the original data to be stored in fragments
  • a sharding unit configured to shard the original data according to a preset sharding method to obtain a sharding file, and send the sharding file to a storage node for storage;
  • An extraction unit configured to randomly extract a preset number of data with a predetermined occupied space from the shard file as the shard summary of the shard file according to the file position of each data in the shard file;
  • the storage unit is configured to store the segment digest according to the file location of each segment digest in the segment file in a manner of storing a MAP in a lookup table.
  • the slicing unit may include:
  • the information determining unit is used to determine the data information of the original data, and determine the storage space capacity occupied by each fragment file corresponding to the original data according to the data information;
  • a file slicing unit used for slicing the original data according to the storage space capacity to obtain a sharded file and a number of shards
  • a node determining unit configured to obtain the operating parameters of each storage node in the network, and determine the same number of target storage nodes as the number of shards according to the operating parameters;
  • the file sending unit is used to send each of the fragmented files to the corresponding target storage node.
  • the terminal device may further include:
  • the determining unit is configured to determine that the fragment file is incorrect if the target data and the verification data are inconsistent;
  • a position determining unit configured to determine the inconsistent data and the file position in the fragment file based on the verification data and the target data
  • the data replacement unit is used to determine the correct data corresponding to the file position in the fragment file of the inconsistent data from the original data according to the file position of the inconsistent data in the fragment file And send the correct data to the storage node for data replacement.
  • the information determination unit may include:
  • the first determining unit is used to determine the data importance, the data oldness and the data amount of the original data
  • the second determining unit is configured to determine the occupied space of the fragment file of the original data according to the data importance, the data oldness and the data amount.
  • the challenge verification code is generated by slicing the digest of the slicing file to perform shard verification, which reduces the data processing and transmission volume, and improves the efficiency of data possession verification.
  • the terminal device 4 of this embodiment includes: a processor 40, a memory 41, and computer-readable instructions 42 stored in the memory 41 and executable on the processor 40.
  • the processor 40 executes the computer-readable instructions 42, the steps in the above embodiments of the method for verifying each fragmented file are implemented, for example, steps 101 to 104 shown in FIG. 1.
  • the processor 40 executes the computer-readable instructions 42, the functions of each module/unit in the foregoing device embodiments are realized, for example, the functions of the units 301 to 304 shown in FIG. 3.
  • the computer-readable instructions 42 may be divided into one or more modules/units, the one or more modules/units are stored in the memory 41, and executed by the processor 40, To complete this application.
  • the one or more modules/units may be a series of instruction segments capable of performing specific functions, and the instruction segments are used to describe the execution process of the computer-readable instructions 42 in the terminal device 4.
  • the terminal device 4 may be a computing device such as a desktop computer, a notebook, a palmtop computer and a cloud server.
  • the terminal device may include, but is not limited to, the processor 40 and the memory 41.
  • FIG. 4 is only an example of the terminal device 4 and does not constitute a limitation on the terminal device 4, and may include more or less components than the illustration, or a combination of certain components or different components.
  • the terminal device may further include an input and output device, a network access device, a bus, and the like.
  • the integrated module/unit is implemented in the form of a software functional unit and sold or used as an independent product, it may be stored in a computer-readable storage medium.
  • this application implements all or part of the processes in the methods of the above embodiments, and can also be completed by instructing relevant hardware through computer-readable instructions, which can be stored in a computer non-volatile Readable storage medium.
  • Non-volatile memory may include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM), or flash memory.
  • Volatile memory can include random access memory (RAM) or external cache memory.
  • RAM random access memory
  • DRAM dynamic RAM
  • SDRAM synchronous DRAM
  • DDRSDRAM double data rate SDRAM
  • ESDRAM enhanced SDRAM
  • SLDRAM synchronous chain (Synchlink) DRAM
  • RDRAM direct RAM
  • DRAM direct memory bus dynamic RAM
  • RDRAM memory bus dynamic RAM

Landscapes

  • Engineering & Computer Science (AREA)
  • Multimedia (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

本申请适用于计算机应用技术领域,提供了一种分片文件验证方法、终端设备及计算机非易失性可读存储介质,包括:通过确定待分片存储的原始数据,将所述原始数据按照预设的分片方式进行分片,得到分片数据,并将分片数据发送至对应的存储节点。通过选择待验证的分片文件中至少两个目标文件位置处的预设数据量的数据作为目标分片摘要;将所有目标文件位置组合生成挑战码,并发送所述挑战码至存储所述分片文件的存储节点;接收存储节点发送的验证数据,根据目标分片摘要和所述数据生成算法生成目标数据,将验证数据和所述目标数据进行对比对分片数据进行持有性验证,提高了数据持有性验证的效率。

Description

分片文件验证方法及终端设备
本申请要求于2019年1月8日提交中国专利局、申请号为201910014713.6、发明名称为“分片文件验证方法及终端设备”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。
技术领域
本申请属于计算机应用技术领域,尤其涉及一种分片文件验证方法、终端设备及计算机非易失性可读存储介质。
背景技术
传统的网络存储系统采用集中的存储服务器存放所有数据,存储服务器成为系统性能的瓶颈,也是可靠性和安全性的焦点,不能满足大规模存储应用的需要。现有技术中通过分布式网络存储系统可扩展的系统结构,利用多台存储服务器分担存储负荷,利用位置服务器定位存储信息,它不但提高了系统的可靠性、可用性和存取效率,还易于扩展。但是分布式网络中的存储节点很有可能不能保证云服务器节点中的数据持有性。
技术问题
有鉴于此,本申请实施例提供了一种分片文件验证方法、终端设备及计算机非易失性可读存储介质,以解决现有技术中分布式网络的存储节点不能保证云服务器节点中的数据持有性的问题。
技术解决方案
本申请实施例的第一方面提供了一种分片文件验证方法,包括:
选择待验证的分片文件中至少两个目标文件位置处的预设数据量的数据作为目标分片摘要;
将所有所述目标文件位置进行随机组合得到字符串形式的挑战码,并发送所述挑战码至存储所述分片文件的存储节点;
接收所述存储节点发送的验证数据;所述验证数据根据所述挑战码中的目标文件位置和预设的数据生成算法生成;
根据所述目标分片摘要和所述数据生成算法生成目标数据,将所述验证数据和所述目标数据进行对比,若所述目标数据与所述验证数据一致,则判定所述分片文件正确。
本申请实施例的第二方面提供了一种终端设备,包括存储器、处理器以及存储在所述存储器中并可在所述处理器上运行的计算机可读指令,所述处理器执行所述计算机可读指令时实现上述第一方面的方法。
本申请实施例的第三方面提供了一种终端设备,包括用于实现上述第一方面的方法的各个单元。
本申请实施例的第四方面提供了一种计算机非易失性可读存储介质,所述计算机存储介质存储有计算机可读指令,所述计算机可读指令包括程序指令,所述程序指令当被处理器执行时使所述处理器执行上述第一方面的方法。
有益效果
本申请实施例通过将分片文件的分片摘要生成挑战码进行分片验证,降低了数据的处理量和传输量,提高了数据持有性验证的效率。
附图说明
图1是本申请实施例一提供的分片文件验证方法的流程图;
图2是本申请实施例二提供的分片文件验证方法的流程图;
图3是本申请实施例三提供的终端设备的示意图;
图4是本申请实施例四提供的终端设备的示意图。
本发明的实施方式
参见图1,图1是本申请实施例一提供的分片文件验证方法的流程图。本实施例中分片文件验证方法的执行主体为终端。终端包括但不限于智能手机、平板电脑、可穿戴设备等移动终端,还可以是台式电脑等。如图所示的分片文件验证方法可以包括以下步骤:
S101:选择待验证的分片文件中至少两个目标文件位置处的预设数据量的数据作为目标分片摘要。
分片是把一份完整的数据按一定的条件划分成不同的几份,由不同的服务器来存储划分之后的内容,每份内容就叫做一个片。对于外界来说,显然不希望知道数据是从哪里来,分了多少片,因为对于应用来说,需要看到的是完整的一份数据,而不希望自己的业务逻辑中掺杂了去哪里取这份数据这样与业务无关的问题。所以在分片的同时,使得数据在物理上分开存储和处理,在逻辑上还是完整的一份。
本实施例中,一个完整的源文件通过分片处理之后,可能由多个分片数据组成,并且,这些分片数据被存储在不同的存储节点中,以降低源存储节点的负载。但是存储节点可能因为想提高存储效益而删除或者修改存储在本地的分片数据,而导致数据发生错误,不能正常的进行数据处理,这种情况下,我们通过对存储节点中的分片数据进行抽查,来验证存储节点中分片数据是否正确。
本实施例中所验证的是一个存储节点中所存储的一个分片文件的正确性,在一个分片文件中可能存储多个分片摘要。在本方案中,通过根据分片文件中每个数据的存储地址来抽取预设数据量的数据作为一个分片摘要,为了保证摘要抽取与验证的客观性和全面性,我们可以预先抽取至少两个分片摘要,并将这些分片摘要及其在分片文件中的存储位置进行对应存储。
在进行数据验证时,我们先确定待验证的分片文件,例如,一个完整的源文件可以被分为多个分片文件,而每个分片文件又被存储在不同的存储节点中,我们通过确定给一个存储节点中的一个分片文件来进行数据验证。其确定的方式可以是,根据每个分片文件的文件标识,进行随机的抽取,来确定待验证的分片文件。也可以是根据每个分片文件上一次的验证时间,选择上一次验证时间距离当前时间最长的分片文件作为待验证的分片文件。
在一个分片文件中,可能存储多个分片摘要,随机抽取至少两个分片摘要作为目标分片摘要。在本实施例中,分片文件中的每个数据都有其在文件中的文件位置,我们根据每个分片摘要的在分片文件中的文件位置,选择至少两个目标文件位置,并确定这两个目标文件位置处的分片摘要为目标分片摘要。需要说明的是,我们在提取分片摘要时,是通过对目标文件位置处预设数据量的数据作为目标分片摘要,以防止单个数据对摘要验证造成片面性,导致验证结果不精确的问题。
进一步的,既可以针对分片文件实时选定目标文件位置,进行实时抽取目标分片摘要。还可以先抽取预设数量的文件位置及其对应的分片摘要,将这些摘要信息存储,以在之后需要进行数据验证的时候,从预先存储的摘要信息中随机选择预设数量的目标文件位置及其对应的目标分片摘要。
示例性的,我们对大文件进行分片,每个分片数据平均取16M的数据量作为分片文件,我们在分片文件里随机、且均匀的确定20个位置作为提取分片摘要的位置,每个位置取2字节的数据作为分片摘要,并将这20个地址及其分片摘要进行存储。在上述示例中,每个数据占有2字节的数据量,每个数据对应的地址占有3字节的数据量,这样,便可以得到总共:20*2 + 20*3 =100字节的数据存储量,我们把这100字节作为分片数据保存在管理节点或者数据持有者的终端。
S102:将所有所述目标文件位置进行随机组合得到字符串形式的挑战码,并发送所述挑战码至存储所述分片文件的存储节点。
在确定了目标文件位置和目标分片摘要之后,根据目标文件位置组合生成挑战码,并将挑战码发送至存储该分片节点的存储节点,以通过该挑战码向存储节点发送验证挑战。
可选的,在生成挑战码时,可以通过将所有的目标文件位置进行随机组合,并加上针对组合得到的数据的算法名称,以得到一个字符串,将这个字符串作为挑战码,以将该挑战码发送至存储节点进行数据完成性检测。
示例性的,我们在存储目标分片摘要及其目标文件位置时,存储的方式为查找表存储MAP存储的方式:h(k1)=v1,h(k2)=v2,…,h(k20)=v20,其中k1表示第一个文件位置,v1表示第一个文件位置对应的分片摘要。我们随机选择5个文件位置作为目标文件位置:k3、k6、k7、k8、k20,我们可以按任意顺序组合这些地址,比如:k6+k8+k7+k20+k3,同时加上对组合地址的处理算法,例如哈希算法的字符名称“SHA-l”,每个目标文件位置是3字节,最后我们得到的挑战码长度为:3*5+1=16字节。由此可知,我们的挑战吗编码前长度只有16字节,被挑战方收到挑战后,需要15字节读取地址字段,作为地址读取存储数据的内容,然后按照指定的算法生成验证数据,回复给挑战者终端。
通过这种随机选择目标文件位置来生成挑战码的方式,对存储节点所存储的分片数据进行验证,可以避免传统的数据验证时数据运算量大,得到的摘要数据的数据存储量大,且在传输时候的传输速度较慢的问题,通过这种方式,可以提高分片数据验证速度和准确率,不影响存储节点的正常工作。
S103:接收所述存储节点发送的验证数据;所述验证数据根据所述挑战码中的目标文件位置和预设的数据生成算法生成。
存储节点在接收到挑战码之后,可以通过预设的挑战码的格式,来解析得到挑战码中的目标文件位置,并通过目标文件位置在本地读取出对应的目标分片摘要,并根据解析出来的挑战码中的算法,对解析出的目标分片摘要进行对应的算法处理,生成验证数据。
示例性地,结合步骤S102中的示例,我们将目标文件位置:k3、k6、k7、k8、k20,连同组合字符的算法名称“SHA-l”生成的挑战码发送至存储节点。存储节点在接收到挑战码之后,挑战码中的前15字节为目标文件位置,后一个字节为对应的算法名称,通过预先商定的目标文件位置的数量,可以确定15个字节中包括了5个目标文件位置,再通过这5个目标文件位置从本地中读取每个文件位置处对应的摘要数据,并通过挑战码中的算法名称对应的算法对所有的摘要数据进行计算,得到验证数据。
在存储节点生成验证数据之后,将验证数据发送至数据所有者的终端,以触发数据所有者的终端根据验证数据进行校验,得到存储节点所存储的分片数据是否正确的结论。
S104:根据所述目标分片摘要和所述数据生成算法生成目标数据,将所述验证数据和所述目标数据进行对比,若所述目标数据与所述验证数据一致,则判定所述分片文件正确。
数据所有者的终端根据目标分片摘要和数据生成算法生成目标数据,其生成目标数据的方式与存储节点生成验证数据的方式相同,都是先将目标分片数据进行组合,再对组合之后的数据根据数据生成算法生成目标数据。需要说明的是,这里的数据生成算法和生成验证数据的算法是相同的,但不不限于上述示例中的安全散列算法(Secure Hash Algorithm 1,SHA-l),还可以是其他的摘要算法,例如安全散列算法(Secure Hash Algorithm 256,SHA-256)、消息摘要算法(Message-Digest Algorithm,MD5)等,此处不做限定。
在生成目标数据之后,将验证数据和目标数据进行对比,若目标数据和验证数据一致,则判定分片文件正确;若两个数据不一致,则判定分片文件不正确。
进一步的,为了保证验证结果的正确性和精确性,我们可以确定更多数量的目标文件位置,以及这些目标文件位置对应的更多的目标分片摘要,以得到更加完整的目标数据和验证数据,更加全面的验证分片文件。但是,需要说明的是,虽然选择数量较多的摘要数据有利于验证结果的精确性,但同时也会增加计算和传输的数据量,因此,这两者之间是个需要权衡的问题,最好的情况是,既保证计算和传输的数据量较低,也同时保证数据验证的精确性。
上述方案,通过选择待验证的分片文件中至少两个目标文件位置处的预设数据量的数据作为目标分片摘要;将所有所述目标文件位置进行随机组合得到字符串形式的挑战码,并发送所述挑战码至存储所述分片文件的存储节点;接收所述存储节点发送的验证数据;所述验证数据根据所述挑战码中的目标文件位置和预设的数据生成算法生成;根据所述目标分片摘要和所述数据生成算法生成目标数据,将所述验证数据和所述目标数据进行对比,若所述目标数据与所述验证数据一致,则判定所述分片文件正确。通过将分片文件的分片摘要生成挑战码进行分片验证,降低了数据的处理量和传输量,提高了数据持有性验证的效率。
参见图2,图2是本申请实施例二提供的分片文件验证方法的流程图。本实施例中分片文件验证方法的执行主体为终端。终端包括但不限于智能手机、平板电脑、可穿戴设备等移动终端,还可以是台式电脑等。如图所示的分片文件验证方法可以包括以下步骤:
S201:获取待分片存储的原始数据。
对于传统的分布式系统,无非是在不同的区域搭建一些服务器,然后再在这些服务器上存储数据。它解决了一些集中式存储的问题,但是也存在着比如服务器成为瓶颈、由于带宽而带来的访问不便等问题。因此,P2P分布式存储应运而生。对等网络(Peer to Peer,P2P)分布式存储就是让客户也成为服务器,当在存储数据的同时,也提供空间让别人来存储。这就很好的解决了由于服务器很少而产生的瓶颈,也能在速度上加以改进。但是同样它也带来了很多的问题,例如数据稳定性、一致性、安全性、隐私性以及防攻击性都会受到或多或少的影响。本实施例主要针对的是数据的完整性问题,因为在很多情况下,我们将数据量较大的数据存储至P2P节点中,节点并不能保证数据的安全性、私密性和完整性,而完整性相比于私密性是更加重要的数据属性,如果完整性收到威胁,则我们的数据处理系统将没有一个完整、安全的数据操作基础,在P2P节点很容易遭到攻击或者发生存储、处理故障的情况下,需要及时的检测当前存储源数据的P2P节点中数据的完整性。通过给P2P节点中的数据加盐度值的方式,验证当前节点所存储的数据是否与源数据相同,是否完整的保存有原始的全部数据。在本方案中源数据用于表示最初始的数据,即数据存储的标准数据,这些数据存储在本地的服务器中,用于通过这些数据与存储在P2P节点中的数据进行对比,检验P2P节点中数据的正确性。
在本实施例中,数据所有者用于表示源数据的所有者和使用者,数据所有者可以处理数据、发送数据,但是可能因为源数据的数据量较大的原因,数据所有者会将自己所有的数据发送至其他存储节点,因此,在本方案中,存储节点便是用来存储数据所有得者的原始数据的分片数据的节点。
本实施例中的原始数据用于表示未分片之前的一个大文件,由于这个文件较大,而带来了较大的数据处理、存储以及传输压力,因此我们通过分片的方式,将其存储在不同的存储节点中。
本方案中的原始数据的获取方式可以通过有线传输或者无线传输的方式获取,其获取的时间可以是在原始数据生成完毕之后获取,也可以是在生成原始数据的同时进行获取,在原始数据的生成过程结束之后,获取原始数据的过程也跟随着结束,此处,对待分片存储的原始数据的获取方式和获取时间不做限定。
S202:将所述原始数据按照预设的分片方式进行分片,得到分片文件,并将所述分片文件发送至存储节点进行存储。
在获取到原始数据之后,由于原始数据存储的空间占有量较大,因此我们要对原始数据进行分片处理,以通过不同的存储节点来存储分片文件。
进一步的,本实施例中的步骤S202可以具体包括S2021~S2024:
S2021:确定所述原始数据的数据信息,并根据所述数据信息确定所述原始数据对应的每个分片文件所占用的存储空间容量。
我们在获取到原始数据之后,根据原始数据的数据信息,确定原始数据对应的每个分片文件所占用的存储空间容量。分片是分布式数据分配的基本单位,不同类型的应用有不同的分片方式和策略。有了分片将数据分布在不同的物理设备上,就引入了更多的设备为同一份数据服务。无论机率如何,每台设备都有一定的机会出现故障。
假设每台机器出现故障的机会是一样的,随机参与服务的机器数量增多,整个集群出现故障的机会就会随着参与服务的设备数量增加而增加,所以对于集群整体而言,出现故障的机率就是出现故障的概率与设备数据的乘积。也就是说,集群中的任何一个设备出现故障,整个集群就处于不健康的状态从而影响对外界的服务。为了解决这个问题就需要冗余,也就是这里所说的副本。它的目的在于,当集群中的一台设备出现问题的时候,会有一台跟他持有相同数据设备马上代替它的位置对外界提供服务,从而从外界看起来整个集群仍然是健康的。当然副本的存在同时也提供了一个额外的用处,就是读写分离。
进一步的,步骤S2021可以具体包括步骤S20211~S20212:
S20211:确定所述原始数据的数据重要度、数据新旧度以及数据量。
本实施例中的数据信息可以包括数据重要度、数据新旧度以及数据量,这些数据信息都是预先设定的。数据重要度用于衡量一个原始数据的数据重要程度,例如,我们可以将数据按照重要等级分为一级、二级以及三级;数据新旧度用于衡量一个原始数据生成的时间与当前时间的时间差,当一个客户数据比较新的时候,可以确定该数据可能被用到的次数较多,但当数据比较旧的时候,可能已经是相当陈旧的数据了,我们可以将这些比较陈旧的数据分成较大的分片文件,因为其调用频率会很低;数据量用于表示一个原始数据所占的存储空间,当数据量越大时,便可能需要较多的分片数量,来进行均衡的分片和存储。
S20212:根据所述数据重要度、所述数据新旧度以及所述数据量确定所述原始数据的所述分片文件的占用空间。
在确定原始数据的数据重要度、数据新旧度以及数据量之后,根据数据重要度、数据新旧度以及数据量确定原始数据的分片文件的占用空间。
具体的,假设数据重要度、数据新旧度以及数据量分别为v、t、d,我们可以通过简单的公式确定分片文件的额占用空间为:Occ=d/(v•t)。
S2022:根据所述存储空间容量将所述原始数据进行分片,得到分片文件和分片数量。
在确定了分片文件的占用空间之后,我们根据占用空间对原始数据进行分片,其分片的方式可以是根据占用空间的大小将原始数据进行平均分割,得到分片文件和对应的分片数量。
除此之外,还可以根据原始数据的文件格式,根据原始数据中的文件位置和分片文件的占用空间随机的进行分片,在根据文件位置进行分片之后,再将剩余的数据整合成分片文件。
S2023:获取网络中每个存储节点的运行参数,根据所述运行参数确定与所述分片数量相同数量的目标存储节点。
我们在生成分片文件之后,需要将分片文件存储至对应的存储节点中,但是网络中存储节点的运行情况是不同的,通过获取网络中每个存储节点的运行参数,根据运行参数确定与分片数量相同数量的目标存储节点。其中,运行参数可以包括存储节点在当前时刻的内存占用率、存储空间占用率等数据,我们选择内存占用率和存储空间占用率较小的存储节点做为目标存储节点。
S2024:将每个所述分片文件发送至对应的目标存储节点。
在确定了目标存储节点之后,我们将分片文件发送至对应的目标存储节点。需要说明的是,本方案中的目标存储节点的数量和分片文件的数量是相同的,用于高效、有序的将分片文件发送并存储至对应的存储文件。
除此之外,存储节点的数量可以小于分片文件的数量,用于在一个存储节点中存储两个或者两个以上的分片文件,这种情况适用于网络中的存储节点数量较少,或者可用与存储分片文件的存储节点的数量较少,我们通过在一个存储节点中存储至少两个分片文件,可以提高存储节点的利用率。
S203:根据所述分片文件中每个数据的文件位置,从所述分片文件中随机抽取预设数量、预设占用空间的数据作为所述分片文件的分片摘要。
在将分片文件存储至目标存储节点之后,根据分片文件中每个数据的文件位置,从分片文件中随机抽取预设数量的数据作为分片摘要,需要说明的是,所抽取的数据不是一个字节的数据,而是预设占用空间的数据。
S204:根据每个所述分片摘要在所述分片文件中的文件位置,按照查找表存储MAP的方式,存储所述分片摘要。
在获取到预设数量的文件位置处的分片摘要之后,我们得到的预设数据量的文件地址及其对应位置处的数据组合。根据每个分片摘要在分片文件中的文件位置,按照查找表存储MAP的方式,存储分片摘要。
示例性的,我们在存储目标分片摘要及其目标文件位置时,存储的方式为MAP存储的方式:h(k1)=v1,h(k2)=v2,…,h(k20)=v20,其中k1表示第一个文件位置,v1表示第一个文件位置对应的分片摘要。
S205:选择待验证的分片文件中至少两个目标文件位置处的预设数据量的数据作为目标分片摘要。
在本实施例中S205与图1对应的实施例中S101的实现方式完全相同,具体可参考图1对应的实施例中的S101的相关描述,在此不再赘述。
S206:将所有所述目标文件位置进行随机组合得到字符串形式的挑战码,并发送所述挑战码至存储所述分片文件的存储节点。
在本实施例中S206与图1对应的实施例中S102的实现方式完全相同,具体可参考图1对应的实施例中的S102的相关描述,在此不再赘述。
S207:接收所述存储节点发送的验证数据;所述验证数据根据所述挑战码中的目标文件位置和预设的数据生成算法生成。
在本实施例中S207与图1对应的实施例中S103的实现方式完全相同,具体可参考图1对应的实施例中的S103的相关描述,在此不再赘述。
S208:根据所述目标分片摘要和所述数据生成算法生成目标数据,将所述验证数据和所述目标数据进行对比,若所述目标数据与所述验证数据一致,则判定所述分片文件正确。
数据所有者的终端根据目标分片摘要和数据生成算法生成目标数据,其生成目标数据的方式与存储节点生成验证数据的方式相同,都是先将目标分片数据进行组合,再对组合之后的数据根据数据生成算法生成目标数据。需要说明的是,这里的数据生成算法和生成验证数据的算法是相同的,但不不限于上述示例中的SHAl算法,还可以是其他的摘要算法,例如SHA256,MD5等,此处不做限定。在生成目标数据之后,将验证数据和目标数据进行对比,若目标数据和验证数据一致,则判定分片文件正确、
进一步的,本实施例中还可以包括步骤S2081~S2083:
S2081:若所述目标数据与所述验证数据不一致,则判定所述分片文件不正确。
在生成目标数据之后,将验证数据和目标数据进行对比,若两个数据不一致,则判定分片文件不正确。存储节点可能对所存储的分片数据自行进行了修改或者删除等操作,或者是存储节点发生故障而导致数据存储发生问题,造成目标数据和验证数据不一致的情况。
S2082:根据验证数据和所述目标数据,确定发生不一致的数据及其在所述分片文件中的文件位置。
在确定分片文件不正确之后,根据验证数据和目标数据,确定发生不一致的数据,及其在分片文件中的文件位置。
具体的,在确定发生不一致数据及其文件位置时,可以通过将验证数据和目标数据进行对比的方式,以目标数据为基准,通过对比,确定发生不一致的验证数据中的数据摘要所对应的分片文件中的数据,以及发生不一致的数据在分片文件中的文件位置。
进一步的,由于只确定发生不一致的数据的精确性要求要高,我们可以确定发生不一致的数据所处的文件区域。通过区域性的确定发生不一致的文件位置,可以降低寻错的难度,提高数据纠错的效率。
S2083:根据所述发生不一致的数据在所述分片文件中的文件位置,从原始数据中确定所述发生不一致的数据在所述分片文件中的文件位置处所对应的正确数据,并将所述正确数据发送至所述存储节点进行数据更换。
在确定了发生不一致的数据在分片文件中的文件位置之后,根据文件位置,从原始数据中确定发生不一致的数据在分片文件中的文件位置处所对应的正确数据,并将该正确数据发送至存储节点,以进行数据更换,在存储节点中存储最正确或者最新的数据。
进一步的,由于在存储节点中的分片数据已经发生错误,数据所有者便有权利可以对该存储节点发生数据错误的原因进行排查,以通过该原因对该存储节点进行对应的处理,例如限制存储节点的权限等。
上述方案,通过获取待分片存储的原始数据;将所述原始数据按照预设的分片方式进行分片,得到分片文件,并将所述分片文件发送至存储节点进行存储;根据所述分片文件中每个数据的文件位置,从所述分片文件中随机抽取预设数量、预设占用空间的数据作为所述分片文件的分片摘要;根据每个所述分片摘要在所述分片文件中的文件位置,按照查找表存储MAP的方式,存储所述分片摘要。选择待验证的分片文件中至少两个目标文件位置处的预设数据量的数据作为目标分片摘要;将所有所述目标文件位置进行随机组合得到字符串形式的挑战码,并发送所述挑战码至存储所述分片文件的存储节点;接收所述存储节点发送的验证数据;所述验证数据根据所述挑战码中的目标文件位置和预设的数据生成算法生成;根据所述目标分片摘要和所述数据生成算法生成目分片文件摘要验证方法标数据,将所述验证数据和所述目标数据进行对比,若所述目标数据与所述验证数据一致,则判定所述分片文件正确。通过确定待分片存储的原始数据,将所述原始数据按照预设的分片方式进行分片,得到分片数据,并将所述分片数据发送至对应的存储节点,根据每个所述分片数据生成对应的分片摘要,并存储所有所述分片摘要,根据该分片摘要对分片数据进行持有性验证,提高了数据持有性验证的效率。
参见图3,图3是本申请实施例三提供的一种终端设备的示意图。终端设备包括的各单元用于执行图1~图2对应的实施例中的各步骤。具体请参阅图1~图2各自对应的实施例中的相关描述。为了便于说明,仅示出了与本实施例相关的部分。本实施例的终端设备300包括:
选择单元301,用于选择待验证的分片文件中至少两个目标文件位置处的预设数据量的数据作为目标分片摘要;
发送单元302,用于将所有所述目标文件位置进行随机组合得到字符串形式的挑战码,并发送所述挑战码至存储所述分片文件的存储节点;
接收单元303,用于接收所述存储节点发送的验证数据;所述验证数据根据所述挑战码中的目标文件位置和预设的数据生成算法生成;
对比单元304,用于根据所述目标分片摘要和所述数据生成算法生成目标数据,将所述验证数据和所述目标数据进行对比,若所述目标数据与所述验证数据一致,则判定所述分片文件正确。
进一步的,所述终端设备还可以包括:
获取单元,用于获取待分片存储的原始数据;
分片单元,用于将所述原始数据按照预设的分片方式进行分片,得到分片文件,并将所述分片文件发送至存储节点进行存储;
抽取单元,用于根据所述分片文件中每个数据的文件位置,从所述分片文件中随机抽取预设数量、预设占用空间的数据作为所述分片文件的分片摘要;
存储单元,用于根据每个所述分片摘要在所述分片文件中的文件位置,按照查找表存储MAP的方式,存储所述分片摘要。
进一步的,所述分片单元可以包括:
信息确定单元,用于确定所述原始数据的数据信息,并根据所述数据信息确定所述原始数据对应的每个分片文件所占用的存储空间容量;
文件分片单元,用于根据所述存储空间容量将所述原始数据进行分片,得到分片文件和分片数量;
节点确定单元,用于获取网络中每个存储节点的运行参数,根据所述运行参数确定与所述分片数量相同数量的目标存储节点;
文件发送单元,用于将每个所述分片文件发送至对应的目标存储节点。
进一步的,所述终端设备还可以包括:
判定单元,用于若所述目标数据与所述验证数据不一致,则判定所述分片文件不正确;
位置确定单元,用于根据验证数据和所述目标数据,确定发生不一致的数据及其在所述分片文件中的文件位置;
数据更换单元,用于根据所述发生不一致的数据在所述分片文件中的文件位置,从原始数据中确定所述发生不一致的数据在所述分片文件中的文件位置处所对应的正确数据,并将所述正确数据发送至所述存储节点进行数据更换。
进一步的,所述信息确定单元可以包括:
第一确定单元,用于确定所述原始数据的数据重要度、数据新旧度以及数据量;
第二确定单元,用于根据所述数据重要度、所述数据新旧度以及所述数据量确定所述原始数据的所述分片文件的占用空间。
上述方案,通过将分片文件的分片摘要生成挑战码进行分片验证,降低了数据的处理量和传输量,提高了数据持有性验证的效率。
图4是本申请实施例四提供的终端设备的示意图。如图4所示,该实施例的终端设备4包括:处理器40、存储器41以及存储在所述存储器41中并可在所述处理器40上运行的计算机可读指令42。所述处理器40执行所述计算机可读指令42时实现上述各个分片文件验证方法实施例中的步骤,例如图1所示的步骤101至104。或者,所述处理器40执行所述计算机可读指令42时实现上述各装置实施例中各模块/单元的功能,例如图3所示单元301至304的功能。
示例性的,所述计算机可读指令42可以被分割成一个或多个模块/单元,所述一个或者多个模块/单元被存储在所述存储器41中,并由所述处理器40执行,以完成本申请。所述一个或多个模块/单元可以是能够完成特定功能的一系列指令段,该指令段用于描述所述计算机可读指令42在所述终端设备4中的执行过程。
所述终端设备4可以是桌上型计算机、笔记本、掌上电脑及云端服务器等计算设备。所述终端设备可包括,但不仅限于,处理器40、存储器41。本领域技术人员可以理解,图4仅仅是终端设备4的示例,并不构成对终端设备4的限定,可以包括比图示更多或更少的部件,或者组合某些部件,或者不同的部件,例如所述终端设备还可以包括输入输出设备、网络接入设备、总线等。
所述集成的模块/单元如果以软件功能单元的形式实现并作为独立的产品销售或使用时,可以存储在一个计算机可读取存储介质中。基于这样的理解,本申请实现上述实施例方法中的全部或部分流程,也可以通过计算机可读指令来指令相关的硬件来完成,所述的计算机可读指令可存储于一计算机非易失性可读存储介质中。
本领域普通技术人员可以理解实现上述实施例方法中的全部或部分流程,是可以通过计算机可读指令来指令相关的硬件来完成,所述的计算机可读指令可存储于一计算机非易失性可读取存储介质中,该计算机可读指令在执行时,可包括如上述各方法的实施例的流程。其中,本申请所提供的各实施例中所使用的对存储器、存储、数据库或其它介质的任何引用,均可包括非易失性和/或易失性存储器。非易失性存储器可包括只读存储器(ROM)、可编程ROM(PROM)、电可编程ROM(EPROM)、电可擦除可编程ROM(EEPROM)或闪存。易失性存储器可包括随机存取存储器(RAM)或者外部高速缓冲存储器。作为说明而非局限,RAM以多种形式可得,诸如静态RAM(SRAM)、动态RAM(DRAM)、同步DRAM(SDRAM)、双数据率SDRAM(DDRSDRAM)、增强型SDRAM(ESDRAM)、同步链路(Synchlink) DRAM(SLDRAM)、存储器总线(Rambus)直接RAM(RDRAM)、直接存储器总线动态RAM(DRDRAM)、以及存储器总线动态RAM(RDRAM)等。
以上所述实施例仅用以说明本申请的技术方案,而非对其限制;尽管参照前述实施例对本申请进行了详细的说明,本领域的普通技术人员应当理解:其依然可以对前述各实施例所记载的技术方案进行修改,或者对其中部分技术特征进行等同替换;而这些修改或者替换,并不使相应技术方案的本质脱离本申请各实施例技术方案的精神和范围,均应包含在本申请的保护范围之内。

Claims (20)

  1. 一种分片文件验证方法,其特征在于,包括:
    选择待验证的分片文件中至少两个目标文件位置处的预设数据量的数据作为目标分片摘要;
    将所有所述目标文件位置进行随机组合得到字符串形式的挑战码,并发送所述挑战码至存储所述分片文件的存储节点;
    接收所述存储节点发送的验证数据;所述验证数据根据所述挑战码中的目标文件位置和预设的数据生成算法生成;
    根据所述目标分片摘要和所述数据生成算法生成目标数据,将所述验证数据和所述目标数据进行对比,若所述目标数据与所述验证数据一致,则判定所述分片文件正确。
  2. 如权利要求1所述的分片文件验证方法,其特征在于,所述选择待验证的分片文件中至少两个目标文件位置处的预设数据量的数据作为目标分片摘要之前,还包括:
    获取待分片存储的原始数据;
    将所述原始数据按照预设的分片方式进行分片,得到分片文件,并将所述分片文件发送至存储节点进行存储;
    根据所述分片文件中每个数据的文件位置,从所述分片文件中随机抽取预设数量、预设占用空间的数据作为所述分片文件的分片摘要;
    根据每个所述分片摘要在所述分片文件中的文件位置,按照查找表存储MAP的方式,存储所述分片摘要。
  3. 如权利要求2所述的分片文件验证方法,其特征在于,所述将所述原始数据按照预设的分片方式进行分片,得到分片文件,并将所述分片文件发送至存储节点进行存储,包括:
    确定所述原始数据的数据信息,并根据所述数据信息确定所述原始数据对应的每个分片文件所占用的存储空间容量;
    根据所述存储空间容量将所述原始数据进行分片,得到分片文件和分片数量;
    获取网络中每个存储节点的运行参数,根据所述运行参数确定与所述分片数量相同数量的目标存储节点;
    将每个所述分片文件发送至对应的目标存储节点。
  4. 如权利要求1-3任一项所述的分片文件验证方法,其特征在于,所述方法还包括:
    若所述目标数据与所述验证数据不一致,则判定所述分片文件不正确;
    根据验证数据和所述目标数据,确定发生不一致的数据及其在所述分片文件中的文件位置;
    根据所述发生不一致的数据在所述分片文件中的文件位置,从原始数据中确定所述发生不一致的数据在所述分片文件中的文件位置处所对应的正确数据,并将所述正确数据发送至所述存储节点进行数据更换。
  5. 如权利要求3所述的分片文件验证方法,其特征在于,所述确定所述原始数据的数据信息,并根据所述数据信息确定所述原始数据对应的分片文件所占用的存储空间容量,包括:
    确定所述原始数据的数据重要度、数据新旧度以及数据量;
    根据所述数据重要度、所述数据新旧度以及所述数据量确定所述原始数据的所述分片文件的占用空间。
  6. 一种终端设备,其特征在于,包括存储器以及处理器,所述存储器中存储有可在所述处理器上运行的计算机可读指令,其特征在于,所述处理器执行所述计算机可读指令时,实现如下步骤:
    选择待验证的分片文件中至少两个目标文件位置处的预设数据量的数据作为目标分片摘要;
    将所有所述目标文件位置进行随机组合得到字符串形式的挑战码,并发送所述挑战码至存储所述分片文件的存储节点;
    接收所述存储节点发送的验证数据;所述验证数据根据所述挑战码中的目标文件位置和预设的数据生成算法生成;
    根据所述目标分片摘要和所述数据生成算法生成目标数据,将所述验证数据和所述目标数据进行对比,若所述目标数据与所述验证数据一致,则判定所述分片文件正确。
  7. 如权利要求6所述的终端设备,其特征在于,所述选择待验证的分片文件中至少两个目标文件位置处的预设数据量的数据作为目标分片摘要之前,还包括:
    获取待分片存储的原始数据;
    将所述原始数据按照预设的分片方式进行分片,得到分片文件,并将所述分片文件发送至存储节点进行存储;
    根据所述分片文件中每个数据的文件位置,从所述分片文件中随机抽取预设数量、预设占用空间的数据作为所述分片文件的分片摘要;
    根据每个所述分片摘要在所述分片文件中的文件位置,按照查找表存储MAP的方式,存储所述分片摘要。
  8. 如权利要求7所述的终端设备,其特征在于,所述将所述原始数据按照预设的分片方式进行分片,得到分片文件,并将所述分片文件发送至存储节点进行存储,包括:
    确定所述原始数据的数据信息,并根据所述数据信息确定所述原始数据对应的每个分片文件所占用的存储空间容量;
    根据所述存储空间容量将所述原始数据进行分片,得到分片文件和分片数量;
    获取网络中每个存储节点的运行参数,根据所述运行参数确定与所述分片数量相同数量的目标存储节点;
    将每个所述分片文件发送至对应的目标存储节点。
  9. 如权利要求6-8任一项所述的终端设备,其特征在于,还包括:
    若所述目标数据与所述验证数据不一致,则判定所述分片文件不正确;
    根据验证数据和所述目标数据,确定发生不一致的数据及其在所述分片文件中的文件位置;
    根据所述发生不一致的数据在所述分片文件中的文件位置,从原始数据中确定所述发生不一致的数据在所述分片文件中的文件位置处所对应的正确数据,并将所述正确数据发送至所述存储节点进行数据更换。
  10. 如权利要求8所述的终端设备,其特征在于,所述确定所述原始数据的数据信息,并根据所述数据信息确定所述原始数据对应的分片文件所占用的存储空间容量,包括:
    确定所述原始数据的数据重要度、数据新旧度以及数据量;
    根据所述数据重要度、所述数据新旧度以及所述数据量确定所述原始数据的所述分片文件的占用空间。
  11. 一种终端设备,其特征在于,包括:
    选择单元,用于选择待验证的分片文件中至少两个目标文件位置处的预设数据量的数据作为目标分片摘要;
    发送单元,用于将所有所述目标文件位置进行随机组合得到字符串形式的挑战码,并发送所述挑战码至存储所述分片文件的存储节点;
    接收单元,用于接收所述存储节点发送的验证数据;所述验证数据根据所述挑战码中的目标文件位置和预设的数据生成算法生成;
    对比单元,用于根据所述目标分片摘要和所述数据生成算法生成目标数据,将所述验证数据和所述目标数据进行对比,若所述目标数据与所述验证数据一致,则判定所述分片文件正确。
  12. 如权利要求11所述的终端设备,其特征在于,还包括:
    获取单元,用于获取待分片存储的原始数据;
    分片单元,用于将所述原始数据按照预设的分片方式进行分片,得到分片文件,并将所述分片文件发送至存储节点进行存储;
    抽取单元,用于根据所述分片文件中每个数据的文件位置,从所述分片文件中随机抽取预设数量、预设占用空间的数据作为所述分片文件的分片摘要;
    存储单元,用于根据每个所述分片摘要在所述分片文件中的文件位置,按照查找表存储MAP的方式,存储所述分片摘要。
  13. 如权利要求12所述的终端设备,其特征在于,所述分片单元包括:
    信息确定单元,用于确定所述原始数据的数据信息,并根据所述数据信息确定所述原始数据对应的每个分片文件所占用的存储空间容量;
    文件分片单元,用于根据所述存储空间容量将所述原始数据进行分片,得到分片文件和分片数量;
    节点确定单元,用于获取网络中每个存储节点的运行参数,根据所述运行参数确定与所述分片数量相同数量的目标存储节点;
    文件发送单元,用于将每个所述分片文件发送至对应的目标存储节点。
  14. 如权利要求11-13任一项所述的终端设备,其特征在于,还包括:
    判定单元,用于若所述目标数据与所述验证数据不一致,则判定所述分片文件不正确;
    位置确定单元,用于根据验证数据和所述目标数据,确定发生不一致的数据及其在所述分片文件中的文件位置;
    数据更换单元,用于根据所述发生不一致的数据在所述分片文件中的文件位置,从原始数据中确定所述发生不一致的数据在所述分片文件中的文件位置处所对应的正确数据,并将所述正确数据发送至所述存储节点进行数据更换。
  15. 如权利要求13所述的终端设备,其特征在于,所述信息确定单元包括:
    第一确定单元,用于确定所述原始数据的数据重要度、数据新旧度以及数据量;
    第二确定单元,用于根据所述数据重要度、所述数据新旧度以及所述数据量确定所述原始数据的所述分片文件的占用空间。
  16. 一种计算机非易失性可读存储介质,所述计算机非易失性可读存储介质存储有计算机可读指令,其特征在于,所述计算机可读指令被处理器执行时实现如下步骤:
    选择待验证的分片文件中至少两个目标文件位置处的预设数据量的数据作为目标分片摘要;
    将所有所述目标文件位置进行随机组合得到字符串形式的挑战码,并发送所述挑战码至存储所述分片文件的存储节点;
    接收所述存储节点发送的验证数据;所述验证数据根据所述挑战码中的目标文件位置和预设的数据生成算法生成;
    根据所述目标分片摘要和所述数据生成算法生成目标数据,将所述验证数据和所述目标数据进行对比,若所述目标数据与所述验证数据一致,则判定所述分片文件正确。
  17. 如权利要求16所述的计算机非易失性可读存储介质,其特征在于,所述选择待验证的分片文件中至少两个目标文件位置处的预设数据量的数据作为目标分片摘要之前,还包括:
    获取待分片存储的原始数据;
    将所述原始数据按照预设的分片方式进行分片,得到分片文件,并将所述分片文件发送至存储节点进行存储;
    根据所述分片文件中每个数据的文件位置,从所述分片文件中随机抽取预设数量、预设占用空间的数据作为所述分片文件的分片摘要;
    根据每个所述分片摘要在所述分片文件中的文件位置,按照查找表存储MAP的方式,存储所述分片摘要。
  18. 如权利要求17所述的计算机非易失性可读存储介质,其特征在于,所述将所述原始数据按照预设的分片方式进行分片,得到分片文件,并将所述分片文件发送至存储节点进行存储,包括:
    确定所述原始数据的数据信息,并根据所述数据信息确定所述原始数据对应的每个分片文件所占用的存储空间容量;
    根据所述存储空间容量将所述原始数据进行分片,得到分片文件和分片数量;
    获取网络中每个存储节点的运行参数,根据所述运行参数确定与所述分片数量相同数量的目标存储节点;
    将每个所述分片文件发送至对应的目标存储节点。
  19. 如权利要求16-18任一项所述的计算机非易失性可读存储介质,其特征在于,还包括:
    若所述目标数据与所述验证数据不一致,则判定所述分片文件不正确;
    根据验证数据和所述目标数据,确定发生不一致的数据及其在所述分片文件中的文件位置;
    根据所述发生不一致的数据在所述分片文件中的文件位置,从原始数据中确定所述发生不一致的数据在所述分片文件中的文件位置处所对应的正确数据,并将所述正确数据发送至所述存储节点进行数据更换。
  20. 如权利要求18所述的计算机非易失性可读存储介质,其特征在于,所述确定所述原始数据的数据信息,并根据所述数据信息确定所述原始数据对应的分片文件所占用的存储空间容量,包括:
    确定所述原始数据的数据重要度、数据新旧度以及数据量;
    根据所述数据重要度、所述数据新旧度以及所述数据量确定所述原始数据的所述分片文件的占用空间。
PCT/CN2019/118145 2019-01-08 2019-11-13 分片文件验证方法及终端设备 WO2020143317A1 (zh)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201910014713.6A CN109831487B (zh) 2019-01-08 2019-01-08 分片文件验证方法及终端设备
CN201910014713.6 2019-01-08

Publications (1)

Publication Number Publication Date
WO2020143317A1 true WO2020143317A1 (zh) 2020-07-16

Family

ID=66860116

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2019/118145 WO2020143317A1 (zh) 2019-01-08 2019-11-13 分片文件验证方法及终端设备

Country Status (2)

Country Link
CN (1) CN109831487B (zh)
WO (1) WO2020143317A1 (zh)

Cited By (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112631991A (zh) * 2020-12-26 2021-04-09 中国农业银行股份有限公司 一种文件迁移方法及装置
CN113590994A (zh) * 2021-08-02 2021-11-02 北京金山云网络技术有限公司 数据处理方法、装置、计算机设备和存储介质
CN113726838A (zh) * 2021-06-17 2021-11-30 武汉理工数字传播工程有限公司 文件传输方法、装置、设备及存储介质
CN114760068A (zh) * 2022-04-08 2022-07-15 中国银行股份有限公司 用户的身份验证方法、系统、电子设备及存储介质
WO2023029917A1 (zh) * 2021-08-31 2023-03-09 华为技术有限公司 一种数据分片方法、装置以及电子设备

Families Citing this family (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109831487B (zh) * 2019-01-08 2022-05-13 平安科技(深圳)有限公司 分片文件验证方法及终端设备
CN111031110B (zh) * 2019-11-29 2023-01-24 山东英信计算机技术有限公司 一种文件上传方法、装置及电子设备和存储介质
CN111176567B (zh) * 2019-12-25 2023-11-03 上海新沄信息科技有限公司 分布式云存储的存储供应量验证方法及装置
CN111506578A (zh) * 2020-04-17 2020-08-07 深圳前海微众银行股份有限公司 业务数据的校验方法、装置、设备及存储介质
CN112667623A (zh) * 2021-01-13 2021-04-16 张立旭 一种基于随机算法的分布式存储数据纠错方法及系统
CN113076283B (zh) * 2021-04-06 2022-02-18 中移(上海)信息通信科技有限公司 文件一致性验证方法、装置及电子设备
CN113407492B (zh) * 2021-06-18 2024-03-26 中国人民银行清算总中心 文件分片存储、分片文件重组方法及装置、文件保护系统
CN114567496B (zh) * 2022-03-03 2024-02-20 浪潮云信息技术股份公司 一种进行云服务器镜像完整性校验的方法及系统
CN115811411A (zh) * 2022-05-16 2023-03-17 浪潮软件股份有限公司 防篡改的信息传输方法、系统、装置及计算机可读介质
CN116233120B (zh) * 2023-05-10 2023-07-14 深圳普菲特信息科技股份有限公司 一种基于数据处理的大文件分片传输方法、系统和介质

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20140358872A1 (en) * 2013-05-31 2014-12-04 Samsung Electronics Co., Ltd. Storage system and method for performing deduplication in conjunction with host device and storage device
CN106033427A (zh) * 2015-03-11 2016-10-19 阿里巴巴集团控股有限公司 一种抽样校验数据方法及设备
CN108664221A (zh) * 2018-05-11 2018-10-16 北京奇虎科技有限公司 一种数据持有证明方法、装置及可读存储介质
CN109104449A (zh) * 2017-06-21 2018-12-28 北京大学 一种云存储环境下的多备份数据持有性证明方法
CN109831487A (zh) * 2019-01-08 2019-05-31 平安科技(深圳)有限公司 分片文件验证方法及终端设备

Family Cites Families (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20170134162A1 (en) * 2015-11-10 2017-05-11 Shannon Code System and process for verifying digital media content authenticity
US20180219871A1 (en) * 2017-02-01 2018-08-02 Futurewei Technologies, Inc. Verification of fragmented information centric network chunks
CN108737109A (zh) * 2018-05-11 2018-11-02 北京奇虎科技有限公司 数据持有证明方法、装置及系统

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20140358872A1 (en) * 2013-05-31 2014-12-04 Samsung Electronics Co., Ltd. Storage system and method for performing deduplication in conjunction with host device and storage device
CN106033427A (zh) * 2015-03-11 2016-10-19 阿里巴巴集团控股有限公司 一种抽样校验数据方法及设备
CN109104449A (zh) * 2017-06-21 2018-12-28 北京大学 一种云存储环境下的多备份数据持有性证明方法
CN108664221A (zh) * 2018-05-11 2018-10-16 北京奇虎科技有限公司 一种数据持有证明方法、装置及可读存储介质
CN109831487A (zh) * 2019-01-08 2019-05-31 平安科技(深圳)有限公司 分片文件验证方法及终端设备

Cited By (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112631991A (zh) * 2020-12-26 2021-04-09 中国农业银行股份有限公司 一种文件迁移方法及装置
CN113726838A (zh) * 2021-06-17 2021-11-30 武汉理工数字传播工程有限公司 文件传输方法、装置、设备及存储介质
CN113726838B (zh) * 2021-06-17 2023-09-19 武汉理工数字传播工程有限公司 文件传输方法、装置、设备及存储介质
CN113590994A (zh) * 2021-08-02 2021-11-02 北京金山云网络技术有限公司 数据处理方法、装置、计算机设备和存储介质
WO2023029917A1 (zh) * 2021-08-31 2023-03-09 华为技术有限公司 一种数据分片方法、装置以及电子设备
CN114760068A (zh) * 2022-04-08 2022-07-15 中国银行股份有限公司 用户的身份验证方法、系统、电子设备及存储介质

Also Published As

Publication number Publication date
CN109831487B (zh) 2022-05-13
CN109831487A (zh) 2019-05-31

Similar Documents

Publication Publication Date Title
WO2020143317A1 (zh) 分片文件验证方法及终端设备
CN111108478B (zh) 一种用于通信和共享区块链数据的方法、系统、和装置
US11269864B2 (en) Blockchain data storage based on shared nodes and error correction code
CN111344706B (zh) 管理区块链上的交易的方法和系统
CN110945550B (zh) 在可信执行环境下处理和存储区块链数据
WO2018228331A1 (zh) 业务数据存储方法、装置、存储介质及电子设备
WO2020151330A1 (zh) 数据持有性验证方法及终端设备
CN105337941B (zh) 一种设备标识提供方法及装置
CN111448781A (zh) 共享的区块链数据存储
WO2019185329A1 (en) Runtime self-correction for blockchain ledgers
KR102225196B1 (ko) 에러 정정 코드에 기초하는 공유 블록체인 데이터 저장의 컨센서스
KR102396737B1 (ko) 공유 블록체인 데이터 저장 우선 순위화
KR102363271B1 (ko) 에러 정정 코드에 기초한 공유 블록체인 데이터 저장의 데이터 보안
CN112579606A (zh) 工作流数据处理方法、装置、计算机设备及存储介质
CN112015674A (zh) 基于多层级的缓存资源访问方法、装置和计算机设备
US11108545B2 (en) Creating a blockchain account and verifying blockchain transactions
US20210303633A1 (en) Shard hashing
WO2022237497A1 (zh) 一种基于区块链网络的数据存储方法及装置
CN111095210A (zh) 基于纠错编码存储共享的区块链数据
CN110633378A (zh) 一种支持超大规模关系网络的图数据库构建方法
AU2018355092A1 (en) Witness blocks in blockchain applications
WO2020140626A1 (zh) 基于盐值的数据持有性验证方法及终端设备
WO2023011022A1 (zh) 基于区块链的数据处理方法、设备及计算机可读存储介质
WO2021098277A1 (zh) 区块链文件存取方法、装置、计算机设备及存储介质
CN111226206A (zh) 拍摄区块链数据的快照

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 19908524

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 19908524

Country of ref document: EP

Kind code of ref document: A1