Object data storage method and device and object data reading method and device

By dividing object data into data blocks of a preset size and adding a checksum in the header, the problems of data security and waste of checksum resources in existing technologies are solved, and efficient data storage and retrieval are achieved.

CN118585136APending Publication Date: 2024-09-03SHANGHAI BILIBILI TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410792077.0
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-06-18
Publication Date
2024-09-03

AI Technical Summary

Technical Problem

Existing object data storage solutions cannot effectively guarantee the security of some data, and for data that requires verification, the entire data block needs to be read for verification, resulting in wasted resources.

Method used

The data to be stored is divided into data blocks of a preset size, and a check value is added to the header of each data block. When storing, the header information and the check value are stored together. When reading, the validity of the data block is determined by the check value, and the valid data block is sent directly.

Benefits of technology

It enables secure verification of local data, avoids the waste of resources in reading complete data blocks, and improves the efficiency and security of data access.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118585136A
    Figure CN118585136A
Patent Text Reader

Abstract

The embodiment of the invention provides an object data storage and reading method and device. The object data storage and reading method comprises the steps that header information is created for to-be-stored data; segmenting the to-be-stored data according to a preset size to obtain one or more data blocks; generating a verification value corresponding to each data block, and adding the verification value to the head of the data block; and storing the header information and each data block after the check value is added into a storage device. According to the method, data is stored into a plurality of data blocks with preset sizes, and a verification value corresponding to each data block is stored, so that when the problems of data return-to-zero caused by malicious string change of local data and storage equipment failure occur in the data, the data security can be accurately judged, and the access of the remaining data can be terminated in advance; data consistency verification can be carried out on part of data, the whole data does not need to be read, and io bandwidth and data transmission are saved; and whether a segment of data is valid data can be directly judged through head information.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The embodiments of the present application relate to the field of data processing technology, and in particular, to a method, device, computer equipment, and computer-readable storage medium for storing and reading object data. Background Art

[0002] In the prior art, object storage systems manage data in the form of objects. When data is stored in a device, the data storage location is marked with metadata. Generally, multiple copies are provided for storage or stored through EC and other solutions. If the data loses relevant information, the lost data can be restored by reading the copy or EC calculation method.

[0003] However, this solution of multi-copy storage or EC storage cannot guarantee the security of data after partial data loss or tampering during storage, only for the entire data block; moreover, for data that requires verification, it is necessary to read the complete data storage and calculate the entire block check bit. Summary of the invention

[0004] The purpose of the embodiments of the present application is to provide a method, apparatus, computer device and computer-readable storage medium for storing and reading object data, so as to solve the following problems: the existing object data storage solutions are not convenient for performing security verification on partial data, and in order to read partial data, it is necessary to read all the data for verification and then intercept it, which causes great waste.

[0005] One aspect of an embodiment of the present application provides a method for storing object data, including:

[0006] Create header information for the data to be stored;

[0007] Splitting the data to be stored according to a preset size to obtain one or more data blocks;

[0008] Generate a check value corresponding to each data block, and add the check value to the header of the data block;

[0009] The header information and each data block after adding the check value are stored in a storage device.

[0010] Optionally, dividing the data to be stored into one or more data blocks according to a preset size includes:

[0011] Applying for a memory space of the preset size from a storage device;

[0012] Writing the data to be stored into the memory space of the preset size in sequence, and truncating the data when the memory space of the preset size is filled with the data to be stored;

[0013] Return to the step of applying for the preset size of memory space from the storage device until the data to be stored does not fill up the preset size of memory space, and then output the divided one or more data blocks.

[0014] Optionally, storing the header information and each data block after adding the check value in a storage device includes:

[0015] The header information and each data block after adding the check value are stored in a storage device.

[0016] Optionally, the method further comprises:

[0017] Reading the header information corresponding to the current data from the storage device in sequence;

[0018] In the case where it is determined according to the header information that the current data is valid, generating metadata information corresponding to the current data, and writing the metadata information into the preset metadata information library;

[0019] Determine the position of the header information corresponding to the next data according to the data size in the header information corresponding to the current data, and determine the next data as the current data, return to execute the step of reading the header information corresponding to the current data from the storage device in sequence, until all the data in the storage device is read, and then output the preset metadata information library.

[0020] One aspect of an embodiment of the present application further provides a method for reading object data, including:

[0021] In response to a read request for first data, obtaining header information corresponding to the first data;

[0022] In a case where it is determined according to the header information that the first data is valid, determining a start position and an end position for reading the first data according to range information included in the read request;

[0023] Read one or more data blocks in the first data according to the start position and the end position; wherein each data block has a one-to-one corresponding check value;

