Additional storage method and system based on file segmentation
Through the use of file segmented writing and file format headers, the problem of long data export time in security equipment testing is solved, fast viewing and efficient storage are achieved, and work efficiency is improved.
Patent Information
- Application Number
- CN202411318460.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-20
- Publication Date
- 2024-12-27
AI Technical Summary
During the testing of security equipment, the test cycle is long and the amount of detection data is large, which makes it take a long time to export the test data each time, affecting work efficiency.
Using file segmented append storage method, it is stored through file segmented writing. There is no need to repeatedly export stored data during each export. Data append is used to ensure the integrity and speed of stored data. Check.
It realizes quick viewing of test data, improves work efficiency, reduces export time and resource consumption, avoids rewriting of the entire file, and maintains data integrity and historical records continuity.
Smart Images

Figure CN119201852A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of data storage, and in particular to an additional storage method based on file segmentation and an additional storage system based on file segmentation. Background Art
[0002] At present, in the process of security equipment testing, there are problems such as long testing cycle and large amount of detection data. When exporting test data for viewing and analysis during the test process, all current test data needs to be exported and stored. Since each test data export process takes a long time and needs to be re-exported when it is exported again, each time the test data is viewed and analyzed, it takes a long time to wait, which makes the work of viewing and analyzing test results low. Summary of the invention
[0003] The present invention aims to solve at least one of the technical problems in the above-mentioned technology to a certain extent. To this end, one purpose of the present invention is to propose an additional storage method based on file segmentation, which performs additional storage by writing files in a segmented manner. Each time the storage is exported, there is no need to repeatedly export the stored data, and the stored data will not be affected, thereby realizing quick viewing of test data and improving work efficiency.
[0004] To achieve the above-mentioned purpose, an embodiment of the present invention proposes an additional storage method based on file segmentation, comprising the following steps: determining whether a storage file exists; if a storage file does not exist, creating a storage file and defining the basic attributes and structure of the storage file, wherein, when defining the structure of the storage file, defining an independent file format header for each data segment; generating a new file format header, and storing the acquired data to be stored in the data segment corresponding to the new file format header according to the corresponding data type, and updating the information of the new file format header; if a storage file exists and it is determined that the file format header stored last time ends without abnormality, generating a new file format header at the end of the file format header stored last time; acquiring the additional data to be stored according to the information of the file format header stored last time, storing the additional data to be stored in the data segment corresponding to the new file format header according to the corresponding data type, and updating the information of the new file format header.
[0005] According to the additional storage method based on file segmentation of an embodiment of the present invention, first, it is determined whether a storage file exists; then, if the storage file does not exist, a storage file is created, and the basic attributes and structure of the storage file are defined, wherein, when defining the structure of the storage file, an independent file format header is defined for each data segment; then, a new file format header is generated, and the acquired data to be stored is stored in the data segment corresponding to the new file format header according to the corresponding data type, and the information of the new file format header is updated; then, if the storage file exists, and it is determined that the file format header stored last time ends without abnormality, a new file format header is generated at the end of the file format header stored last time; finally, the additional data to be stored is acquired according to the information of the file format header stored last time, and the additional data to be stored is stored in the data segment corresponding to the new file format header according to the corresponding data type, and the information of the new file format header is updated; thus, additional storage is performed by file segmentation writing, and each time the storage is exported, there is no need to repeatedly export the stored data, and the stored data will not be affected, thereby realizing quick viewing of test data and improving work efficiency.
[0006] In addition, the additional storage method based on file segmentation proposed in the above embodiment of the present invention may also have the following additional technical features:
[0007] Optionally, if the last stored file format header has an abnormal end, find the tail of the last normal end and read the corresponding file format header; determine whether there is an abnormality in the file format header; if there is an abnormality, delete the abnormal file format header and the corresponding appended data so that the data can be re-appended and stored; if there is no abnormality, repair the formatted data according to the information in the file format header.
[0008] Optionally, formatted data repair is performed according to the information of the file format header, including: traversing the data according to the storage data definition format; judging the continuity and validity of the traversed data to analyze data anomalies and perform corresponding repairs.
[0009] Optionally, acquiring the additional data to be stored according to the information of the file format header stored last time includes: finding the corresponding file location information according to the information of the file format header stored last time, and acquiring the additional data to be stored according to the file location information.
[0010] Optionally, the information of each file format header includes the file header length, the data length corresponding to the file header, the starting storage positions of multiple data types, the number of data items corresponding to the starting storage position of each data type, and whether it ends normally.
[0011] To achieve the above-mentioned purpose, an embodiment of the first aspect of the present invention proposes an additional storage system based on file segmentation, including: a first judgment module, used to judge whether a storage file exists; a creation module, used to create a storage file if the storage file does not exist, and define the basic attributes and structure of the storage file, wherein, when defining the structure of the storage file, an independent file format header is defined for each data segment; a storage module, used to generate a new file format header, and store the acquired data to be stored in the data segment corresponding to the new file format header according to the corresponding data type, and update the information of the new file format header; a second judgment module, used to generate a new file format header at the end of the file format header stored last time if the storage file exists and it is judged that the file format header stored last time has no abnormal end; an additional storage module, used to obtain the additional data to be stored according to the information of the file format header stored last time, store the additional data to be stored in the data segment corresponding to the new file format header according to the corresponding data type, and update the information of the new file format header.
[0012] In addition, the file segmentation-based additional storage system proposed in the above embodiment of the present invention may also have the following additional technical features:
[0013] Optionally, it also includes: an exception handling module, which is used to find the tail of the last normal end and read the corresponding file format header if the file format header stored last time has an abnormal end; determine whether there is an exception in the file format header; if there is an exception, delete the abnormal file format header and the corresponding appended data so as to re-append the data and store it; if there is no exception, repair the formatted data according to the information in the file format header.
[0014] Optionally, the exception handling module is further used to traverse the data according to the storage data definition format; determine the continuity and validity of the traversed data to analyze the abnormal situation of the data and perform corresponding repairs.
[0015] Optionally, the additional storage module is further used to find corresponding file location information according to the information of the file format header stored last time, and obtain the additional data to be stored according to the file location information.
[0016] Optionally, the information of each file format header includes the file header length, the data length corresponding to the file header, the starting storage positions of multiple data types, the number of data items corresponding to the starting storage position of each data type, and whether it ends normally. BRIEF DESCRIPTION OF THE DRAWINGS
[0017] Figure 1 A schematic diagram of a flow chart of an additional storage method based on file segmentation according to an embodiment of the present invention;
[0018] Figure 2 A schematic diagram of a file format structure according to an embodiment of the present invention;
[0019] Figure 3 A schematic diagram of the format structure of a file format header according to an embodiment of the present invention;
[0020] Figure 4 A schematic diagram of a flow chart of an additional storage method based on file segmentation according to another embodiment of the present invention;
[0021] Figure 5 4 is a block diagram of an additional storage system based on file segmentation according to an embodiment of the present invention. DETAILED DESCRIPTION
[0022] Embodiments of the present invention are described in detail below, examples of which are shown in the accompanying drawings, wherein the same or similar reference numerals throughout represent the same or similar elements or elements having the same or similar functions. The embodiments described below with reference to the accompanying drawings are exemplary and are intended to be used to explain the present invention, and should not be construed as limiting the present invention.
[0023] In order to better understand the above technical solution, exemplary embodiments of the present invention will be described in more detail below with reference to the accompanying drawings. Although exemplary embodiments of the present invention are shown in the accompanying drawings, it should be understood that the present invention can be implemented in various forms and should not be limited by the embodiments described herein. On the contrary, these embodiments are provided to enable a more thorough understanding of the present invention and to fully convey the scope of the present invention to those skilled in the art.
[0024] In order to better understand the above technical solution, the above technical solution will be described in detail below in conjunction with the accompanying drawings and specific implementation methods.
[0025] Figure 1 FIG. 1 is a flow chart of a method for appending storage based on file segmentation according to an embodiment of the present invention. Figure 1 As shown, the method comprises the following steps:
[0026] S101, determining whether there is a storage file.
[0027] That is to say, if test data needs to be written, it is necessary to first determine whether the storage file exists. If so, it means that it is not the first time to write test data in the storage task. If not, it means that it is the first time to write test data.
[0028] S102: If the storage file does not exist, create a storage file and define basic attributes and structure of the storage file. When defining the structure of the storage file, define an independent file format header for each data segment.
[0029] It should be noted that creating a file refers to the process of initializing a new file, which includes allocating necessary storage space for the file and defining the basic properties and structure of the file.
[0030] Specifically, a file can be created according to actual needs. For example, when defining a file structure, it is necessary to define the internal structure of the file, such as a file format header (including metadata, such as creation time, file size, data type, etc.), data segments, and possible indexes or directory structures. When allocating storage space, the system will allocate a certain amount of space on the storage medium for the new file. This space may be pre-allocated in the file system or dynamically allocated when writing data. The file format header is an important part of the file, which includes the metadata of the file. In file segmentation storage, the file format header may include information about each data segment, such as the starting position, size, type, etc. of the segment. When creating a file, the access rights of the file can also be set as needed to determine which users or programs can read, write or execute the file. For some applications, it may be necessary to reserve a certain amount of space in the file for future data appending to optimize performance and reduce disk fragmentation. If the file is large or needs to be retrieved frequently, an index may be created when the file is created to speed up data retrieval. In some systems, the operation of creating a file may be recorded in a log file to facilitate tracking the creation history of the file and maintaining the integrity of the file system. If necessary, the file can be encrypted when it is created to protect the stored data from unauthorized access.
[0031] That is to say, when creating a file, by defining an independent file format header for each data segment, each data segment can be easily identified and processed in subsequent append operations without affecting other data; this structure makes the file more flexible and efficient when appending new data, and is also easy to manage and maintain.
[0032] S103, generating a new file format header, and storing the acquired data to be stored in a data segment corresponding to the new file format header according to the corresponding data type, and updating the information of the new file format header.
[0033] That is to say, when the test data is written to the storage for the first time, a new file format header needs to be generated first, and all the current data to be stored is obtained according to the write request, and then stored in the data segment corresponding to the new file format header in sequence according to the data type of the data to be stored, and the information of the new file format header is updated.
[0034] Specifically, Figure 2 As shown, the file format consists of multiple file format headers and corresponding file data to form multiple data segments, thereby realizing segmented storage; in addition, as Figure 3As shown, the information of each file format header includes the file header length, the data length corresponding to the file header, the starting storage positions of multiple data types, the number of data items corresponding to the starting storage position of each data type, and whether it ends normally; when storing the data to be stored, it can be stored in the corresponding data segment according to the data type to the corresponding file data, and after the storage is completed, the statistical data is written into the file format header (including time, frame data, data frame corresponding to face detection data), etc.
[0035] S104: If there is a stored file, and it is determined that the last stored file format header ends without abnormality, a new file format header is generated at the end of the last stored file format header.
[0036] That is to say, when performing a second export or multiple exports, the currently exported data is obtained based on the information in the file format header of the last export as a judgment, so that the regenerated un-exported data can be exported, wherein an empty file format header is first written and appended to the end of the file, and then the un-exported data is appended to the file according to the data type, and the file format header is updated after the statistical data.
[0037] Among them, the statistical data is segmented statistics. In the segmented statistics, the entire file is divided into multiple file format headers, and each file format header data can be regarded as an independent and complete file. By reading all the file format headers for file statistics, the corresponding data volume of the entire file can be determined. For example: face recognition data volume (such as closing eyes, blowing and snoring data volume): according to the statistical data of each file header, the face recognition data volume of the entire file can be obtained; the overall file data volume: according to each file format header, the data volume of each segment of the file is obtained and the data volume of the entire file can be obtained; quickly obtain a record: according to the conditions, it can be obtained by reading from each file format header to the corresponding position of the specified record; through the segmentation mechanism, the risk of increasing data pollution and storing data can be reduced, while increasing file scalability and compatibility.
[0038] It should be noted that when performing a second export or multiple exports, the file format header can also be modified according to the current test situation, such as increasing or decreasing the export test data type to adapt to the scenario where the entire data needs to be re-exported because some data was not exported.
[0039] S105, acquiring the additional data to be stored according to the information of the file format header stored last time, storing the additional data to be stored in the data segment corresponding to the new file format header according to the corresponding data type, and updating the information of the new file format header.
[0040] It should be noted that the above-mentioned appending refers to adding new data at the end of an existing file, rather than overwriting or rewriting existing data in the file; wherein, the append operation will not change the data already existing in the file, but will add new content to the end of the file, and the new data will be added to the end of the file in chronological order or a specific logical order; for applications that require frequent write operations, appending storage can improve efficiency because it avoids rewriting the entire file and reduces disk I / O operations; since existing data will not be overwritten, appending storage helps maintain data integrity and the continuity of historical records; appending storage makes file management simpler because there is no need to frequently create new files or delete old files, only to add data to the end of existing files; the present application uses appending storage to optimize the data export process, reduce the time for repeated data exports, and improve work efficiency. By only appending new data segments each time an export is made, rather than re-exporting the entire data set, the time and resource consumption required for export can be significantly reduced.
[0041] As an embodiment, obtaining the additional data to be stored according to the information of the file format header stored last time includes: finding the corresponding file location information according to the information of the file format header stored last time, and obtaining the additional data to be stored according to the file location information.
[0042] In addition, if the last stored file format header has an abnormal end, find the tail of the last normal end and read the corresponding file format header; determine whether there is an abnormality in the file format header; if there is an abnormality, delete the abnormal file format header and the corresponding appended data so that the data can be re-appended and stored; if there is no abnormality, repair the formatted data according to the information in the file format header.
[0043] That is to say, after the new file format header and data are written into the file and cause the file to be abnormal, the file is repaired. There are two types of abnormal repair: end deletion mechanism (the file format header has an abnormality) and end repair mechanism (the file format header does not have an abnormality, but the data has an abnormality). Among them, the end deletion mechanism: directly deletes the abnormal appended segment. The end repair mechanism: repairs part of the data according to the file format header and can even achieve lossless repair.
[0044] As an embodiment, formatted data repair is performed according to the information of the file format header, including: traversing the data according to the storage data definition format; judging the continuity and validity of the traversed data to analyze the abnormality of the data and perform corresponding repairs.
[0045] It should be noted that when judging the continuity of traversed data, it is possible to judge whether the data is arranged in the expected order or pattern. For example, in time series data, the timestamps should be continuous; continuity problems may indicate data loss or recording errors; when judging the validity of traversed data, it is possible to ensure that the data meets specific standards or rules; in addition, the data style can be confirmed according to its own business, which can ensure that the data processing process is closely connected with business needs and improve the efficiency and quality of data processing; when abnormalities are found in the continuity and validity of data, abnormal data recording, abnormal location, data repair, update verification rules, etc. can be performed, among which abnormal data recording is to record the detailed information of the abnormality, including the type of abnormality, the time of occurrence, the data involved, etc. Abnormal location is to determine the specific location where the abnormality occurs, whether it is a specific point in the data traversal process or a specific part of the data itself. Data repair is to try to repair the data according to the type of abnormality. This may include correcting the data format, filling missing values, recalculating erroneous data, etc. Updating verification rules is to update the data verification rules according to the abnormal situation to prevent similar abnormalities from occurring in the future.
[0046] In addition, in order to better understand the above technical solution, as a specific embodiment, Figure 4 As shown, the following steps are included:
[0047] S1. Determine whether the file exists. If not, execute step S2; if it exists, execute step S8.
[0048] S2. Create a file.
[0049] S3. Generate a new file format header and write it into the file.
[0050] S4. Obtain corresponding update data information.
[0051] S5. Finish writing one type of data.
[0052] S6. Update the format header file.
[0053] S7, judging whether the writing is completed. If it is completed, the process ends; if it is not completed, the process returns to step S5.
[0054] S8. Read all format headers.
[0055] S9, judging whether the last file format header ends abnormally. If it ends normally, executing step S3; if it ends abnormally, executing step S10.
[0056] S10, enter the repair process and find the last normal ending.
[0057] S11, read the last written file format header.
[0058] S12: Determine whether the format header is abnormal. If yes, execute step S13; if no, execute step S14.
[0059] S13, delete the abnormal format header and the subsequent additional data, and return to step S3.
[0060] S14, repair the formatted data according to the format header (re-count and determine the validity data), complete the update to the current file format header, and return to step S3.
[0061] That is to say, the test equipment performs long-term testing and stores test data. Export data for review at regular intervals. Each time the data is exported, it is segmented and stored according to the file segmentation format. The corresponding storage statistics are counted in the file format header. Each time an export is performed, the current amount of data and data type to be exported are obtained based on the file format header data. When the file export is abnormal, the file is repaired according to the file format header. After the repair is completed, a new file data export can be continued. At the same time, the newly written data will not affect the already exported data. Each time an export is performed, the export file format header can be modified and expanded to increase or decrease the export data type as required.
[0062] It should be noted that the data to be stored in the above embodiment is test data, wherein a test device is used to capture an image, and the image is sent to various detection algorithms to obtain basic features such as the face and eyes. The device uses a face detection algorithm to detect face information, including face scores, face positions, 106 feature points, etc., and stores them by frame; that is, the test data includes face scores, face positions, 106 feature points, etc.
[0063] In summary, according to the additional storage method based on file segmentation of an embodiment of the present invention, first, it is determined whether a storage file exists; then, if the storage file does not exist, a storage file is created, and the basic attributes and structure of the storage file are defined, wherein, when defining the structure of the storage file, an independent file format header is defined for each data segment; then, a new file format header is generated, and the acquired data to be stored is stored in the data segment corresponding to the new file format header according to the corresponding data type, and the information of the new file format header is updated; then, if a storage file exists, and it is determined that the file format header stored last time ends without abnormality, a new file format header is generated at the end of the file format header stored last time; finally, the additional data to be stored is obtained according to the information of the file format header stored last time, and the additional data to be stored is stored in the data segment corresponding to the new file format header according to the corresponding data type, and the information of the new file format header is updated; thus, additional storage is performed by file segmentation writing, and each time the storage is exported, there is no need to repeatedly export the stored data, and the stored data will not be affected, thereby realizing quick viewing of test data and improving work efficiency.
[0064] In order to implement the above embodiment, the embodiment of the present invention also proposes an additional storage system based on file segmentation, such as Figure 5 As shown, the file segmentation-based additional storage system includes: a first judgment module 10 , a creation module 20 , a storage module 30 , a second judgment module 40 and an additional storage module 50 .
[0065] Among them, the first judgment module 10 is used to determine whether there is a storage file; the creation module 20 is used to create a storage file if there is no storage file, and define the basic attributes and structure of the storage file, wherein, when defining the structure of the storage file, an independent file format header is defined for each data segment; the storage module 30 is used to generate a new file format header, and store the acquired data to be stored in the data segment corresponding to the new file format header according to the corresponding data type, and update the information of the new file format header; the second judgment module 40 is used to generate a new file format header at the end of the file format header stored last time if there is a storage file and it is determined that the file format header stored last time has no abnormal end; the additional storage module 50 is used to obtain the additional data to be stored according to the information of the file format header stored last time, store the additional data to be stored in the data segment corresponding to the new file format header according to the corresponding data type, and update the information of the new file format header.
[0066] As an embodiment, it also includes an exception handling module 60 for finding the tail of the last normal end and reading the corresponding file format header if the last stored file format header has an abnormal end; judging whether there is an abnormality in the file format header; if there is an abnormality, deleting the abnormal file format header and the corresponding appended data so as to re-append the data for storage; if there is no abnormality, repairing the formatted data according to the information in the file format header.
[0067] As an embodiment, the exception handling module 60 is also used to traverse the data according to the storage data definition format; determine the continuity and validity of the traversed data to analyze the abnormal situation of the data and perform corresponding repairs.
[0068] As an embodiment, the additional storage module 50 is further used to find the corresponding file location information according to the information of the file format header stored last time, and obtain the additional data to be stored according to the file location information.
[0069] As an embodiment, the information of each file format header includes the file header length, the data length corresponding to the file header, the starting storage positions of multiple data types, the number of data items corresponding to the starting storage position of each data type, and whether it ends normally.
[0070] It should be noted that the above description and examples of the additional storage method based on file segmentation are also applicable to the additional storage system based on file segmentation in this embodiment, and will not be described in detail here.
[0071] Those skilled in the art will appreciate that embodiments of the present invention may be provided as methods, systems, or computer program products. Therefore, the present invention may take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Moreover, the present invention may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0072] The present invention is described with reference to flowcharts and / or block diagrams of methods, devices (systems), and computer program products according to embodiments of the present invention. It should be understood that each process and / or block in the flowchart and / or block diagram, as well as the combination of processes and / or blocks in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0073] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.
[0074] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process in the computer or other programmable device. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.
[0075] It should be noted that in the claims, any reference signs placed between brackets shall not be construed as limiting the claims. The word "comprising" does not exclude the presence of components or steps not listed in the claim. The word "a" or "an" preceding a component does not exclude the presence of a plurality of such components. The invention may be implemented by means of hardware comprising several different components and by means of a suitably programmed computer. In a unit claim enumerating several means, several of these means may be embodied by the same item of hardware. The use of the words first, second, and third etc. does not indicate any order. These words may be interpreted as names.
[0076] Although the preferred embodiments of the present invention have been described, those skilled in the art may make other changes and modifications to these embodiments once they have learned the basic creative concept. Therefore, the appended claims are intended to be interpreted as including the preferred embodiments and all changes and modifications that fall within the scope of the present invention.
[0077] Obviously, those skilled in the art can make various changes and modifications to the present invention without departing from the spirit and scope of the present invention. Thus, if these modifications and variations of the present invention fall within the scope of the claims of the present invention and their equivalents, the present invention is also intended to include these modifications and variations.
[0078] In the description of the present invention, it should be understood that the terms "first" and "second" are used for descriptive purposes only and should not be understood as indicating or implying relative importance or implicitly indicating the number of technical features indicated. Thus, a feature defined as "first" or "second" may explicitly or implicitly include one or more of the features. In the description of the present invention, the meaning of "plurality" is two or more, unless otherwise clearly and specifically defined.
[0079] In the present invention, unless otherwise clearly specified and limited, the terms "installed", "connected", "connected", "fixed" and the like should be understood in a broad sense, for example, it can be a fixed connection, a detachable connection, or an integral connection; it can be a mechanical connection or an electrical connection; it can be a direct connection or an indirect connection through an intermediate medium, it can be the internal connection of two elements or the interaction relationship between two elements. For ordinary technicians in this field, the specific meanings of the above terms in the present invention can be understood according to specific circumstances.
[0080] In the present invention, unless otherwise clearly specified and limited, a first feature being "above" or "below" a second feature may mean that the first and second features are in direct contact, or the first and second features are in indirect contact through an intermediate medium. Moreover, a first feature being "above", "above" or "above" a second feature may mean that the first feature is directly above or obliquely above the second feature, or simply means that the first feature is higher in level than the second feature. A first feature being "below", "below" or "below" a second feature may mean that the first feature is directly below or obliquely below the second feature, or simply means that the first feature is lower in level than the second feature.
[0081] In the description of this specification, the description with reference to the terms "one embodiment", "some embodiments", "example", "specific example", or "some examples" etc. means that the specific features, structures, materials or characteristics described in conjunction with the embodiment or example are included in at least one embodiment or example of the present invention. In this specification, the schematic representation of the above terms should not be understood as necessarily referring to the same embodiment or example. Moreover, the specific features, structures, materials or characteristics described may be combined in any one or more embodiments or examples in a suitable manner. In addition, those skilled in the art may combine and combine the different embodiments or examples described in this specification and the features of the different embodiments or examples, unless they are contradictory.
[0082] Although the embodiments of the present invention have been shown and described above, it is to be understood that the above embodiments are exemplary and are not to be construed as limitations of the present invention. A person skilled in the art may change, modify, replace and vary the above embodiments within the scope of the present invention.
Claims
1. A method for additional storage based on file segmentation, characterized in that: The following steps are involved: Determine whether a storage file exists; If the storage file does not exist, create the storage file and define basic attributes and structure of the storage file, wherein when defining the structure of the storage file, define an independent file format header for each data segment; Generate a new file format header, store the acquired data to be stored in a data segment corresponding to the new file format header according to the corresponding data type, and update the information of the new file format header; If there is a stored file, and it is determined that the last stored file format header ends without abnormality, a new file format header is generated at the end of the last stored file format header; The additional data to be stored is obtained according to the information of the file format header stored last time, the additional data to be stored is stored in the data segment corresponding to the new file format header according to the corresponding data type, and the information of the new file format header is updated.
2. The file segmentation-based additional storage method according to claim 1, characterized in that: If the last stored file format header has an abnormal end, find the tail of the last normal end and read the corresponding file format header; Determine whether there is an abnormality in the file format header; If there is an exception, the abnormal file format header and the corresponding appended data are deleted so that the data can be appended and stored again; If there is no abnormality, the formatted data is repaired according to the information of the file format header.
3. The file segmentation-based additional storage method according to claim 2, characterized in that: Performing formatted data repair according to the information of the file format header includes: Traverse the data according to the storage data definition format; Determine the continuity and validity of the traversed data to analyze data anomalies and make corresponding repairs.
4. The file segmentation-based additional storage method according to claim 1, characterized in that: Acquiring the additional data to be stored according to the information of the file format header stored last time, including: finding the corresponding file position information according to the information of the file format header stored last time, and acquiring the additional data to be stored according to the file position information.
5. The method for additional storage based on file segmentation according to any one of claims 1 to 4, characterized in that: The information of each file format header includes the file header length, the data length corresponding to the file header, the starting storage positions of multiple data types, the number of data items corresponding to the starting storage position of each data type, and whether it ends normally.
6. An additional storage system based on file segmentation, characterized in that: include: A first determination module, used to determine whether a storage file exists; A creation module, used for creating a storage file if the storage file does not exist, and defining basic attributes and structure of the storage file, wherein when defining the structure of the storage file, an independent file format header is defined for each data segment; A storage module, used to generate a new file format header, store the acquired data to be stored in a data segment corresponding to the new file format header according to the corresponding data type, and update the information of the new file format header; The second judgment module is used to generate a new file format header at the end of the file format header stored last time if there is a stored file and it is judged that the file format header stored last time has no abnormal end; The additional storage module is used to obtain additional data to be stored according to the information of the file format header stored last time, store the additional data to be stored in the data segment corresponding to the new file format header according to the corresponding data type, and update the information of the new file format header.
7. The file segmentation-based additional storage system according to claim 6, characterized in that: Also includes: The exception handling module is used to find the tail of the last normal end and read the corresponding file format header if the last stored file format header has an abnormal end; and determine whether the file format header has an abnormality; If there is an exception, the abnormal file format header and the corresponding appended data are deleted so that the data can be appended and stored again; If there is no abnormality, the formatted data is repaired according to the information of the file format header.
8. The file segmentation-based additional storage system according to claim 7, characterized in that: The exception handling module is also used to: Traverse the data according to the storage data definition format; determine the continuity and validity of the traversed data to analyze data anomalies and make corresponding repairs.
9. The file segmentation-based additional storage system according to claim 6, characterized in that: The additional storage module is also used for: The corresponding file location information is found according to the information of the file format header stored last time, and the additional data to be stored is obtained according to the file location information.
10. The file segmentation-based additional storage system according to any one of claims 6 to 9, characterized in that: The information of each file format header includes the file header length, the data length corresponding to the file header, the starting storage positions of multiple data types, the number of data items corresponding to the starting storage position of each data type, and whether it ends normally.
Citation Information
Patent Citations
File uploading method, system and device and readable storage medium
CN110708355A
Data reading method and device, storage medium and electronic device
CN111625502A
Binary programming format loading method and system under embedded system
CN113590227A
Cited By
Segmented data storage method and device, computer equipment and storage medium
CN120872260A