File processing method, device, equipment and storage medium
By creating configuration data in virtual files, data blocks can be read and transferred directly from different storage media, solving the problems of complex data management and wasted storage space in existing technologies, and achieving efficient data acquisition and management.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- 深圳市英维克软件技术有限公司
- Filing Date
- 2023-11-03
- Publication Date
- 2026-06-26
Smart Images

Figure CN117331888B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of data processing technology, and in particular to a file processing method, apparatus, device, and computer-readable storage medium. Background Technology
[0002] Embedded devices are increasingly used in various fields. To adapt to different application scenarios, we sometimes need to read some operating data or firmware information of the device for analysis. For the management of data stored in the device, we often use some file management systems to manage this data to facilitate subsequent read and write management. However, this method also has certain limitations. For example, the file to be read can only be a file that has been written in advance, or the content of the file to be read must be data content located in the same storage medium. Sometimes, the data we need to read is scattered in different storage media and reassembled into a file for reading, which is usually difficult for general file management systems to do. Summary of the Invention
[0003] To address the existing technical problems, embodiments of the present invention provide a file processing method, system, device, and computer-readable storage medium that eliminates the need for data migration, saves storage space, and improves the speed of data acquisition.
[0004] Firstly, a file processing method is provided, including:
[0005] Obtain a data request, wherein the data request includes at least one data block identifier and the order of each data block;
[0006] Get the storage location of each data block;
[0007] Based on the storage location of each obtained data block, configuration data is created to indicate the virtual file for each set of data blocks;
[0008] According to the configuration data, in the order of each data block, the data block corresponding to each data block identifier is read sequentially from the storage location of each data block, and each read data block is transmitted sequentially to the file receiving object corresponding to the data request, so that the file receiving object obtains a virtual file containing at least one data block.
[0009] Secondly, a document processing apparatus is provided, comprising:
[0010] The acquisition module is used to acquire data requests, wherein the data request includes at least one data block identifier and the order of each data block;
[0011] The acquisition module is also used to acquire the storage location of each data block;
[0012] The creation module is used to create configuration data for a virtual file that indicates the set of data blocks corresponding to the at least one data block identifier, based on the storage location and order of each data block.
[0013] The transmission module is used to read the data block corresponding to each data block identifier from the storage location of each data block in sequence according to the order of each data block, and transmit each read data block in sequence to the file receiving object corresponding to the data request, so that the file receiving object obtains a virtual file containing at least one data block.
[0014] Thirdly, an electronic device is provided, including a memory and a processor, wherein the memory stores a computer program, and when the computer program is executed by the processor, the processor causes the processor to perform the steps of the file processing method provided in the embodiments of this application.
[0015] Fourthly, a storage medium is provided that stores a computer program, which, when executed by a processor, causes the processor to perform the steps of the file processing method provided in the embodiments of this application.
[0016] In the above embodiments, by configuring configuration data including the storage locations and order of multiple data blocks requested, and then reading each data block sequentially from its storage location according to the order of the multiple data blocks in a file read / write manner, and then transmitting each data block sequentially to the file receiving object corresponding to the data request, the multiple data blocks are transmitted to the user in a file read / write manner. There is no need to combine multiple data blocks into a total file. The data itself is not migrated in the whole process; it is just sent to the user in the form of a copy, thereby saving storage space, eliminating the need for data synthesis, and improving the speed of data acquisition. Attached Figure Description
[0017] Figure 1 This is a diagram illustrating the application environment of a file processing method in one embodiment.
[0018] Figure 2 This is a flowchart of a file processing method in one embodiment;
[0019] Figure 3 This is a schematic diagram of the data block storage location in a file processing method according to one embodiment;
[0020] Figure 4 This is a schematic diagram of the sub-configuration data structure in a file processing method of one embodiment;
[0021] Figure 5 This is a schematic diagram of the configuration data in a file processing method in one embodiment;
[0022] Figure 6 This is a flowchart illustrating the creation of configuration data in a file processing method according to one embodiment;
[0023] Figure 7 This is a schematic diagram of the transmission of data blocks in a file processing method according to one embodiment;
[0024] Figure 8 This is a schematic diagram of the upgrade procedure in a file processing method in one embodiment;
[0025] Figure 9 This is a schematic diagram of a document processing device in one embodiment;
[0026] Figure 10 This is a schematic diagram of a file processing device in one embodiment. Detailed Implementation
[0027] The technical solution of the present invention will be further described in detail below with reference to the accompanying drawings and specific embodiments.
[0028] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this invention pertains. The terminology used herein in the specification of this invention is for the purpose of describing particular embodiments only and is not intended to limit the scope of the invention. The term "and / or" as used herein includes any and all combinations of one or more of the associated listed items.
[0029] In the following description, the expression “some embodiments” refers to a subset of all possible embodiments. However, it should be understood that “some embodiments” can be the same subset or different subsets of all possible embodiments and can be combined with each other without conflict.
[0030] See Figure 1This diagram illustrates the application environment of a file processing method in one embodiment. The data system in this application environment diagram may include a business system 100 and a file processing system 200. The business system 100 and the file processing system 200 transmit data. The business system 100 requests data from the file processing system 200. The file processing system 200 processes the required data according to four stages of file processing and sends it to the business system 100. These four stages include a file opening stage 201, a file reading / writing stage 202, a file verification stage 203, and a file closing stage 204. The business system 100 may include, but is not limited to, firmware receiving services for upgrades, data export services, etc. The file processing system 200 has an interface for the business system 100 to call. When the business system 100 has external data requirements, the file processing system 200 can process these external data requirements, obtain the data needed by the external system using the file processing method in this embodiment, and send it to the business system 100. The data needed by the business system 100 may reside in different storage media. The business system 100 and the file processing system 200 may refer to logically independent software. The business system 100 and the file processing system 200 can be located simultaneously or partially in the same electronic device, or they can be located in different electronic devices, as long as the business system 100 and the file processing system 200 can communicate with each other.
[0031] Please see Figure 2 This is a flowchart illustrating a file processing method provided in an embodiment of this application. The file processing method is applied in an electronic device and includes the following steps:
[0032] S11, Data Request.
[0033] In this embodiment, the data request indicates that the business system 100 requests data from the file processing system 200. The data request may include one or more data blocks. The data request includes the requested data blocks and their order; that is, it includes at least one data block, at least one data block identifier, and the order of the data blocks corresponding to each data block identifier within the at least one data block. Each data block has a data block identifier, which identifies the content stored in the data block. The data block identifier includes, but is not limited to, the data block name, data block number, data type, etc. For example, for the log data of lower-level machine A, the data block identifier is "Lower-level machine A+ log". The data block identifier facilitates subsequent searching for the storage location of the data block in the recorded data, etc. The order of the data blocks determines the order of subsequent data block transmission, so that the business system 100 obtains a virtual file.
[0034] In some embodiments, the business system 100 provides a user interface with data options. Users can select desired data blocks through these options, which include, but are not limited to, checkboxes, dropdown menus, etc. The user interface can also specify the order of the selected data blocks. The business system 100 sends data requests based on the user's selected data blocks and their specified order. Thus, the requested data blocks are the selected data blocks, and the order of the requested data blocks is the specified order. For example, when displaying log data on the user interface, which includes data options such as running logs, alarm logs, and operation logs, if a user wants to obtain log data from a specific lower-level machine, they can select the running log, alarm log, and operation log. If the user selects the alarm log, operation log, and running log of lower-level machine A in sequence, the requested data blocks are the alarm log, operation log, and running log of lower-level machine A, respectively. The order of the requested data blocks is: first the alarm log of lower-level machine A, then the operation log of lower-level machine A, and finally the running log of lower-level machine A.
[0035] In some embodiments, the business system 100 acquires requirement data input by the user through a user interface. This requirement data may be a piece of voice or text, etc. The business system 100 uses a text recognition method to identify the requested data blocks from the input requirement data and determines the order of the requested data blocks based on their order of appearance in the requirement data. For example, if the user inputs "I need log data from lower-level machine A and lower-level machine B", the requested data blocks include log data from lower-level machine A and log data from lower-level machine B. The order of the requested data blocks is: first, the log data from lower-level machine A is transmitted, then the log data from lower-level machine B is transmitted.
[0036] S12. Obtain the storage location of each data block.
[0037] In this embodiment, the electronic device stores many blocks of data. The storage location of each block of data is recorded, including the data block identifier, storage location, and size of each block. The data block identifier is used to identify each block of data, including but not limited to file number and file name. At least one data block can be multiple data blocks, which can reside in different storage media; for example, some data blocks can be located in flash memory, and some in RAM.
[0038] The storage location includes, but is not limited to, the storage medium where each data block is located, the starting address of the storage medium, and the offset address of each data block relative to its location on the storage medium. For example, such as Figure 3 As shown, Figure 3This is a schematic diagram illustrating the storage location of data blocks in a file processing method according to one embodiment. Data segment A represents one data block, and data segment 2 represents another data block. Data segment A is located in storage medium C, and the storage location of data segment A is offset by address offset1 relative to the starting address Addr1 of storage medium C. Data segment B is located in storage medium D, and the storage location of data segment B is offset by address offset2 relative to the starting address Addr2 of storage medium D. Therefore, the storage location of data A is at address Addr1 + offset1 in storage medium C, and the storage location of data B is at address Addr2 + offset2 in storage medium D.
[0039] S13. Create configuration data based on the storage location of each data block.
[0040] In this embodiment, a virtual file is a collection of all data blocks in at least one data block, that is, a collection of data blocks used to indicate the at least one data block identifier. It is not a real file, but it can still be operated on like a normal file. That is, the virtual file is still divided into four stages according to the operation steps of a file, namely the file opening stage 201, the file reading and writing stage 202, the file verification stage 203, and the file closing stage 204.
[0041] After receiving a data request from business system 100, the electronic device enters the file opening stage. During this stage, before creating configuration data for acquiring the virtual file based on the storage location and order of each data block, the electronic device determines whether the data in the request is a pre-stored file or a virtual file that needs to be generated online. If it's determined that the data in the request is a virtual file that needs to be generated online, configuration data for acquiring the virtual file will be created. If the data in the request is a pre-stored file, it can be read directly. Specifically, the device can search the record data based on the data block identifier of at least one data block in the data request. If the record data contains data block identifiers for all data blocks, the data in the request is a pre-stored file. If the record data does not contain data block identifiers for all data blocks, then a virtual file needs to be generated online. For example, if a user inputs "I need the log data of lower-level machine A and lower-level machine B", and there is a file named "Log data of lower-level machine A and lower-level machine B" in the log data, then the file named "Log data of lower-level machine A and lower-level machine B" can be directly retrieved and sent to the business system 100.
[0042] In other embodiments, if the data block requested in the data request is a single data block, it is determined to be a pre-stored file. For example, if the requested data block is the operation log of lower-level machine A, since the operation log of lower-level machine A is already in the recorded data, it is a pre-stored file, and there is no need to combine multiple data blocks. If the data block requested in the data request is multiple data blocks, it is determined to be a virtual file that needs to be generated online. For example, if the requested data block is the alarm log, operation log, and operation log of lower-level machine A, then a virtual file needs to be generated online based on the three data blocks of lower-level machine A.
[0043] For virtual files that need to be generated online, configuration data for retrieving the virtual file needs to be generated during the file opening stage, based on the storage location and order of each data block. This configuration data includes, but is not limited to: sub-configuration data for each data block, quantity record data indicating the number of data blocks in the at least one data block, and file offset data. The sub-configuration data for each data block stores the storage location, file size, and data block identifier of each data block; the file offset data stores the byte position of each data block in the virtual file to be generated and the order of each data block.
[0044] Each data block corresponds to a sub-configuration data, which has a preset sub-configuration data structure. This structure includes, but is not limited to: the storage medium where the data block is located, the data block identifier, the data block's checksum, the sub-configuration data identifier, the offset address relative to the storage medium, and the file size. The sub-configuration data identifier identifies the sub-configuration data and includes, but is not limited to, a sub-configuration data number. For example, the order of the data blocks can be used as the sub-configuration data identifier for each data block. Configuration data, sub-configuration data, and file offset data can be presented in file format, including but not limited to common file formats such as tables, Word documents, and TXT files.
[0045] For example, a data block A named "Log of Lower-Level Machine A" is located in storage medium B, with a starting address of 300 relative to storage medium B, a file size of 2000 bytes, and its checksum is identified by CRC1. This data block A's sequence number among multiple data blocks is 3. Therefore, the sub-configuration data identifier can be sub-configuration data 3. For example... Figure 4 As shown, this is the sub-configuration data of preset data block A obtained according to the sub-configuration data structure. The sub-configuration data is presented in the form of sub-tables.
[0046] The quantity record data is primarily used to store the number of data blocks. In other embodiments, the quantity record data can also store other information about each data block, such as its identifier and size. Configuring sub-configuration data for each data block facilitates the sequential reading of its storage location during data transmission, thereby enabling timely data transfer.
[0047] File offset data is used to determine the byte position of each data block in the virtual file and the order of each data block. File offset data includes, but is not limited to, the data block identifier, the byte position of the data block in the virtual file, the file size of the data block, and the order of the data blocks, etc.
[0048] For example, a virtual file is a collection of data blocks A, B, and C. The order of these three data blocks in the virtual file is: data block C, data block A, and data block B. Data block A is 100 bytes in size, data block B is 200 bytes in size, and data block C is 250 bytes in size. Therefore, the collection of data blocks A, B, and C should be a 550-byte data set. Relative to these 550 bytes, the byte positions of data block C are bytes 1 to 250, data block A is bytes 251 to 350, and data block B is bytes 351 to 550. Creating file offset data facilitates the sequential transmission of data blocks at each byte position during the data transmission phase.
[0049] In some embodiments, sub-configuration data and quantity record data can be stored in a location mapping data. The representation of configuration data can be diverse, adding other reserved configuration items, etc., based on the configuration data described above. For example... Figure 5 The diagram shown illustrates configuration data, which includes file offset data, file data, and location mapping data. The file data includes block identifiers for each data block, such as file 1, file 2, file n, etc. Figure 5 In this system, configuration data is presented in the form of configuration tables, quantity record data is presented in the form of a master table, sub-configuration data is presented in the form of sub-tables, and location mapping data includes the master table, sub-tables for file 1, sub-tables for file 2, and so on. File offset data indicates the byte position of each file in the virtual file.
[0050] S14. According to the configuration data, in the order of each data block, read the data block corresponding to each data block identifier from the storage location of each data block in sequence, and transmit each read data block to the file receiving object corresponding to the data request in sequence.
[0051] In this embodiment, during the file transmission phase, each data block is read sequentially from the configuration data according to its offset address relative to the storage medium through the file read / write interface. Then, each read data block is sent sequentially to the file receiving object. After each data block is transmitted, the file receiving object receives a virtual file indicating the set of all data blocks. This virtual file is not a real file, but it can still be operated on like a regular file. Specifically, the virtual file is divided into four stages based on the operation steps of a file: file opening stage 201, file read / write stage 202, file verification stage 203, and file closing stage 204.
[0052] In the above embodiments, by configuring configuration data including the storage locations and order of multiple data blocks requested, and then reading each data block sequentially from its storage location according to the order of the multiple data blocks in a file read / write manner, and then transmitting each data block sequentially to the file receiving object corresponding to the data request, the multiple data blocks are transmitted to the user in a file read / write manner. There is no need to combine multiple data blocks into a total file. The data itself is not migrated in the whole process; it is just sent to the user in the form of a copy, thereby saving storage space, eliminating the need for data synthesis, and improving the speed of data acquisition.
[0053] In some embodiments, creating configuration data for retrieving virtual files based on the storage location and order of each data block includes:
[0054] Get the storage location of the current data block;
[0055] If the storage location of the current data block is valid, and the number of current data blocks in the quantity record data is less than a preset value, sub-configuration data of the current data block is generated based on the preset sub-configuration data structure, and the quantity record data is updated.
[0056] If the storage location of the current data block is invalid or the number of current data blocks in the quantity record data is greater than a preset value, an error message is displayed; then the storage location of the next data block is obtained. When the number of current data blocks in the quantity record data is equal to the preset value, the acquisition of the storage location of the data block is stopped.
[0057] Specifically, such as Figure 6 As shown, Figure 6 A flowchart of creating configuration data in a file processing method in one embodiment includes:
[0058] S61. Get the storage location of the current data block.
[0059] S62. Determine if the storage location of the current data block is valid. If the storage location of the current data block is valid, proceed to S63. If the storage location of the current data block is invalid, proceed to S65 and display an error message. Specifically, if the storage location of the current data block can be opened, then the storage location of the current data block is valid. If the storage location of the current data block cannot be opened, then the storage location of the current data block is invalid.
[0060] S63. Check if the current number of data blocks in the quantity record data is less than a preset value. The preset value represents the total number of data blocks in the data request. If the current number of data blocks is less than the preset value, execute S64. Create sub-configuration data for the current data block and update the quantity record data; if the current number of data blocks is greater than or equal to the preset value, execute S65. Prompt an error.
[0061] In the above embodiments, the storage location of the data block obtained from the recorded data may not be correct. When creating sub-configuration data for a data block, the validity of the data block's storage location is further confirmed. This facilitates notifying the user to check for anomalies when the storage location of a data block is invalid, thereby improving the user experience. Simultaneously, when creating sub-configuration data, the number of files in the quantity recorded data is used to determine whether all sub-configuration data has been created, thereby improving the data retrieval speed.
[0062] In some embodiments, the step of sequentially reading each data block according to the storage location and order of each data block in the configuration data, and transmitting each data block sequentially to the file receiving object corresponding to the data request, so that the file receiving object obtains a virtual file containing the at least one data block, includes:
[0063] Obtain the current data block to be processed according to the order of each data block;
[0064] Obtain the storage location of the current data block from the sub-configuration data of the current data block;
[0065] If the size of the current data block is greater than the preset space, the current sub-data block, which is no larger than the preset space size, is read from the storage location of the current data block using file read / write mode. The current sub-data block is then transferred to the preset space using read / write mode, and then sent to the file receiving object. The process returns to continue reading the current data block. When the number of sub-data blocks transferred is equal to the number of sub-data blocks corresponding to the current data block, the reading of the current data block stops.
[0066] The next data block is processed sequentially according to the order of each data block until the number of data blocks transmitted equals the number of data blocks in the number of records, at which point reading of data blocks stops.
[0067] Optionally, the preset space is a space in random access memory, and the capacity of the preset space is less than or equal to the file size of each data block. Multiple data blocks are located in different or the same storage media, and the data read each time is placed in a space of random access memory, but the capacity of this space is generally preset to be small.
[0068] To conserve storage space, since the preset space is generally small, if a data block is larger than the preset space, it cannot be transmitted all at once. It needs to be divided into multiple sub-blocks and transmitted multiple times to complete the transfer of a single data block. Based on the preset space, each data block is divided into multiple sub-blocks, with each data block corresponding to one sub-block. Thus, each sub-block of a data block also corresponds to a data offset within that sub-block, and the data offset of the sub-block indicates the byte position of its corresponding data block. In the file transfer phase, for a target data block whose size is larger than a preset space, the storage location of the target data block is obtained from the configuration data through the file read / write interface, according to the order of each sub-data block. Then, based on the data offset of the sub-data blocks, a current sub-data block is obtained from the target data block. The size of the current sub-data block is not greater than the preset space size. The read current sub-data block is then placed in the preset space, overwriting the previously read data stored in the preset space. The read current sub-data block is then transferred to the file receiving object. By reading sub-data blocks multiple times in this way, when the number of transferred sub-data blocks is equal to the number of sub-data blocks corresponding to the current data block, reading the current data block stops, and the target data block can be transferred completely. Then, the next data block is processed sequentially according to the order of each data block until all data blocks in the number of records have been transferred.
[0069] like Figure 7 As shown, Figure 7 This is a schematic diagram of data block transmission in a file processing method in one embodiment; the file and file N are stored in different storage locations in the flash memory. When transmitting file 1 to file N, file 1 is divided into multiple sub-data blocks for transmission.
[0070] In the above embodiments, during the data transmission phase, smaller sub-data blocks are read and placed in a smaller preset space each time in a read-write manner, thereby reducing the amount of storage space occupied during data transmission and reducing resource waste.
[0071] In some embodiments, due to communication errors during data transmission, the virtual file received by the business system 100 may be incorrect, therefore, the received virtual file needs to be verified. After transmitting each data block sequentially to the file receiving object corresponding to the data request, the method further includes:
[0072] Receive the configuration data and preset verification data;
[0073] After receiving the data of all data blocks in the at least one data block, the at least one data block in the received virtual file is verified based on the file offset data in the configuration data to obtain the current verification data corresponding to the received virtual file.
[0074] If the current verification data is the same as the preset verification data, it means that reading the virtual file was successful. If the current verification data is the same as the preset verification data, it means that reading the virtual file failed, and the process returns to step S11 to continue executing S12-S14 to obtain the virtual file. If the number of failed attempts to obtain the virtual file exceeds the preset number, an error message indicating that reading the virtual file is abnormal will be displayed.
[0075] During the file verification phase of the virtual file, after the user receives one or more data blocks of the online virtual file through the file read / write interface, a cyclic redundancy check (CRC) calculation is required. The current check data calculated based on all received data blocks needs to be compared with a preset check data. If the results match, the virtual file is considered to have been read successfully; otherwise, it is considered to have failed.
[0076] In the above embodiments, a current verification result is calculated based on all received data blocks to verify whether the received data blocks are erroneous, thereby preventing data transmission errors and improving the accuracy of data transmission.
[0077] In some embodiments, during the file closing phase, after the business system 100 has completed its operation on the virtual file, the online virtual file operation completion flag is set, signifying the completion of one virtual file operation. For example, completing the export of a virtual file signifies the completion of one virtual file operation.
[0078] In some embodiments, the method further includes:
[0079] Obtain upgrade program configuration data and obtain the total program package corresponding to the program configuration data. The upgrade program configuration data includes the burning position of each upgrade program in multiple upgrade programs and the byte position of each upgrade program in the total program package.
[0080] Based on the byte position of each upgrade program in the main program package, the program package of each upgrade program is obtained from the obtained main program package, and the program package of each upgrade program is burned into the burning position of each upgrade program to upgrade the program corresponding to each upgrade program.
[0081] In existing technologies, when upgrading multiple firmware versions of an electronic device, it is necessary to download the upgrade program for each firmware version multiple times, and then sequentially burn each firmware upgrade program into the corresponding firmware. For example, upgrading three firmware versions requires three upgrade programs, and each firmware version is upgraded once, requiring three upgrades. In this embodiment, the upgrade program configuration data includes the burning location of each upgrade program and the byte position of each upgrade program in the total program package. The upgrade program configuration data and the corresponding total program package are downloaded from an upgrade device. Then, based on the byte position of each upgrade program in the total program package, the program package for each upgrade program is obtained from the obtained total program package. The program package for each upgrade program is then burned into the burning location of each upgrade program to upgrade the corresponding program. Figure 8 As shown, the device to be upgraded 801 includes three firmware versions: Firmware A, Firmware B, and Firmware C. The device to be upgraded 801 obtains upgrade program configuration data and a master program package from the upgrade device 802 for upgrading Firmware A, Firmware B, and Firmware C. Then, it retrieves the firmware packages for Firmware A, Firmware B, and Firmware C from the master program package. The firmware package for Firmware A is burned into Firmware A, the firmware package for Firmware B is burned into Firmware B, and the firmware package for Firmware C is burned into Firmware C. This allows multiple firmware versions to be upgraded simultaneously in a single process, eliminating the need for multiple upgrades of different firmware versions and improving user efficiency.
[0082] Please see Figure 9 One embodiment of this application provides a file processing apparatus, comprising: an acquisition module 21, configured to acquire a data request, wherein the data request includes at least one data block and the order of each data block in the at least one data block; the acquisition module 21 is further configured to acquire a data request, wherein the data request includes at least one data block identifier and the order of each data block; a creation module 22 configured to create configuration data for indicating a virtual file containing a set of data blocks corresponding to the at least one data block identifier, based on the acquired storage location of each data block; and a transmission module 23 configured to, based on the configuration data and in the order of each data block, sequentially read the data blocks corresponding to each data block identifier from the storage location of each data block, and sequentially transmit each read data block to a file receiving object corresponding to the data request, so that the file receiving object obtains a virtual file containing the at least one data block.
[0083] Optionally, the configuration data includes sub-configuration data for each data block, quantity record data indicating the number of data blocks in the at least one data block, and file offset data, wherein the sub-configuration data for each data block stores the storage location, file size, and data block identifier of each data block; and the file offset data is used to determine the byte position of each data block in the virtual file.
[0084] Optionally, the creation module 22 is also used to obtain the storage location of the current data block; if the storage location of the current data block is valid, and the number of current data blocks in the quantity record data is less than a preset value, the sub-configuration data of the current data block is generated based on the preset sub-configuration data structure, and the quantity record data is updated.
[0085] If the storage location of the current data block is invalid or the number of current data blocks in the quantity record data is greater than a preset value, an error message is displayed; then the storage location of the next data block is obtained. When the number of current data blocks in the quantity record data is equal to the preset value, the acquisition of the storage location of the data block is stopped.
[0086] Optionally, the transmission module 23 is also used for:
[0087] Obtain the current data block to be processed according to the order of each data block;
[0088] Obtain the storage location of the current data block from the sub-configuration data of the current data block;
[0089] If the size of the current data block is greater than the preset space, the current sub-data block, which is no larger than the preset space size, is read from the storage location of the current data block using file read / write mode. The current sub-data block is then transferred to the preset space using read / write mode, and then sent to the file receiving object. The process returns to continue reading the current data block. When the number of sub-data blocks transferred is equal to the number of sub-data blocks corresponding to the current data block, the reading of the current data block stops.
[0090] The next data block is processed sequentially according to the order of each data block. When the number of data blocks transmitted is equal to the number of data blocks in the number of records, the reading of data blocks is stopped.
[0091] Optionally, the preset space is a space in a random access memory, and the capacity of the preset space is less than or equal to the file size of each data block.
[0092] Optionally, the configuration data further includes preset verification data for verifying the virtual file, and the verification module 24 is used for:
[0093] After transmitting each data block sequentially to the file receiving object corresponding to the data request, the configuration data and preset verification data are received.
[0094] After receiving the data of all data blocks in the at least one data block, the at least one data block in the received virtual file is verified based on the file offset data in the configuration data to obtain the current verification data corresponding to the received virtual file.
[0095] If the current verification data is the same as the preset verification data, it means that the virtual file was read successfully. If the current verification data is the same as the preset verification data, it means that the virtual file was read failed, and the process returns to the step of obtaining the storage location of each data block.
[0096] Optionally, upgrade module 25 is used for:
[0097] Obtain upgrade program configuration data and the data packet corresponding to the program configuration data, wherein the upgrade program configuration data includes the burning location of each upgrade program among multiple upgrade programs;
[0098] Obtain the program package for each upgrade program from the acquired total program data package, and burn the program package for each upgrade program to the burning location of each upgrade program to upgrade the program corresponding to each upgrade program.
[0099] It will be understood by those skilled in the art that Figure 8 The structure of the document processing device does not constitute a limitation on the device itself. Each module can be implemented entirely or partially through software, hardware, or a combination thereof. These modules can be embedded in hardware or independently of the controller in the computer device, or stored in software in the memory of the computer device, so that the controller can invoke and execute the operations corresponding to each module. In other embodiments, the document processing device may include more or fewer modules than illustrated.
[0100] Please see Figure 9 In another aspect of this application, an electronic device is also provided, including a memory 3011 and a processor 3012. The memory 3011 stores a computer program, and when the computer program is executed by the processor, the processor 212 performs the steps of the file processing method provided in any of the above embodiments of this application. The electronic device may include computing devices (e.g., desktop computers, laptop computers, tablet computers, handheld computers, smart speakers, servers, etc.), mobile phones (e.g., smartphones, cordless phones, etc.), wearable devices (e.g., a pair of smart glasses or a smartwatch) or similar devices.
[0101] The processor 3012 is the control center, connecting various parts of the computer device via various interfaces and lines. It executes software programs and / or modules stored in the memory 3011, and calls data stored in the memory 3011 to perform various functions and process data. Optionally, the processor 3012 may include one or more processing cores; preferably, the processor 3012 may integrate an application processor and a modem processor, wherein the application processor mainly handles the operating system, user page, and applications, and the modem processor mainly handles wireless communication. It is understood that the modem processor may not be integrated into the processor 3012.
[0102] The memory 3011 can be used to store software programs and modules. The processor 3012 executes various functional applications and data processing by running the software programs and modules stored in the memory 3011. The memory 3011 may mainly include a program storage area and a data storage area. The program storage area may store the operating system, application programs required for at least one function (such as sound playback function, image playback function, etc.), etc.; the data storage area may store data created according to the use of the computer device, etc. In addition, the memory 3011 may include high-speed random access memory, and may also include non-volatile memory, such as at least one disk storage device, flash memory device, or other volatile solid-state storage device. Accordingly, the memory 3011 may also include a memory controller to provide the processor 3012 with access to the memory 3011.
[0103] In another aspect, this application also provides a storage medium storing a computer program, which, when executed by a processor, causes the processor to perform the steps of the file processing method provided in any of the above embodiments of this application.
[0104] Those skilled in the art will understand that all or part of the processes in the methods provided in the above embodiments can be implemented by a computer program instructing related hardware. The program can be stored in a non-volatile computer-readable storage medium, and when executed, it can include the processes of the embodiments of the above methods. Any references to memory, storage, databases, or other media used in the embodiments provided in this application can include non-volatile and / or volatile memory. Non-volatile memory can include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM), or flash memory. Volatile memory can include random access memory (RAM) or external cache memory. By way of illustration and not limitation, RAM is available in various forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), dual data rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), synchronous link DRAM (SLDRAM), RAMbus direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and RAMbus dynamic RAM (RDRAM), etc.
[0105] The above description is merely a specific embodiment of the present invention, but the scope of protection of the present invention is not limited thereto. Any variations or substitutions that can be easily conceived by those skilled in the art within the technical scope disclosed in the present invention should be included within the scope of protection of the present invention. The scope of protection of the present invention should be determined by the scope of the claims.
Claims
1. A file processing method, characterized in that, include: Obtain a data request, wherein the data request includes at least one data block identifier and the order of each data block; Obtain the storage location of each data block, wherein there are multiple data blocks, and the multiple data blocks are located in different storage media; Based on the storage location of each obtained data block, configuration data is created to indicate the virtual file for each set of data blocks; According to the configuration data, in the order of each data block, the data block corresponding to each data block identifier is read sequentially from the storage location of each data block, and each read data block is transmitted sequentially to the file receiving object corresponding to the data request, so that the file receiving object obtains a virtual file containing at least one data block.
2. The file processing method as described in claim 1, characterized in that, The configuration data includes sub-configuration data for each data block, quantity record data indicating the number of data blocks in the at least one data block, and file offset data. The sub-configuration data for each data block stores the storage location, file size, and data block identifier of each data block. The file offset data is used to determine the byte position of each data block in the virtual file.
3. The file processing method as described in claim 2, characterized in that, The configuration data for creating a virtual file to indicate each set of data blocks, based on the storage location of each acquired data block, includes: If the storage location of the current data block is valid, and the number of current data blocks in the quantity record data is less than a preset value, sub-configuration data of the current data block is generated based on the preset sub-configuration data structure, and the quantity record data is updated. If the storage location of the current data block is invalid, or if the storage location of the current data block is valid and the number of current data blocks in the quantity record data is greater than or equal to a preset value, an error is prompted; then the storage location of the next data block is obtained, and the acquisition of the storage location of the data block is stopped when the number of current data blocks in the quantity record data is equal to the preset value.
4. The document processing method as described in claim 2 or 3, characterized in that, The step of reading the data block corresponding to each data block identifier sequentially from the storage location of each data block according to the configuration data and in the order of each data block, and transmitting each read data block sequentially to the file receiving object corresponding to the data request, so that the file receiving object obtains a virtual file containing at least one data block, includes: Obtain the current data block to be processed according to the order of each data block; Obtain the storage location of the current data block from the sub-configuration data of the current data block; If the size of the current data block is greater than the preset space, the current sub-data block, which is no larger than the preset space size, is read from the storage location of the current data block using file read / write mode. The current sub-data block is then transferred to the preset space using read / write mode, and then sent to the file receiving object. The process returns to continue reading the current data block. When the number of sub-data blocks transferred is equal to the number of sub-data blocks corresponding to the current data block, the reading of the current data block stops. The next data block is processed sequentially according to the order of each data block. When the number of data blocks transmitted is equal to the number of data blocks in the number of records, the reading of data blocks is stopped.
5. The file processing method as described in claim 4, characterized in that, The preset space is a space in the random access memory, and the capacity of the preset space is less than or equal to the file size of each data block.
6. The file processing method as described in claim 1, characterized in that, The configuration data also includes preset verification data for verifying the virtual file. After transmitting each data block sequentially to the file receiving object corresponding to the data request, the method further includes: Receive the configuration data and preset verification data; After receiving the data of all data blocks in the at least one data block, the at least one data block in the received virtual file is verified based on the file offset data in the configuration data to obtain the current verification data corresponding to the received virtual file. If the current verification data is the same as the preset verification data, it means that the virtual file was read successfully. If the current verification data is the same as the preset verification data, it means that the virtual file was read failed, and the process returns to the step of obtaining the storage location of each data block.
7. The file processing method as described in claim 1, characterized in that, The method further includes: Obtain upgrade program configuration data and the data packet corresponding to the program configuration data, wherein the upgrade program configuration data includes the burning location of each upgrade program among multiple upgrade programs; Obtain the program package for each upgrade program from the acquired total program data package, and burn the program package for each upgrade program to the burning location of each upgrade program to upgrade the program corresponding to each upgrade program.
8. A document processing device, characterized in that, include: The acquisition module is used to acquire data requests, wherein the data request includes at least one data block identifier and the order of each data block; The acquisition module is also used to acquire the storage location of each data block, wherein there are multiple data blocks and the multiple data blocks are located in different storage media; The creation module is used to create configuration data for a virtual file that indicates the set of data blocks corresponding to the at least one data block identifier, based on the storage location and order of each data block. The transmission module is used to read the data block corresponding to each data block identifier from the storage location of each data block in sequence according to the order of each data block, and transmit each read data block in sequence to the file receiving object corresponding to the data request, so that the file receiving object obtains a virtual file containing at least one data block.
9. An electronic device, characterized in that, The method includes a memory and a processor, the memory storing a computer program that, when executed by the processor, causes the processor to perform the steps of the method as described in any one of claims 1 to 7.
10. A computer-readable storage medium storing a computer program, characterized in that, When the computer program is executed by a processor, the processor performs the steps of the method as described in any one of claims 1 to 7.