[0024] In a case where the data block passes verification according to the verification value, the one or more data blocks are sent to the client.

[0025] Optionally, the header information includes a unique identification code of the data, a check value corresponding to the header information, a data validity flag and a data size; after the step of obtaining the header information corresponding to the first data, the method further includes:

[0026] Whether the first data is valid is determined according to the check value corresponding to the header information and the data validity flag.

[0027] Optionally, reading one or more data blocks in the first data according to the start position and the end position includes:

[0028] Reading a data block from the first data according to the starting position;

[0029] Verifying the data block according to the verification value corresponding to the data block;

[0030] When the data block is verified to be passed, the step of reading the data block from the first data according to the starting position is returned to be executed until the end position is read, and one or more data blocks read from the first data are output.

[0031] One aspect of an embodiment of the present application further provides a storage device for object data, including:

[0032] A header information creation module, used to create header information for data to be stored;

[0033] A data segmentation module, used to segment the data to be stored according to a preset size to obtain one or more data blocks;

[0034] A check value generation module, used to generate a check value corresponding to each data block, and add the check value to the header of the data block;

[0035] The data storage module is used to store the header information and each data block after adding the check value into a storage device.

[0036] One aspect of an embodiment of the present application further provides a device for reading object data, including:

[0037] A header information acquisition module, configured to acquire header information corresponding to the first data in response to a read request for the first data;

[0038] a position determination module, configured to determine a start position and an end position of reading the first data according to range information included in the read request, when the first data is determined to be valid according to the header information;

[0039] A data block reading module, configured to read one or more data blocks from the first data according to the start position and the end position; wherein each data block has a one-to-one corresponding check value;

[0040] The data sending module is used to send the one or more data blocks to the client when the data block passes the verification according to the verification value.

[0041] One aspect of an embodiment of the present application provides a computer device, which includes a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the steps of the object data storage and reading method as described above when executing the computer program.

[0042] One aspect of an embodiment of the present application provides a computer-readable storage medium, which stores a computer program. The computer program can be executed by at least one processor so that the at least one processor implements the steps of the object data storage and reading method as described above when executing the computer program.

[0043] The object data storage and reading method, device, equipment and computer-readable storage medium provided in the embodiments of the present application can accurately determine the data security and terminate the access to the remaining data in advance when the data has problems such as local data being maliciously tampered with or the data being reset to zero due to a storage device failure, by storing the data as multiple data blocks of preset sizes and storing the check value corresponding to each data block; a data consistency check can be performed on part of the data without reading the entire data, saving IO bandwidth and data transmission; and the header information can be used to directly determine whether a section of data is valid data. BRIEF DESCRIPTION OF THE DRAWINGS

[0044] Figure 1 A diagram schematically shows an application environment of a method for storing and reading object data according to an embodiment of the present application;

[0045] Figure 2 A flowchart schematically shows a method for storing object data according to the first embodiment of the present application;

[0046] Figure 3 A schematic diagram schematically shows a data structure for storing data;

[0047] Figure 4 A flowchart schematically shows a method for storing object data;

[0048] Figure 5 A flowchart of restoring a preset metadata information library is schematically shown;

[0049] Figure 6 A flowchart of a method for reading object data according to the second embodiment of the present application is schematically shown;

[0050] Figure 7A flowchart schematically shows a method for reading object data;

[0051] Figure 8 A block diagram schematically shows a device for storing object data according to a third embodiment of the present application;

[0052] Fig. 9 A block diagram schematically shows an apparatus for reading object data according to a fourth embodiment of the present application; and

[0053] Fig.10 The schematic diagram shows a hardware architecture diagram of a computer device suitable for implementing a method for storing and reading object data according to Embodiment 5 of the present application. DETAILED DESCRIPTION

[0054] In order to make the purpose, technical solutions and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not intended to limit the present application. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in the field without making creative work are within the scope of protection of the present application.

[0055] It should be noted that the descriptions involving "first", "second", etc. in the embodiments of the present application are only for descriptive purposes and cannot be understood as indicating or implying their relative importance or implicitly indicating the number of technical features indicated. Therefore, the features defined as "first" and "second" may explicitly or implicitly include at least one of the features. In addition, the technical solutions between the various embodiments can be combined with each other, but they must be based on the ability of ordinary technicians in the field to implement them. When the combination of technical solutions is contradictory or cannot be implemented, it should be deemed that such combination of technical solutions does not exist and is not within the scope of protection required by this application.

[0056] In the prior art, object storage systems manage data in the form of objects. When data is stored in a device, the data storage location is marked with metadata. Generally, multiple copies are provided for storage or stored through EC and other solutions. If the data loses relevant information, the lost data can be restored by reading the copy or EC calculation method.

