Data storage method, device, equipment, medium, program product
Patent Information
- Application Number
- CN202410833476.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-25
- Publication Date
- 2026-09-08
- Estimated Expiration
- 2044-06-25
AI Technical Summary
[0002]随着芯片功能的不断增加,芯片的引脚数量也随之增加,由此在对芯片测试过程中,通过引脚采集的测试数据的大小也随之增大,如果将这些测试数据直接存储到计算设备的内存中,会使得计算设备的内存资源很快枯竭,从而导致计算设备无法正常工作
[0007]In another aspect of this application, a computer-readable storage medium is provided, on which a computer program is stored, which, when executed by a processor, implements the above-described data storage method.
Smart Images

Figure CN118708553B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the fields of data storage technology and data retrieval technology, and in particular to a data storage method, apparatus, device, medium, and program product. Background Technology
[0002] As chip functionality increases, the number of chip pins also increases. Consequently, the amount of test data collected through the pins during chip testing also increases. If this test data is directly stored in the memory of the computing device, the memory resources of the computing device will be quickly exhausted, causing the computing device to malfunction. Summary of the Invention
[0003] To address the aforementioned technical problems, embodiments of this application provide a data storage method, apparatus, device, medium, and program product.
[0004] One aspect of this application provides a data storage method comprising: in response to detecting the presence of data to be processed in a first memory, creating a temporary file in a second memory, wherein the first memory and the second memory are different memories; parsing the data to be processed to obtain a target data stream corresponding to the data to be processed, wherein the target data stream includes a plurality of target data blocks; creating a query identifier for each of the target data blocks, wherein each query identifier corresponds to a storage location of the corresponding target data block in the temporary file; writing the target data stream into the temporary file, and deleting the target data stream from the first memory.
[0005] Another aspect of this application provides a data storage device, comprising: a temporary file creation module, configured to create a temporary file in a second memory in response to detecting the presence of data to be processed in a first memory, wherein the first memory and the second memory are different memories; a data parsing module, configured to parse the data to be processed to obtain a target data stream of the data to be processed, wherein the target data stream includes a plurality of target data blocks; a query identifier creation module, configured to create a query identifier for each of the target data blocks, wherein each query identifier corresponds to a storage location of the corresponding target data block in the temporary file; and a data writing module, configured to write the target data stream into the temporary file and delete the target data stream from the first memory.
[0006] In another aspect of this application, an electronic device is provided, comprising: a memory for storing a computer program; and a processor for executing the computer program stored in the memory, wherein when the computer program is executed, it implements the above-described data storage method.
[0007] In another aspect of this application, a computer-readable storage medium is provided, on which a computer program is stored, which, when executed by a processor, implements the above-described data storage method.
[0008] In another aspect of the embodiments of this application, a computer program product is provided, including computer program instructions that, when executed by a processor, implement the above-described data storage method.
[0009] The data storage method, apparatus, device, medium, and program product in this application embodiment, when detecting data to be processed in the first memory, creates a temporary file in the second memory. The first and second memories are different memories. Then, the data to be processed is parsed to obtain a target data stream corresponding to the data to be processed. This target data stream includes multiple target data blocks. Then, a query identifier is created for each target data block, and the query identifier for each target data block corresponds to its storage location in the temporary file. The target data stream is written to the temporary file, and the target data stream in the first memory is deleted. Therefore, this application embodiment, by parsing the data to be processed into a target data stream, then storing the target data stream in a temporary file in the second memory, and deleting the target data stream from the first memory, reduces the occupation of the first memory's storage resources without increasing the number of first memories or limiting the size of the data to be processed, thus avoiding the exhaustion of the first memory caused by excessive data to be processed occupying it. In addition, this application embodiment also sets a query identifier for each target data block, allowing the corresponding target data block to be quickly found in the temporary file using the query identifier, improving data reading efficiency.
[0010] The technical solution of this application will be further described in detail below with reference to the accompanying drawings and embodiments. Attached Figure Description
[0011] The accompanying drawings, which form part of this specification, illustrate embodiments of this application and, together with the description, serve to explain the principles of this application.
[0012] Figure 1 This is a flowchart illustrating a data storage method provided in an exemplary embodiment of this application.
[0013] Figure 2 This is a flowchart illustrating step S120 provided in an exemplary embodiment of this application.
[0014] Figure 3 This is a flowchart illustrating step S122 provided in an exemplary embodiment of this application.
[0015] Figure 4This is a flowchart illustrating step S120 provided in another exemplary embodiment of this application.
[0016] Figure 5 This is a flowchart illustrating a data storage method provided in another exemplary embodiment of this application.
[0017] Figure 6 This is a flowchart illustrating a data storage method provided in an exemplary embodiment of this application.
[0018] Figure 7 This is a flowchart illustrating an application example of the data storage method provided in an exemplary embodiment of this application.
[0019] Figure 8 This is a flowchart illustrating an application example of a data storage method provided in another exemplary embodiment of this application.
[0020] Figure 9 This is a timing diagram of a data storage method provided in an exemplary embodiment of this application.
[0021] Figure 10 This is a schematic diagram of the structure of a CDocument object provided in an exemplary embodiment of this application.
[0022] Figure 11 This is a class diagram of a CDocument object provided in an exemplary embodiment of this application.
[0023] Figure 12 This is a schematic diagram of the structure of a data storage device provided in an exemplary embodiment of the present disclosure.
[0024] Figure 13 This is a schematic diagram of the structure of an application embodiment of the electronic device disclosed herein. Detailed Implementation
[0025] Various exemplary embodiments of the present application will now be described in detail with reference to the accompanying drawings. It should be noted that, unless otherwise specifically stated, the relative arrangement, numerical expressions, and values of the components and steps set forth in these embodiments do not limit the scope of the present application.
[0026] Those skilled in the art will understand that the terms "first," "second," etc., in the embodiments of this application are only used to distinguish different steps, devices, or modules, and do not represent any specific technical meaning, nor do they indicate a necessary logical order between them.
[0027] It should also be understood that in the embodiments of this application, "multiple" can refer to two or more, and "at least one" can refer to one, two or more.
[0028] It should also be understood that any component, data or structure mentioned in the embodiments of this application can generally be understood as one or more unless explicitly defined or given contrary guidance in the context.
[0029] Furthermore, the term "and / or" in this application is merely a description of the relationship between related objects, indicating that three relationships can exist. For example, A and / or B can represent: A existing alone, A and B existing simultaneously, or B existing alone. Additionally, the character " / " in this application generally indicates that the preceding and following related objects have an "or" relationship.
[0030] It should also be understood that the description of the various embodiments in this application emphasizes the differences between the various embodiments, and the similarities or similarities can be referred to each other. For the sake of brevity, they will not be described in detail.
[0031] At the same time, it should be understood that, for ease of description, the dimensions of the various parts shown in the accompanying drawings are not drawn according to actual scale.
[0032] The following description of at least one exemplary embodiment is merely illustrative and is in no way intended to limit the scope of this application and its application or use.
[0033] Techniques, methods, and equipment known to those skilled in the art may not be discussed in detail, but where appropriate, such techniques, methods, and equipment should be considered part of the specification.
[0034] It should be noted that similar labels and letters in the following figures indicate similar items; therefore, once an item is defined in one figure, it does not need to be discussed further in subsequent figures.
[0035] The embodiments of this application can be applied to electronic devices such as terminal devices, computer systems, and servers, and can operate together with a wide range of other general-purpose or special-purpose computing system environments or configurations. Well-known examples of terminal devices, computing systems, environments, and / or configurations suitable for use with electronic devices such as terminal devices, computer systems, and servers include, but are not limited to: personal computer systems, server computer systems, thin clients, thick clients, handheld or laptop devices, microprocessor-based systems, set-top boxes, programmable consumer electronics, network PCs, minicomputer systems, mainframe computer systems, and distributed cloud computing environments including any of the above systems, etc.
[0036] Electronic devices such as terminal devices, computer systems, and servers can be described in the general context of computer system executable instructions (such as program modules) executed by a computer system. Typically, program modules can include routines, programs, object programs, components, logic, data structures, etc., which perform specific tasks or implement specific abstract data types. Computer systems / servers can be implemented in distributed cloud computing environments, where tasks are executed by remote processing devices linked through communication networks. In distributed cloud computing environments, program modules can reside on local or remote computing system storage media, including storage devices.
[0037] In the process of developing this application, research revealed that in existing technologies, the problem of memory exhaustion in computing devices is typically addressed by either increasing the memory of the computing device or limiting the upper limit of test data size. However, increasing the memory of the computing device not only increases the cost of the computing device but also increases its operational burden and places higher demands on its performance. Limiting the total size of test data prevents the testing of all chip functions and / or performance.
[0038] Figure 1 This is a schematic flowchart of a data storage method provided in an exemplary embodiment of this application. This embodiment can be applied to electronic devices, such as chip testing equipment, etc. Figure 1 As shown, the data storage method may include the following steps:
[0039] Step S110: In response to the detection that there is data to be processed in the first memory, a temporary file is created in the second memory.
[0040] The first memory and the second memory are different types of memory. The first memory can be the main memory (RAM) of the computing device. For example, the first memory can be at least one of the following: Static Random-Access Memory (SRAM), Dynamic Random Access Memory (DRAM), or Flash Memory. The second memory is the secondary storage (auxiliary storage) of the computing device. For example, the second memory can be at least one of the following: hard disk, magnetic tape, magnetic disk, or optical disk; wherein the hard disk can be, for example, a solid-state drive (SSD) or a hard disk drive (HDD). The data to be processed can be test data of the chip.
[0041] The first memory and the second memory can be located on the same computing device or on different computing devices. When the first memory and the second memory are located on different computing devices, they are connected in communication. For example, the first memory and the second memory are respectively the RAM and hard disk located on a chip testing device.
[0042] Temporary files are used to store data. In one specific implementation, temporary files can be created at any location in the secondary memory.
[0043] Step S120: Data parsing is performed on the data to be processed to obtain the target data stream corresponding to the data to be processed. In this embodiment, the data stream corresponding to the data to be processed is called the target data stream; and the data blocks in the target data stream are called target data blocks.
[0044] The target data stream comprises multiple target data blocks. Each target data block includes at least one piece of data from the data to be processed. The multiple target data blocks in the target data stream are stored contiguously in a first memory.
[0045] Step S130: Create query identifiers for each target data block.
[0046] The query identifier for each target data block corresponds to the storage location of the corresponding target data block in the temporary file.
[0047] In one specific implementation, the query identifier is used to identify and query the target data block. First, a storage location in a temporary file can be assigned to each target data block, and a query identifier can be created for each target data block. Then, the query identifier of each target data block is used to identify the target data block, and a correspondence is established between the query identifier of each target data block and its storage location in the temporary file, so that the query identifier of each target data block corresponds to its storage location in the temporary file.
[0048] Step S140: Write the target data stream to a temporary file and delete the target data stream from the first memory.
[0049] Specifically, according to the storage location pre-assigned to each target data block in the temporary file, each target data block is stored sequentially in the temporary file, so as to write the target data stream into the temporary file.
[0050] In this embodiment, by parsing the data to be processed into a target data stream, then storing the target data stream in a temporary file located in the second memory, and deleting the target data stream from the first memory, the occupation of the first memory's storage resources is reduced without increasing the number of first memory units or limiting the size of the data to be processed. This avoids the situation where the first memory is exhausted due to excessive data occupying the first memory. Furthermore, this embodiment also sets a query identifier for each target data block, allowing the corresponding target data block to be quickly found in the temporary file using the query identifier, thus improving data reading efficiency.
[0051] In some optional implementations, before step S110, the method may further include: creating a data read / write object based on a preset data read / write class, wherein the data read / write object is used to perform actions such as writing data to a temporary file and reading data from the temporary file.
[0052] The data read / write class is used to control data reading, writing, and parsing. It includes multiple functions, each implementing a specific function. For example, a data read / write class might include functions for creating a file, writing, parsing, and reading data. The file creation function creates a temporary file; the write function writes data to the temporary file; the data parsing function parses the data into a data stream; and the read function reads the data. A data read / write object can be used to control data reading, writing, and parsing. Specifically, a data read / write object is used to write data to a temporary file and read data from a temporary file. A data read / write object includes multiple functions. For example, it might include functions for creating a file, writing, reading, and parsing data.
[0053] In one specific implementation, an object of the data read / write class can be obtained by instantiating the data read / write class, and this object can be identified as a data read / write object. The data read / write object can be stored in the first memory.
[0054] For example, a CDocument class (data read / write class) is created in memory (first storage) beforehand, and the CDocument class encapsulates several functions. Instantiating the CDocument class yields a CDocument object (data read / write object), which also encapsulates several functions.
[0055] In this embodiment, step S110 specifically includes: calling the file creation function in the data read / write object to create a temporary file at a preset location in the second memory.
[0056] The data read / write objects include file creation functions. For example, the file creation function can be the Open function.
[0057] In one specific implementation, when data to be processed is detected in memory (the first storage device), the Open function in the CDocument object (the data read / write object) can be called, and a temporary file can be created at the C drive user tempt (the preset location) on the hard disk (the second storage device) through the Open function.
[0058] In this embodiment of the application, a data read / write object is created by using a preset data read / write class, thereby enabling efficient writing of data from the first memory to the second memory through the data read / write object.
[0059] In some alternative implementations, as described in this application, the data to be processed includes multiple initial data blocks. Each initial data block includes at least one piece of data from the data to be processed.
[0060] In some optional implementations, step S120 further includes: parsing the complete initial data block in the data to be processed to obtain a target data stream. Each target data block in the target data stream includes at least one binary data block.
[0061] In one specific implementation, the integrity of each initial data block can be verified to determine whether each initial data block is complete. For each complete initial data block, each data in the complete initial data block is converted into binary data. Multiple target data blocks can be composed of binary data, or each initial data block after being converted into binary data can be determined as a target data block, and then the target data blocks can be used to form the target data stream.
[0062] For example, a hash table corresponding to each initial data block can be obtained from the client of the user sending the data to be processed. The hash table of each initial data block includes the hash value of each data in the initial data block. The hash value of each data in the initial data block is calculated to obtain multiple calculated hash values. It is determined whether the multiple calculated hash values include all the hash values in the hash table. If the multiple calculated hash values include all the hash values in the hash table, the initial data block is determined to be complete. Otherwise, the initial data block is determined to be incomplete.
[0063] In response to receiving the remaining data from the incomplete initial data block in the data to be processed, the remaining data is merged into the incomplete initial data block to obtain a complete initial data block; the complete initial data block is then parsed to obtain the target data stream.
[0064] The remaining data can be the residual data from an incomplete initial data block. A complete initial data block can be constructed from the remaining data and the data in the incomplete initial data block.
[0065] In one specific implementation, the first memory can be monitored. When the first memory receives the remaining data of the incomplete initial data block, the remaining data is merged into the incomplete initial data block to obtain the complete initial data block.
[0066] In this embodiment, by processing complete and incomplete initial data blocks differently, efficient data parsing of the data to be processed can be achieved. Furthermore, this embodiment converts the data to be processed into smaller binary data, which not only further reduces the excessive storage resources occupied by the data to be processed in the first and second memories, but also facilitates writing the target data stream to a temporary file, improving the efficiency of storing the data to be processed in the temporary file.
[0067] Figure 2 This is a flowchart illustrating step S120 provided in an exemplary embodiment of this application. In some optional embodiments, step S120 includes the following steps:
[0068] Step S121: Call the write function in the data read / write object and pass the data to be processed into the write function.
[0069] The data read / write object includes a write function. For example, the write function can be a Write function; for instance, when the data read / write object is a CDocument object, the write function can be the CDocument.Write function.
[0070] Step S122: Write the initial data parsing function in the data read / write object to parse the data to be processed and obtain the target data stream.
[0071] The data read / write objects include an initial data parsing function; specifically, the write function may include this initial data parsing function. This initial data parsing function is used to parse the data to be processed, converting it into binary data to obtain the target data stream.
[0072] For example, based on the parse method, a data parsing function in the programming language can be used as the initial data parsing function, such as the bin function, to parse the data to be processed.
[0073] In this embodiment, the initial data parsing function is called through the data read / write object, and the initial data parsing function is used to achieve efficient data parsing of the data to be processed, thereby obtaining the target data stream.
[0074] Figure 3 This is a flowchart illustrating step S122 provided in an exemplary embodiment of this application. In some alternative embodiments, such as Figure 3 As shown, step S122 includes the following steps:
[0075] Step S1221: Create multiple data parsing threads.
[0076] The data parsing thread is used to perform data parsing of the data to be processed. For example, a thread pool, the Callable interface, or the Future interface can be used to create the data parsing thread.
[0077] In step S1222, multiple data parsing threads use the initial data parsing function to parse the data to be processed in parallel to obtain the target data stream.
[0078] In one specific implementation, the task of parsing the data to be processed can be divided into multiple subtasks, each of which parses a portion of the data. Each data parsing thread parses one subtask, and each data parsing thread uses an initial data parsing function to parse the data of each subtask in parallel to obtain the target data stream.
[0079] In this embodiment, multiple data parsing threads are used to parse the data to be processed in parallel, thereby greatly improving the efficiency of data parsing.
[0080] In some optional implementations, after creating the data read / write object, the embodiments of this application further include: replacing the initial data parsing function in the data read / write object with a user-defined data parsing function based on a preset user interface.
[0081] The user interface can be an Application Programming Interface (API). User-defined data parsing functions can be added to data read / write objects through the user interface. Specifically, users can add user-defined data parsing functions to the write function and delete the initial data parsing function through the user interface. User-defined data parsing functions are functions set by the user to parse data into binary data.
[0082] For example, a user-defined data parsing function is passed to the CDocument.SetParseMethod function in the CDocument object through the user interface, and the initial data parsing function is deleted.
[0083] Figure 4 This is a flowchart illustrating step S120 provided in another exemplary embodiment of this application. In some optional embodiments, step S120 further includes the following steps:
[0084] Step S123: Call the write function in the data read / write object and pass the data to be processed into the write function.
[0085] It should be noted that there is no specific order of execution between steps S122 and S123 in this embodiment.
[0086] Step S124: Write a function to call a user-defined data parsing function to parse the data to be processed and obtain the target data stream.
[0087] For example, when the CDocument.Write function (the write function) passes in the data to be parsed, the CDocument.Write function calls the CDocument.SetParseMethod function (the user-defined data parsing function) to parse the data to be processed and obtain the target data stream.
[0088] In an alternative implementation, each data parsing thread can also utilize user-defined data parsing functions to parse the data to be processed in parallel, thereby obtaining the target data stream.
[0089] In the application embodiment, the user adds a user-defined data parsing function to the data read / write object through the user interface, and performs data parsing on the data to be processed through the user-defined data parsing function, thereby improving the flexibility of data parsing and expanding the applicability of the data storage method.
[0090] In some optional implementations, step S130 in this application embodiment includes: for multiple target data blocks, creating a query identifier for the target data block using the write function in the data read / write object.
[0091] The query identifier includes at least one of the following: keyword, index, and cursor, where the keyword, index, and cursor all correspond to the storage location of the target data block in the temporary file.
[0092] In one specific implementation, the write function is also used to create query identifiers.
[0093] For each target data block, the write function can be called to obtain the key, index, and cursor of the target database, and establish the correspondence between the key, index, and cursor and the storage location of the target data block in the temporary file.
[0094] For example, any word can be selected from the target data block as a keyword. The sequence number of the target data block in the target data stream can be used as the index of the target data stream. The character length, row number, or column number of the target data block can be used as a cursor, where the row number or column number can be the row number or column number of the target data block in the target data stream.
[0095] In this embodiment, keywords, indexes, and cursors are used as query identifiers for the target data block, and the keywords, indexes, and cursors are respectively associated with the storage location of the target data block in the temporary file. Thus, the target data block can be queried efficiently in a variety of ways.
[0096] In some alternative implementations, step S130 in this application embodiment includes: creating a mapping relationship between a key and a cursor using a write function; and / or creating a mapping relationship between an index and a cursor using a write function.
[0097] The write function is also used to create a mapping between the cursor and the key, as well as a mapping between the cursor and the index.
[0098] In this embodiment, a mapping relationship is established between keywords and cursors; and / or, a mapping relationship is established between indexes and cursors. This allows for quick retrieval of the cursor using the index and / or keywords, and subsequently, rapid querying of batch target data blocks using the cursor.
[0099] In some optional implementations, step S140 in this application embodiment includes: writing the target data stream to a temporary file using the write function in the data read / write object, and storing the query identifier of each target data block in the first memory.
[0100] In one specific implementation, each query identifier can also be written to a temporary file. That is, each query identifier can be stored in the first memory and the temporary file respectively.
[0101] In this embodiment of the application, the target data stream is quickly written to a temporary file by a write function, thereby achieving efficient transfer of the target data stream from the first memory to the second memory.
[0102] Figure 5 This is a schematic flowchart of a data storage method provided in another exemplary embodiment of this application. In some alternative embodiments, such as... Figure 5As shown, the following steps are included after step S140 in this embodiment of the application:
[0103] Step S150: In response to receiving a data read instruction, based on the query identifier corresponding to the data stream to be read in the data read instruction, read the data stream to be read from the temporary file and transmit the data stream to be read to the first memory.
[0104] The data stream to be read can be any data stream in a temporary file. The read instruction includes a query identifier corresponding to the data stream to be read. The query identifier corresponding to the data stream to be read includes the query identifier of each data block in the data stream to be read.
[0105] In one specific implementation, upon receiving a data read instruction from a user, the storage location of each data block in the data stream to be read in a temporary file is determined based on the query identifier corresponding to the data stream to be read. Based on the storage location of each data block in the temporary file, the data stream to be read is read from the temporary file. Then, the read data stream is transmitted to the first memory, and the computing device that sets the first memory can perform corresponding data processing on the data stream to be read.
[0106] In this embodiment of the application, the data stream to be read can be efficiently found in the temporary file by using the query identifier corresponding to the data block to be read, thereby achieving efficient return of the data stream to be read from the temporary file to the first memory.
[0107] In some optional implementations, the data stream to be read in the embodiments of this application includes at least one data block to be read, and the query identifier corresponding to the data stream to be read includes the index and / or keyword of the starting data block to be read in at least one data block to be read, and the index and / or keyword of the ending data block to be read.
[0108] In this context, a data block in the data stream to be read can be referred to as a data block to be read. The first data block to be read in the data stream can be called the starting data block to be read; and the last data block to be read in the data stream can be called the ending data block to be read.
[0109] When the data stream to be read contains only one data block to be read, the index and / or key of the starting data block and the index and / or key of the ending data block to be read are both the index and / or key of that data block to be read.
[0110] Figure 6 This is a schematic flowchart of a data storage method provided in an exemplary embodiment of this application. In some optional embodiments, such as Figure 6 As shown, step S150 in this embodiment includes the following steps:
[0111] Step S151: Determine the cursor for the starting data block to be read and the cursor for the ending data block to be read based on the index and / or key of the starting data block to be read and the index and / or key of the ending data block to be read.
[0112] Specifically, the cursor for the starting data block to be read is determined based on the index of the starting data block and / or the mapping relationship between the key and the index. The cursor for the ending data block to be read is determined based on the index of the ending data block and / or the mapping relationship between the key and the index.
[0113] Step S152: Based on the cursors of the starting and ending data blocks to be read, call the read function in the data read / write object to read the data stream to be read from the temporary file.
[0114] Both the data read / write class and the data read / write object include a read function. The read function is used to read data. For example, the read function can be the `Read` function; for instance, when the data read / write object is a `CDocument` object, the read function can be the `CDocument.Read` function.
[0115] In one specific implementation, based on the cursors of the starting and ending data blocks to be read, the reading function is used to determine the storage locations of the starting and ending data blocks to be read in the temporary file, obtain the data blocks to be read corresponding to the storage locations of the starting and ending data blocks to be read in the temporary file, and obtain the data blocks to be read located between the storage locations of the starting and ending data blocks to be read in the temporary file, thereby obtaining the data stream to be read.
[0116] In this embodiment, the starting and ending data blocks to be read are obtained using cursors for the first and last data blocks to be read, as well as the data blocks to be read between them. This achieves efficient positioning of batches of data blocks to be read in a temporary file, thereby enabling efficient reading of these batches of data blocks.
[0117] In some optional implementations, after step S150 in this embodiment, the method further includes: calling a data conversion function in the data read / write object to perform data conversion on the data stream to be read, so that the data stream to be read can be displayed on the visual interactive interface.
[0118] Both the data read / write class and the data read / write object include data conversion functions. These functions are used for data conversion; specifically, they can convert binary data into data that can be displayed on a visual interactive interface.
[0119] In one specific implementation, when the first memory receives the data stream to be read, a data conversion function can be used to convert the data stream to be read, and then the data stream to be read can be displayed on a visual interactive interface.
[0120] In this embodiment, a data transformation function is used to transform the data stream to be read, and the data stream is then displayed on a visual interactive interface. This improves the user experience and facilitates the management of the data stream to be read.
[0121] In some alternative implementations, after step S150 in this application embodiment, the method further includes: in response to receiving a file closing instruction to close the temporary file, calling the file closing function in the data read / write object to close the temporary file, and deleting the query identifiers of the temporary file and each target data block.
[0122] Both the data read / write class and the data read / write object include a file closing function. The file closing function is used to close and delete temporary files. For example, the file closing function can be the `Close` function; for instance, when the data read / write object is a `CDocument` object, the file closing function can be `CDocument.Close`.
[0123] In one specific implementation, when a user sends a close command, the temporary file is closed using a file close function, and the temporary file and all query identifiers are deleted.
[0124] In this embodiment of the application, when a user sends a close command, the temporary file is closed and deleted using a file close function, and each query identifier is deleted, thereby avoiding excessive occupation of the second memory storage resources by the temporary file and excessive occupation of the first memory storage resources by the query identifier.
[0125] In some optional implementations, the file closing instruction in this application includes a user-specified file storage location. This user-specified file storage location can be a storage location in a first memory or a second memory.
[0126] In some optional implementations, in this embodiment of the application, before calling the file closing function to close the temporary file, it may also include: calling the storage function in the data read / write object to store the temporary file in another file storage location.
[0127] Both the data reading class and the data reading / writing object include a storage function. The storage function is used to store temporary files to a user-specified file storage location. For example, the storage function can be the `Save as` function; for instance, when the data reading / writing object is a `CDocument` object, the write function can be `CDocument.Saveas`.
[0128] In one specific implementation, before closing the temporary file, a storage function can be used to save the temporary file to a user-specified file storage location.
[0129] In this embodiment, a storage function is used to store temporary files in a user-specified file storage location, thereby facilitating the user's subsequent retrieval of the temporary files.
[0130] Figure 7 This is a flowchart illustrating an application example of the data storage method provided in an exemplary embodiment of this application. Figure 8 This is a flowchart illustrating an application example of a data storage method provided in another exemplary embodiment of this application. Figure 9 This is a timing diagram of a data storage method provided in an exemplary embodiment of this application. Figure 10 This is a schematic diagram of the structure of a CDocument object provided in an exemplary embodiment of this application. Figure 11 This is a class diagram of a CDocument object provided in an exemplary embodiment of this application.
[0131] In this application example, we assume the first storage device is RAM and the second storage device is a hard disk. The data read / write object is a CDocument object, and the data to be processed can be the chip's test data. Figure 7-9 As shown, the data storage method includes a data writing process and a data reading process.
[0132] Based on the predefined data read / write classes, data read / write objects are created. These objects include: file creation function, write function, read function, initial data parsing function, read function, and file closing function. For example... Figure 10 As shown, a CDocument object can also include: functions for moving the cursor, data to be processed, the target data stream, and a temporary file. The read functions can include functions for moving the cursor, which are used to locate the target data block in the temporary file using the cursor. The temporary file supports both writing and reading data. For example... Figure 11As shown, the CDocument object has an inheritance relationship with both the cursor and the target data stream (CDataStream). Here, `include` indicates the inheritance relationship, and 1 and n represent one CDocument object corresponding to n cursors. The target data stream has an inheritance relationship with the data to be processed (CData), where one target data stream corresponds to one piece of data to be processed. The data to be processed has an inheritance relationship with its abstract data (CAbstractData), where one piece of data to be processed corresponds to one piece of abstract data. The data to be processed can include the data type (CDataImpl).
[0133] The data writing and reading processes can include user flows, document flows, query identification flows, and data flows. User flows include sending data to be processed, sending data read commands, and sending close commands. Document flows include writing data to be processed into memory, writing the target data stream into a temporary file, and locating the storage location of the data stream to be read in the temporary file. Query identification flows include creating query identifiers and determining the query identifier corresponding to the data stream to be read. Data flows include parsing the data to be processed, reading the data stream to be read, and returning the data stream to the user.
[0134] The data writing process includes:
[0135] When a user writes data to be processed into memory, a file creation function is called to create a temporary file at a preset location on the hard drive. Then, a write function is called, passing the data to be processed to it. The write function calls the initial data parsing function to parse the data to be processed, obtaining the target data stream. The write function then creates query identifiers for each target data block in the target data stream, including the key, index, and cursor. A mapping relationship is established between the key and the cursor (CCursor), as well as between the index and the cursor. A correspondence is created between each cursor and the storage location of the corresponding data block in the temporary file. Finally, the write function writes the target data stream to the temporary file and deletes the target data stream from memory.
[0136] The data reading process includes:
[0137] Upon receiving a data read command from the user, the system determines the cursors for the starting and ending data blocks based on the index and / or key of the starting and ending data blocks in the data stream. These cursors are then passed to a temporary file. Based on these cursors, the system calls a read function to read the data stream from the temporary file and sends it to memory. The system then processes the read data. Upon receiving a close command from the user, the system closes the temporary file using a file close function, and then deletes the temporary file and all query identifiers.
[0138] Figure 12 This is a schematic diagram of the structure of a data storage device provided in an exemplary embodiment of this disclosure. For example... Figure 12 As shown, the apparatus of this embodiment may include:
[0139] The temporary file creation module 200 is used to create a temporary file in the second memory in response to the detection that there is data to be processed in the first memory, wherein the first memory and the second memory are different memories;
[0140] Data parsing module 210 is used to parse the data to be processed to obtain a target data stream corresponding to the data to be processed, wherein the target data stream includes multiple target data blocks;
[0141] The query identifier creation module 220 is used to create query identifiers for each of the target data blocks, and each query identifier corresponds to the storage location of the corresponding target data block in the temporary file.
[0142] The data writing module 230 is used to write the target data stream to the temporary file and delete the target data stream from the first memory.
[0143] In some possible implementations of this disclosure, the data storage device in the embodiments of this disclosure further includes:
[0144] The object creation module is used to create data read / write objects based on a preset data read / write class. The data read / write objects are used to write data to a temporary file and read data from the temporary file.
[0145] The temporary file creation module 200 is specifically used to call the file creation function in the data read / write object to create the temporary file at a preset location in the second memory.
[0146] In some possible implementations of this disclosure, the data to be processed in the embodiments of this disclosure includes multiple initial data blocks; the data parsing module 210 includes:
[0147] The first data parsing submodule is used to parse the complete initial data block in the data to be processed to obtain the target data stream, wherein each target data block in the target data stream includes at least one binary data.
[0148] The data merging submodule is used to merge the remaining data of the incomplete initial data block into the incomplete initial data block in response to receiving the remaining data of the incomplete initial data block in the data to be processed, so as to obtain a complete initial data block;
[0149] The second data parsing submodule is used to parse the complete initial data block to obtain the target data stream.
[0150] In some possible implementations of this disclosure, the data parsing module 210 in this embodiment includes:
[0151] The first calling module is used to call the write function in the data read / write object and pass the data to be processed to the write function;
[0152] The third data parsing submodule is used by the write function to call the initial data parsing function in the data read / write object to parse the data to be processed and obtain the target data stream.
[0153] In some possible implementations of this disclosure, the third data parsing submodule in the embodiments of this disclosure includes:
[0154] A thread creation unit is used to create multiple data parsing threads;
[0155] The data parsing unit is used by the multiple data parsing threads to parse the data to be processed in parallel using the initial data parsing function, so as to obtain the target data stream.
[0156] In some possible implementations of this disclosure, the data storage device in the embodiments of this disclosure further includes:
[0157] The function customization module is used to replace the initial data parsing function in the data read / write object with a user-defined data parsing function based on a preset user interface.
[0158] The data parsing module 210 further includes:
[0159] The fourth data parsing submodule is used to call the write function in the data read / write object and pass the data to be processed into the write function; the write function calls the user-defined data parsing function to parse the data to be processed and obtain the target data stream.
[0160] In some possible implementations of this disclosure, the query identifier creation module 220 in this embodiment is specifically used to: for the plurality of target data blocks, use the write function in the data read / write object to create a query identifier for the target data block, the query identifier including at least one of the following: keyword, index and cursor, the keyword, the index and the cursor all corresponding to the storage location of the target data block in the temporary file.
[0161] In some possible implementations of this disclosure, the query identifier creation module 220 in this embodiment is further configured to: create a mapping relationship between the keyword and the cursor using the write function; and / or, create a mapping relationship between the index and the cursor using the write function.
[0162] In some possible implementations of this disclosure, the data writing module 230 in this embodiment is specifically used to: write the target data stream to the temporary file using the write function in the data read / write object, and store the query identifier of each target data block in the first memory.
[0163] In some possible implementations of this disclosure, the data storage device in the embodiments of this disclosure further includes:
[0164] The data reading module is used to respond to a received data reading instruction, read the data stream to be read from the temporary file based on the query identifier corresponding to the data stream to be read in the data reading instruction, and transmit the data stream to be read to the first memory.
[0165] In some possible implementations of this disclosure, the data stream to be read in the embodiments of this disclosure includes at least one data block to be read, and the query identifier corresponding to the data stream to be read includes at least one index and / or keyword of the starting data block to be read, and an index and / or keyword of the ending data block to be read.
[0166] The data reading module includes:
[0167] The cursor determination submodule is used to determine the cursor of the starting data block to be read and the cursor of the ending data block to be read based on the index and / or keyword of the starting data block to be read and the index and / or keyword of the ending data block to be read.
[0168] The data reading submodule is used to call the read function in the data read / write object based on the cursor of the starting data block to be read and the cursor of the ending data block to be read, and to read the data stream to be read from the temporary file.
[0169] In some possible implementations of this disclosure, the data storage device in the embodiments of this disclosure further includes: a data conversion module, used to call the data conversion function in the data read / write object to perform data conversion on the data stream to be read, so that the data stream to be read can be displayed on the visual interactive interface.
[0170] In some possible implementations of this disclosure, the data storage device in the embodiments of this disclosure further includes: a file closing module, configured to, in response to receiving a file closing instruction to close the temporary file, call a file closing function in a data read / write object to close the temporary file, and delete the query identifiers of the temporary file and each of the target data blocks.
[0171] In some possible implementations of this disclosure, the file closing instruction in the embodiments of this disclosure includes a user-specified file storage location, and the data storage device further includes: a data save-as-a-file module, used to call the storage function in the data read / write object to save the temporary file to the file storage location.
[0172] The data storage device in this application corresponds to the data storage method described above, and related contents can be referred to each other, which will not be repeated here.
[0173] The beneficial technical effects of the exemplary data storage device in this application can be found in the corresponding beneficial technical effects of the exemplary method section described above, and will not be repeated here.
[0174] In addition, this disclosure also provides an electronic device, including:
[0175] Memory, used to store computer programs;
[0176] A processor is configured to execute a computer program stored in the memory, wherein when the computer program is executed, it implements the data storage method described in any of the above embodiments of the present disclosure.
[0177] Figure 13 This is a schematic diagram illustrating the structure of an application embodiment of the electronic device disclosed herein. Below, reference is made to… Figure 13 This describes an electronic device according to embodiments of the present disclosure. The electronic device may be either or both of a first device and a second device, or a standalone device independent of them, which may communicate with the first device and the second device to receive acquired input signals from them.
[0178] like Figure 13 As shown, the electronic device includes one or more processors and memory.
[0179] A processor can be a central processing unit (CPU) or other form of processing unit with data processing and / or instruction execution capabilities, and can control other components in an electronic device to perform desired functions.
[0180] The memory may include one or more computer program products, which may include various forms of computer-readable storage media, such as volatile memory and / or non-volatile memory. The volatile memory may, for example, include random access memory (RAM) and / or cache memory. The non-volatile memory may, for example, include read-only memory (ROM), hard disk, flash memory, etc. One or more computer program instructions may be stored on the computer-readable storage medium, and a processor may execute the program instructions to implement the data storage methods of the various embodiments of this disclosure described above and / or other desired functions.
[0181] In one example, the electronic device may also include input devices and output devices, which are interconnected via a bus system and / or other forms of connection mechanism (not shown).
[0182] In addition, the input device may include, for example, a keyboard, a mouse, etc.
[0183] This output device can output various information to the outside, including determined distance information, direction information, etc. The output device may include, for example, a display, a speaker, a printer, and a communication network and its connected remote output devices, etc.
[0184] Of course, for the sake of simplicity, Figure 13 Only some of the components of the electronic device relevant to this disclosure are shown, omitting components such as buses, input / output interfaces, etc. In addition, the electronic device may include any other suitable components depending on the specific application.
[0185] In addition to the methods and apparatus described above, embodiments of this disclosure may also be computer program products comprising computer program instructions that, when executed by a processor, cause the processor to perform the steps in the data storage methods according to various embodiments of this disclosure as described in the foregoing portions of this specification.
[0186] The computer program product can be written in any combination of one or more programming languages to perform the operations of the embodiments of this disclosure. The programming languages include object-oriented programming languages such as Java and C++, as well as conventional procedural programming languages such as C or similar languages. The program code can be executed entirely on a user's computing device, partially on a user's computing device, as a standalone software package, partially on a user's computing device and partially on a remote computing device, or entirely on a remote computing device or server.
[0187] Furthermore, embodiments of this disclosure may also be computer-readable storage media storing computer program instructions thereon, which, when executed by a processor, cause the processor to perform the steps in the data storage methods according to various embodiments of this disclosure as described in the foregoing portion of this specification.
[0188] The computer-readable storage medium may be any combination of one or more readable media. A readable medium may be a readable signal medium or a readable storage medium. A readable storage medium may, for example, include, but is not limited to, electrical, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatuses, or devices, or any combination thereof. More specific examples of readable storage media (a non-exhaustive list) include: electrical connections having one or more wires, portable disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fibers, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination thereof.
[0189] Those skilled in the art will understand that all or part of the steps of the above method embodiments can be implemented by hardware related to program instructions. The aforementioned program can be stored in a computer-readable storage medium. When the program is executed, it performs the steps of the above method embodiments. The aforementioned storage medium includes various media that can store program code, such as ROM, RAM, magnetic disk, or optical disk.
[0190] The basic principles of this disclosure have been described above with reference to specific embodiments. However, it should be noted that the advantages, benefits, and effects mentioned in this disclosure are merely examples and not limitations, and should not be considered as essential features of each embodiment of this disclosure. Furthermore, the specific details disclosed above are for illustrative and facilitative purposes only, and are not limitations. These details do not limit the scope of this disclosure to the necessity of employing the aforementioned specific details for implementation.
[0191] The various embodiments in this specification are described in a progressive manner, with each embodiment focusing on its differences from other embodiments. Similar or identical parts between embodiments can be referred to interchangeably. For system embodiments, since they largely correspond to method embodiments, the description is relatively simple; relevant parts can be referred to the descriptions in the method embodiments.
[0192] The block diagrams of devices, apparatuses, devices, and systems disclosed herein are merely illustrative examples and are not intended to require or imply that they must be connected, arranged, or configured in the manner shown in the block diagrams. As those skilled in the art will recognize, these devices, apparatuses, devices, and systems can be connected, arranged, and configured in any manner. Words such as “comprising,” “including,” “having,” etc., are open-ended terms meaning “including but not limited to,” and are used interchangeably with them. The terms “or” and “and” as used herein refer to the terms “and / or,” and are used interchangeably with them unless the context clearly indicates otherwise. The term “such as” as used herein refers to the phrase “such as but not limited to,” and is used interchangeably with it.
[0193] The methods and apparatus of this disclosure may be implemented in many ways. For example, they may be implemented by software, hardware, firmware, or any combination of software, hardware, and firmware. The above-described order of steps for the methods is for illustrative purposes only, and the steps of the methods of this disclosure are not limited to the order specifically described above unless otherwise specifically stated. Furthermore, in some embodiments, this disclosure may also be implemented as a program recorded on a recording medium, the program including machine-readable instructions for implementing the methods according to this disclosure. Thus, this disclosure also covers recording media storing programs for performing the methods according to this disclosure.
[0194] It should also be noted that in the apparatus, devices, and methods of this disclosure, the components or steps can be disassembled and / or recombined. These disassemblies and / or recombinations should be considered as equivalent solutions to this disclosure.
[0195] The above description of the disclosed aspects is provided to enable any person skilled in the art to make or use this disclosure. Various modifications to these aspects will be readily apparent to those skilled in the art, and the general principles defined herein may be applied to other aspects without departing from the scope of this disclosure. Therefore, this disclosure is not intended to be limited to the aspects shown herein, but rather to be carried out within the widest scope consistent with the principles and novel features disclosed herein.
[0196] The above description has been given for purposes of illustration and description. Furthermore, this description is not intended to limit the embodiments of this disclosure to the forms disclosed herein. Although numerous exemplary aspects and embodiments have been discussed above, those skilled in the art will recognize certain variations, modifications, alterations, additions, and sub-combinations therein.
Claims
1. A data storage method, characterized in that, include: In response to the detection of data to be processed in the first memory, a temporary file is created in the second memory, wherein the first memory and the second memory are different memories; The data to be processed is parsed to obtain the target data stream corresponding to the data to be processed, and the target data stream includes multiple target data blocks; Create a query identifier for each of the target data blocks, and each query identifier corresponds to the storage location of the corresponding target data block in the temporary file; Writing the target data stream to the temporary file and deleting the target data stream from the first memory includes: using the write function in the data read / write object to write the target data stream to the temporary file, and storing the query identifier of each target data block in the first memory.
2. The method according to claim 1, characterized in that, The response prior to detecting the presence of data to be processed in the first memory further includes: Based on a preset data read / write class, a data read / write object is created. The data read / write object is used to write data to a temporary file and read data from a temporary file. Creating a temporary file in the second memory includes: The file creation function in the data read / write object is invoked to create the temporary file at a preset location in the second memory.
3. The method according to claim 1 or 2, characterized in that, The data to be processed includes multiple initial data blocks; The data parsing of the data to be processed includes: The complete initial data block in the data to be processed is parsed to obtain the target data stream, and each target data block in the target data stream includes at least one binary data. In response to receiving the remaining data of the incomplete initial data block in the data to be processed, the remaining data is merged into the incomplete initial data block to obtain a complete initial data block; The target data stream is obtained by parsing the complete initial data block.
4. The method according to claim 1, characterized in that, The data parsing of the data to be processed includes: Call the write function in the data read / write object and pass the data to be processed into the write function; The write function calls the initial data parsing function in the data read / write object to parse the data to be processed, and obtain the target data stream.
5. The method according to claim 4, characterized in that, The write function calls the initial data parsing function in the data read / write object to parse the data to be processed, obtaining the target data stream, including: Create multiple data parsing threads; The multiple data parsing threads respectively use the initial data parsing function to parse the data to be processed in a parallel data parsing manner to obtain the target data stream.
6. The method according to claim 2, characterized in that, After creating the data read / write object, the process also includes: Based on a preset user interface, the initial data parsing function in the data read / write object is replaced with a user-defined data parsing function. The data parsing of the data to be processed includes: Call the write function in the data read / write object and pass the data to be processed into the write function; The write function calls the user-defined data parsing function to parse the data to be processed, thereby obtaining the target data stream.
7. The method according to claim 1, characterized in that, The creation of query identifiers for each of the target data blocks includes: For the plurality of target data blocks, a query identifier for the target data block is created using the write function in the data read / write object. The query identifier includes at least one of the following: keyword, index, and cursor. The keyword, the index, and the cursor all correspond to the storage location of the target data block in the temporary file.
8. The method according to claim 7, characterized in that, After creating the query identifier for each target data block in the plurality of target data, the method further includes: The write function is used to create a mapping relationship between the key and the cursor; and / or, The write function is used to create a mapping relationship between the index and the cursor.
9. The method according to claim 1, characterized in that, After writing the target data stream to the temporary file, the method further includes: In response to receiving a data read instruction, the system reads the data stream to be read from the temporary file based on the query identifier corresponding to the data stream to be read in the data read instruction, and transmits the data stream to be read to the first memory.
10. The method according to claim 9, characterized in that, The data stream to be read includes at least one data block to be read, and the query identifier corresponding to the data stream to be read includes the index and / or keyword of the starting data block to be read and the index and / or keyword of the ending data block to be read in at least one data block to be read. The step of reading the data stream to be read from the temporary file based on the query identifier corresponding to the data stream to be read in the data reading instruction includes: Based on the index and / or keyword of the starting data block to be read, and the index and / or keyword of the ending data block to be read, determine the cursor of the starting data block to be read and the cursor of the ending data block to be read; Based on the cursors of the starting data block to be read and the ending data block to be read, the read function in the data read / write object is called to read the data stream to be read from the temporary file.
11. The method according to claim 9, characterized in that, After transmitting the data stream to be read to the first memory, the method further includes: The data conversion function in the data read / write object is called to convert the data stream to be read so that it can be displayed on the visual interactive interface.
12. The method according to claim 1, characterized in that, Also includes: In response to receiving a file close instruction to close the temporary file, the file close function in the data read / write object is called to close the temporary file, and the query identifiers of the temporary file and each of the target data blocks are deleted.
13. The method according to claim 12, characterized in that, The file closing command includes the file storage location specified by the user; Before calling the file closing function in the data read / write object to close the temporary file, the method further includes: The storage function in the data read / write object is called to store the temporary file in the file storage location.
14. A data storage device, characterized in that, include: A temporary file creation module is used to create a temporary file in a second memory in response to the detection of data to be processed in a first memory, wherein the first memory and the second memory are different memories; The data parsing module is used to parse the data to be processed to obtain a target data stream of the data to be processed, wherein the target data stream includes multiple target data blocks; The query identifier creation module is used to create query identifiers for each of the target data blocks, and each query identifier corresponds to the storage location of the corresponding target data block in the temporary file. The data writing module is used to write the target data stream to the temporary file and delete the target data stream from the first memory, including: using the write function in the data read / write object to write the target data stream to the temporary file, and storing the query identifier of each target data block in the first memory.
Citation Information
Patent Citations
Data writing method and device
CN112559445A
Online redistribution
US20160140132A1