[0057] However, this solution of multi-copy storage or EC storage cannot guarantee the security of data after partial data loss or tampering during storage, only for the entire data block; moreover, for data with verification requirements, it is necessary to read the entire data storage to calculate the entire block check bit; the metadata used to identify data storage information is too large, and the memory space occupied by massive data will increase.

[0058] In view of this, the present application aims to propose a storage method for object data, by creating header information for the data to be stored; dividing the data to be stored according to a preset size to obtain one or more data blocks; generating a check value corresponding to each data block, and adding the check value to the header of the data block; storing the header information and each data block after adding the check value in a storage device. Thus, by storing the data as multiple data blocks of preset sizes and storing the check value corresponding to each data block, it is possible to accurately determine the data security and terminate the remaining data access in advance when there are problems such as local data being maliciously tampered with or storage device failure causing data to be reset to zero; data consistency check can be performed on part of the data without reading the entire data, saving IO bandwidth and data transmission; for a section of data, it is possible to directly determine whether it is valid data through the header information.

[0059] Moreover, metadata information storage can be lightweight and metadata information can be restored in the event that all metadata is lost.

[0060] This application provides multiple embodiments to further introduce the storage and reading solutions of object data, please refer to the following for details.

[0061] In the description of the present application, it should be understood that the numerical labels before the steps do not indicate the order in which the steps are executed, but are only used to facilitate the description of the present application and to distinguish each step, and therefore should not be understood as a limitation on the present application.

[0062] The following is an explanation of the terms used in this application:

[0063] Object storage: A technology for storing and managing data in an unstructured format called objects.

[0064] EC: Erasure Coding is a storage technology that adds m copies of data to n copies of original data, and can restore the original data through any n copies of data among the n+m copies. If n+m copies of data are distributed on different nodes of the storage system, then if any node failure is less than or equal to m (m copies of data are invalid), the original data can be restored through other remaining data, thus achieving the purpose of not affecting the business.

[0065] Offset: The offset of the data in the storage unit relative to the head position.

[0066] CRC32: A widely used CRC (Cyclic Redundancy Check) algorithm that verifies data integrity by converting a variable-length string into a fixed-size string.

[0067] Range: The user can pass in the start and end positions of the uploaded data and request a small section of the data that they need.

[0068] Figure 1 The following schematic diagram shows an environmental application diagram according to an embodiment of the present application. Figure 1 As shown:

[0069] The computer device 10000 can be connected to the client 30000 via the network 20000 .

[0070] The computer device 10000 can provide services, such as network debugging, or return the storage of object data, read result data to the client 30000, etc.

[0071] Computer device 10000 may be located in a data center such as a single location, or distributed in different geographical locations (e.g., in multiple locations). Computer device 10000 may provide services via one or more networks 20000. Network 20000 includes various network devices, such as routers, switches, multiplexers, hubs, modems, bridges, repeaters, firewalls, proxy devices, and / or the like. Network 20000 may include physical links, such as coaxial cable links, twisted pair cable links, fiber optic links, combinations thereof, and the like. Network 20000 may include wireless links, such as cellular links, satellite links, Wi-Fi links, and the like.

[0072] Computer device 10000 can be implemented by one or more computing nodes. One or more computing nodes may include virtualized computing instances. Virtualized computing instances may include virtual machines, such as simulations of computer systems, operating systems, servers, etc. The computing nodes may load virtual machines based on virtual images and / or other data defining specific software (e.g., operating systems, dedicated applications, servers) for simulation. As the demand for different types of processing services changes, different virtual machines may be loaded and / or terminated on one or more computing nodes. A hypervisor may be implemented to manage the use of different virtual machines on the same computing node.

[0073] The client 30000 may be configured to access the content and services of the computer device 10000. The client 30000 may include any type of electronic device, such as a mobile device, a tablet device, a laptop computer, a workstation, a virtual reality device, a gaming device, a set-top box, a digital streaming device, a vehicle terminal, a smart TV, a set-top box, and the like.

[0074] The client 30000 may output (eg, display, render, present) the storage of the object data, the read result data, etc. to the user.

[0075] The network debugging solution will be introduced below through multiple embodiments. The solution can be implemented by the computer device 10000.

[0076] Embodiment 1

[0077] Figure 2 The flowchart of the object data storage method according to the first embodiment of the present application is schematically shown. It includes steps S202-S208, wherein:

[0078] Step S202, creating header information for the data to be stored;

[0079] In a preferred embodiment of the present application, the header information includes a unique identification code of the data, a check value corresponding to the header information, a data validity flag and a data size. Among them, the unique identification code ID of the data is used to uniquely identify the data to be stored. The check value corresponding to the header information is used to verify the integrity of the header information, and the check value can be CRC32 or some other data check value, which is not specifically limited in the embodiment of the present application. The data validity flag mark is used to verify the validity of the data. The data size is used to indicate the size of the data.

[0080] Step S204, dividing the data to be stored into pieces according to a preset size to obtain one or more data blocks;

[0081] The preset size is a preset data segment size, such as 64k. The preset size can be set as needed, and the embodiment of the present application does not impose any specific restrictions on this.

[0082] In this embodiment, for the data to be stored, the data to be stored can be divided into one or more data blocks according to the preset size. For example, the preset size is 64k, and when the data to be stored is less than 64k, the data is directly determined as one data block; when the data to be stored is greater than or equal to 64k, it is divided into multiple data blocks, each data block is 64k, and the tail of the data less than 64k is directly used as a data block.

[0083] Step S206, generating a check value corresponding to each data block, and adding the check value to the header of the data block;

[0084] In this embodiment, a corresponding check value may be generated for each data block obtained by segmentation, such as generating a CRC32 cyclic redundancy check 32, and then the check value generated for the data block is added to the header of the data block.

[0085] Step S208: storing the header information and each data block after adding the check value in a storage device.

[0086] In this embodiment, the generated header information and each data block after adding the check value are stored in the storage device.

[0087] like Figure 3 A schematic diagram of a data structure for storing data is shown, wherein each data includes header information and one or more data blocks, the header information includes id (unique identification code of data), CRC32 (check value corresponding to header information), mark (data validity mark) and size (data size), and each data block includes CRC (check value of data block) and 64K data content. Therefore, when the data to be stored needs to be read later, the data block can be checked according to the check value corresponding to each data block in the data to be stored to ensure the security of data after partial data loss or tampering; moreover, it can avoid the need to read the complete data storage and calculate the whole block check bit for data with verification requirements.

[0088] In a preferred embodiment of the present application, step S208 may include the following steps:

[0089] The header information and each data block after adding the check value are stored in a storage device.

[0090] Specifically, after writing the data to be stored into the memory space of the storage device, the system may not save the data immediately. By calling the Fsync function, a certain amount of data blocks in the memory space can be directly stored in the storage device. When the data blocks are stored in the storage device, the header information and check value of each data block will be stored.

[0091] Several optional embodiments are provided below to optimize the storage and reading methods of the object data, as follows:

[0092] In a preferred embodiment of the present application, step S204 may include the following steps:

[0093] Apply for a memory space of the preset size from a storage device; write the data to be stored into the memory space of the preset size in sequence, and truncate the data when the memory space of the preset size is filled with the data to be stored; return to execute the step of applying for the memory space of the preset size from the storage device until the memory space of the preset size is not filled with the data to be stored, then output one or more data blocks that have been segmented.

[0094] In this embodiment, a memory space of a preset size is applied for from a storage device; the data to be stored is sequentially written into the applied memory space of the preset size, and when the data to be stored fills up the memory space of the preset size, the data is truncated; the step of applying for a memory space of a preset size from the storage device is returned to execute until the memory space of the preset size is not filled up by the data to be stored, and then one or more data blocks that are divided are output.

[0095] like Figure 4 A flow chart of a method for storing object data is shown.

[0096] In a preferred embodiment of the present application, the method further includes:

[0097] Reading the header information corresponding to the current data from the storage device in sequence;

[0098] In the case where it is determined according to the header information that the current data is valid, generating metadata information corresponding to the current data, and writing the metadata information into the preset metadata information library;

[0099] Determine the position of the header information corresponding to the next data according to the data size in the header information corresponding to the current data, and determine the next data as the current data, return to execute the step of reading the header information corresponding to the current data from the storage device in sequence, until all the data in the storage device is read, and then output the preset metadata information library.

[0100] When saving data, in order to facilitate locating the storage location of the saved data to be stored, it is necessary to create a preset metadata information library for these data, and the preset metadata information library is used to mark the storage location of the data.

[0101] In this embodiment, the header information corresponding to the current data is obtained by reading from the storage device in sequence; when it is determined that the current data is valid according to the header information, metadata information corresponding to the current data is generated, and the metadata information is written into the preset metadata information library; then, the position of the header information corresponding to the next data is determined according to the data size in the header information, and the next data is determined as the current data, and the step of reading from the storage device in sequence to obtain the header information corresponding to the current data is returned to execute until all the data in the storage device is read, and the preset metadata information library is output.

[0102] In addition, when it is determined based on the header information that the current data is valid, it is possible to directly jump to the metadata storing the next data. Specifically, the position of the header information corresponding to the next data can be determined based on the data size in the header information corresponding to the current data, and the next data can be determined as the current data, and the step of returning to read the header information corresponding to the current data from the storage device in sequence can be executed.

[0103] In this embodiment, the maintenance can directly maintain the preset metadata information base according to the header information corresponding to the data, which can lighten the metadata information storage, and the metadata information can be restored in the case of complete metadata loss. Figure 5 A flow chart of restoring a preset metadata information library is shown.

[0104] Embodiment 2

[0105] Figure 6 The flowchart of the object data storage method according to the first embodiment of the present application is schematically shown. It includes steps S602-S608, wherein:

[0106] Step S602, in response to a read request for first data, obtaining header information corresponding to the first data;

[0107] The first data is the data that needs to be read currently. In this embodiment, when a read request for the first data is received, the read request for the first data can be responded to, and the header information corresponding to the first data can be obtained.

[0108] Specifically, the header information may include a unique identification code of the data, a check value corresponding to the header information, a data validity flag, and a data size. Among them, the unique identification code ID of the data is used to uniquely identify the data. The check value corresponding to the header information is used to verify the integrity of the header information. The check value can be CRC32 or some other data check value, which is not specifically limited in the embodiment of the present application. The data validity flag mark is used to verify the validity of the data. The data size is used to indicate the size of the data.

[0109] In a preferred embodiment of the present application, after step S602, the method may further include the following steps:

[0110] Whether the first data is valid is determined according to the check value corresponding to the header information and the data validity flag.

[0111] In this embodiment, whether the first data is valid can be determined based on the check value and data validity flag corresponding to the header information. If the first data is determined to be valid, the subsequent step 604 can be executed; if the first data is determined to be invalid, the process is directly exited without executing the subsequent steps. Specifically, a check value (such as CRC32) of the header information can be generated based on the header information of the read first data, and then the generated check value is compared with the check value recorded in the header information. If the two check values ​​are the same, it means that the data is valid. If the two check values ​​are different, it means that the data is invalid.

[0112] Step S604, when it is determined according to the header information that the first data is valid, determining the start position and the end position of reading the first data according to the range information included in the read request;

[0113] In this embodiment, when it is determined that the first data is valid according to the header information, the range information can be further extracted from the read request, and then the start position and the end position of reading the first data are determined according to the range information. The range information is used to pass the start position and the end position to request a small piece of data required therein. In the HTTP request, the range information can be Range information, and the data of the specified range / area is obtained through the Range request header.

[0114] Step S606, reading one or more data blocks in the first data according to the start position and the end position; wherein each data block has a one-to-one corresponding check value;

[0115] In this embodiment, one or more data blocks in the first data are read according to the start position and the end position; wherein each data block has a one-to-one corresponding check value. In the process of reading the data block, the data block can be checked according to the check value corresponding to each data block. If the check passes, the data block continues to be read until the end position is read. If the check fails, the data reading process can be directly terminated.

[0116] Step S608: When the data block passes the verification according to the verification value, the one or more data blocks are sent to the client.

[0117] In this embodiment, if the data block is verified according to the verification value, the one or more data blocks are sent to the client. If the data block is verified according to the verification value, a message indicating that the data reading fails can be returned to the client.

[0118] In a preferred embodiment of the present application, step S608 may include the following steps:

[0119] Stripping the check value from the one or more data blocks; and sending the one or more data blocks after stripping the check value to the client.

[0120] In this embodiment, when sending data blocks to the client, the check values ​​in each data block may be stripped, and then the data blocks stripped of the check values ​​are sent to the client.

[0121] Several optional embodiments are provided below to optimize the storage and reading methods of the object data, as follows:

[0122] In a preferred embodiment of the present application, step S606 may include the following steps:

[0123] A data block is obtained by reading from the first data according to the starting position; the data block is verified according to the verification value corresponding to the data block; if the data block passes the verification, the step of reading from the first data according to the starting position to obtain the data block is returned to execute until the end position is read, and one or more data blocks read from the first data are output.

[0124] In this embodiment, a data block is obtained by reading from the first data according to the starting position, and then the data block is verified according to the verification value corresponding to the data block; when the verification of the data block passes, the step of reading from the first data according to the starting position to obtain the data block is returned to execute until the end position is read, and one or more data blocks read from the first data are output.

[0125] In a preferred embodiment of the present application, the method further includes:

[0126] When the verification of the data block fails, the reading of the data block from the first data is stopped.

[0127] In this embodiment, if the verification of the data block fails, it means that the data block is incomplete or damaged, and the reading of the data block from the first data can be stopped. If the disk bit is reversed, the storage device fails, the data is overwritten or maliciously modified, etc., which will cause data segmentation detection errors, the segmented data will have a check value error problem, and the data reading can be terminated greatly in advance.

[0128] In a preferred embodiment of the present application, step S602 may include the following steps:

[0129] In response to a read request for first data, a storage location of the first data is determined according to a preset metadata information library; and header information corresponding to the first data is obtained according to the storage location.

[0130] The preset metadata information library is used to mark the storage location of the data. In response to a read request for the first data, the storage location of the first data is determined according to the preset metadata information library, and then the header information corresponding to the first data is obtained according to the storage location. Figure 7 A flow chart of a method for reading object data is shown.

[0131] Embodiment 3

[0132] Figure 8 A block diagram of a storage device for object data according to Embodiment 3 of the present application is schematically shown, and the storage device for object data can be divided into one or more program modules, and one or more program modules are stored in a storage medium and executed by one or more processors to complete the embodiment of the present application. The program module referred to in the embodiment of the present application refers to a series of computer program instruction segments that can perform specific functions. The following description will specifically introduce the functions of each program module in the embodiment of the present application.

[0133] like Figure 8 As shown, the object data storage device 800 may include the following modules:

[0134] A header information creation module 810, used to create header information for data to be stored;

[0135] A data segmentation module 820 is used to segment the data to be stored according to a preset size to obtain one or more data blocks;

[0136] A check value generation module 830, configured to generate a check value corresponding to each data block and add the check value to the header of the data block;

[0137] The data storage module 840 is used to store the header information and each data block after adding the check value into a storage device.

[0138] In a preferred embodiment of the present application, the header information includes a unique identification code of the data, a check value corresponding to the header information, a data validity flag and a data size.

[0139] In a preferred embodiment of the present application, the data segmentation module 820 includes:

[0140] A memory space application submodule, used to apply for the memory space of the preset size from a storage device;

[0141] A data truncation submodule, used for sequentially writing the data to be stored into the memory space of the preset size, and truncating the data when the memory space of the preset size is filled with the data to be stored;

[0142] The data block output submodule is used to return to the step of applying for the preset size of memory space from the storage device until the data to be stored does not fill up the preset size of memory space, and then output the divided one or more data blocks.

[0143] In a preferred embodiment of the present application, the data storage module 840 includes:

[0144] The data storage submodule is used to store the header information and each data block after adding the check value into a storage device.

[0145] In a preferred embodiment of the present application, the device further includes a preset metadata information base generation module, which is used to:

[0146] Reading the header information corresponding to the current data from the storage device in sequence;

[0147] In the case where it is determined according to the header information that the current data is valid, generating metadata information corresponding to the current data, and writing the metadata information into the preset metadata information library;

[0148] Determine the position of the header information corresponding to the next data according to the data size in the header information corresponding to the current data, and determine the next data as the current data, return to execute the step of reading the header information corresponding to the current data from the storage device in sequence, until all the data in the storage device is read, and then output the preset metadata information library.

[0149] Embodiment 4

[0150] Fig. 9 A block diagram of an object data reading device according to Embodiment 4 of the present application is schematically shown, and the object data reading device can be divided into one or more program modules, and one or more program modules are stored in a storage medium and executed by one or more processors to complete the embodiment of the present application. The program module referred to in the embodiment of the present application refers to a series of computer program instruction segments that can complete specific functions. The following description will specifically introduce the functions of each program module in the embodiment of the present application.

[0151] like Fig. 9 As shown, the object data reading device 900 may include the following modules:

[0152] A header information acquisition module 910, configured to acquire header information corresponding to the first data in response to a read request for the first data;

[0153] A position determination module 920, configured to determine a start position and an end position of reading the first data according to range information included in the read request, when it is determined that the first data is valid according to the header information;

[0154] A data block reading module 930, configured to read one or more data blocks in the first data according to the start position and the end position; wherein each data block has a one-to-one corresponding check value;

[0155] The data sending module 940 is configured to send the one or more data blocks to the client if the data block passes the verification according to the verification value.

[0156] In a preferred embodiment of the present application, the header information includes a unique identification code of the data, a check value corresponding to the header information, a data validity flag and a data size; the device further includes:

[0157] The data validity judgment module is used to judge whether the first data is valid according to the check value corresponding to the header information and the data validity flag.

[0158] In a preferred embodiment of the present application, the data block reading module 930 is specifically used for:

[0159] Reading a data block from the first data according to the starting position;

[0160] Verifying the data block according to the verification value corresponding to the data block;

[0161] When the data block is verified to be passed, the step of reading the data block from the first data according to the starting position is returned to be executed until the end position is read, and one or more data blocks read from the first data are output.

[0162] In a preferred embodiment of the present application, the device further comprises:

[0163] The reading stop module is used to stop reading the data block from the first data when the verification of the data block fails.

[0164] In a preferred embodiment of the present application, the data sending module 940 includes:

[0165] A check value stripping submodule, used for stripping the check value in the one or more data blocks;

[0166] The data sending submodule is used to send one or more data blocks after stripping the check value to the client.

[0167] In a preferred embodiment of the present application, the header information acquisition module 910 includes:

[0168] A storage location determination submodule, configured to determine, in response to a read request for first data, a storage location of the first data according to a preset metadata information library;

[0169] The header information acquisition submodule is used to acquire the header information corresponding to the first data according to the storage location.

[0170] Embodiment 5

[0171] Fig.10 The hardware architecture diagram of a computer device 10000 suitable for implementing the object data storage and reading method according to the fifth embodiment of the present application is schematically shown. In this embodiment, the computer device 10000 is a device that can automatically perform numerical calculations and / or information processing according to pre-set or stored instructions. For example, it can be a smart phone, a tablet computer, a laptop computer, a desktop computer, a rack server, a blade server, a tower server or a cabinet server (including a FEN independent server, or a server cluster composed of multiple servers), etc. Fig.10 As shown, the computer device 10000 includes at least but is not limited to: a memory 10010, a processor 10020, and a network interface 10030 that can communicate with each other through a system bus. Among them:

[0172] The memory 10010 includes at least one type of computer-readable storage medium, and the readable storage medium includes a flash memory, a hard disk, a multimedia card, a card-type memory (e.g., an SD or DX memory, etc.), a random access memory (RAM), a static random access memory (SRAM), a read-only memory (ROM), an electrically erasable programmable read-only memory (EEPROM), a programmable read-only memory (PROM), a magnetic memory, a magnetic disk, an optical disk, etc. In some embodiments, the memory 10010 may be an internal storage module of the computer device 10000, such as a hard disk or a memory of the computer device 10000. In other embodiments, the memory 10010 may also be an external storage device of the computer device 10000, such as a plug-in hard disk equipped on the computer device 10000, a smart memory card (Smart Media Card, referred to as SMC), a secure digital (Secure Digital, referred to as SD) card, a flash card, etc. Of course, the memory 10010 may also include both the internal storage module of the computer device 10000 and its external storage device. In this embodiment, the memory 10010 is generally used to store the operating system and various application software installed in the computer device 10000, such as the storage of object data, program code of the reading method, etc. In addition, the memory 10010 can also be used to temporarily store various data that have been output or will be output.

[0173] In some embodiments, the processor 10020 may be a central processing unit (CPU), a controller, a microcontroller, a microprocessor, or other data processing chips. The processor 10020 is generally used to control the overall operation of the computer device 10000, such as performing control and processing related to data interaction or communication with the computer device 10000. In this embodiment, the processor 10020 is used to run the program code stored in the memory 10010 or process data.

[0174] The network interface 10030 may include a wireless network interface or a wired network interface, and the network interface 10030 is generally used to establish a communication link between the computer device 10000 and other computer devices. For example, the network interface 10030 is used to connect the computer device 10000 to an external terminal through a network, and to establish a data transmission channel and a communication link between the computer device 10000 and the external terminal. The network may be a wireless or wired network such as an intranet, the Internet, the Global System of Mobile communication (GSM), Wideband Code Division Multiple Access (WCDMA), 4G network, 5G network, Bluetooth, Wi-Fi, etc.

[0175] It should be pointed out that Fig.10 Only a computer device having components 10010 - 10030 is shown, but it should be understood that implementation of all of the components shown is not a requirement, and more or fewer components may be implemented instead.

[0176] In this embodiment, the storage and reading methods of the object data stored in the memory 10010 can also be divided into one or more program modules and executed by one or more processors (processor 10020 in this embodiment) to complete the embodiment of the present application.

[0177] Embodiment 6

[0178] The embodiment of the present application further provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the steps of the method for storing and reading object data in the embodiment are implemented.

[0179] In this embodiment, the computer-readable storage medium includes flash memory, hard disk, multimedia card, card-type memory (for example, SD or DX memory, etc.), random access memory (RAM), static random access memory (SRAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), programmable read-only memory (PROM), magnetic memory, disk, optical disk, etc. In some embodiments, the computer-readable storage medium can be an internal storage unit of a computer device, such as a hard disk or memory of the computer device. In other embodiments, the computer-readable storage medium can also be an external storage device of a computer device, such as a plug-in hard disk equipped on the computer device, a smart memory card (Smart Media Card, referred to as SMC), a secure digital (Secure Digital, referred to as SD) card, a flash card, etc. Of course, the computer-readable storage medium can also include both the internal storage unit of the computer device and its external storage device. In this embodiment, the computer-readable storage medium is generally used to store the operating system and various application software installed on the computer device, such as the storage of object data in the embodiment, the program code of the reading method, etc. In addition, the computer-readable storage medium can also be used to temporarily store various types of data that have been output or are to be output.

[0180] Obviously, those skilled in the art should understand that the modules or steps of the above-mentioned embodiments of the present application can be implemented by a general computing device, they can be concentrated on a single computing device, or distributed on a network composed of multiple computing devices, and optionally, they can be implemented by a program code executable by a computing device, so that they can be stored in a storage device and executed by the computing device, and in some cases, the steps shown or described can be executed in a different order from that herein, or they can be made into individual integrated circuit modules, or multiple modules or steps therein can be made into a single integrated circuit module for implementation. In this way, the embodiments of the present application are not limited to any specific combination of hardware and software.

[0181] The above are only preferred embodiments of the present application, and are not intended to limit the patent scope of the present application. Any equivalent structure or equivalent process transformation made using the contents of the present application specification and drawings, or directly or indirectly applied in other related technical fields, are also included in the patent protection scope of the present application.

Claims

1. A method for storing object data, characterized in that: include: Create header information for the data to be stored; Splitting the data to be stored according to a preset size to obtain one or more data blocks; Generate a check value corresponding to each data block, and add the check value to the header of the data block; The header information and each data block after adding the check value are stored in a storage device.

2. The object data storage method according to claim 1, characterized in that: The step of dividing the data to be stored into one or more data blocks according to a preset size includes: Applying for a memory space of the preset size from a storage device; Writing the data to be stored into the memory space of the preset size in sequence, and truncating the data when the memory space of the preset size is filled with the data to be stored; Return to the step of applying for the preset size of memory space from the storage device until the data to be stored does not fill up the preset size of memory space, and then output the divided one or more data blocks.

3. The object data storage method according to claim 1, characterized in that: The step of storing the header information and each data block after adding the check value into a storage device comprises: The header information and each data block after adding the check value are stored in a storage device.

4. The object data storage method according to claim 1, characterized in that: The method further comprises: Reading the header information corresponding to the current data from the storage device in sequence; In the case where it is determined according to the header information that the current data is valid, generating metadata information corresponding to the current data, and writing the metadata information into the preset metadata information library; Determine the position of the header information corresponding to the next data according to the data size in the header information corresponding to the current data, and determine the next data as the current data, return to execute the step of reading the header information corresponding to the current data from the storage device in sequence, until all the data in the storage device is read, and then output the preset metadata information library.

5. A method for reading object data, characterized in that: include: In response to a read request for first data, obtaining header information corresponding to the first data; In a case where it is determined according to the header information that the first data is valid, determining a start position and an end position for reading the first data according to range information included in the read request; Read one or more data blocks in the first data according to the start position and the end position; wherein each data block has a one-to-one corresponding check value; In a case where the data block passes verification according to the verification value, the one or more data blocks are sent to the client.

6. The method for reading object data according to claim 5, characterized in that: The header information includes a unique identification code of the data, a check value corresponding to the header information, a data validity flag and a data size; After the step of obtaining the header information corresponding to the first data, the method further includes: Whether the first data is valid is determined according to the check value corresponding to the header information and the data validity flag.

7. The method for reading object data according to claim 5, characterized in that: The step of reading one or more data blocks in the first data according to the start position and the end position includes: Reading a data block from the first data according to the starting position; Verifying the data block according to the verification value corresponding to the data block; When the data block is verified to be passed, the step of reading the data block from the first data according to the starting position is returned to be executed until the end position is read, and one or more data blocks read from the first data are output.

8. A storage device for object data, characterized in that: include: A header information creation module, used to create header information for data to be stored; A data segmentation module, used to segment the data to be stored according to a preset size to obtain one or more data blocks; A check value generation module, used to generate a check value corresponding to each data block, and add the check value to the header of the data block; The data storage module is used to store the header information and each data block after adding the check value into a storage device.

9. A device for reading object data, characterized in that: include: A header information acquisition module, configured to acquire header information corresponding to the first data in response to a read request for the first data; a position determination module, configured to determine a start position and an end position of reading the first data according to range information included in the read request, when the first data is determined to be valid according to the header information; A data block reading module, configured to read one or more data blocks in the first data according to the start position and the end position; wherein each data block has a one-to-one corresponding check value; The data sending module is used to send the one or more data blocks to the client when the data block passes the verification according to the verification value.

10. A computer device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the computer program, it is used to implement the steps of the object data storage and reading method described in any one of claims 1 to 4 or 5 to 7.

11. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and the computer program can be executed by at least one processor so that the at least one processor performs the steps of the object data storage and reading method described in any one of claims 1 to 4 or 5 to 7.