Electronic document storage reading method, device and equipment and storage medium
By employing append-only and checkpoint recording mechanisms during file writing, the problem of file corruption caused by non-atomic overwrite in transparent encryption is solved, enabling reliable file recovery under abnormal conditions.
Patent Information
- Application Number
- CN202611610330.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-10-16
- Publication Date
- 2026-11-20
AI Technical Summary
Existing transparent encryption technology is susceptible to external interference during file writing due to its non-atomic overwrite mechanism, which can lead to file corruption and inability to be read, especially in the event of system malfunctions.
By adopting an append-write strategy that writes to the log first and then commits the checkpoint, the file save operation is transformed into an atomic transaction. By appending data to the end of the file and building checkpoint records, the file content view is ensured to remain consistent under abnormal conditions.
It solves the problem of file corruption caused by interrupted file writing, ensures that files can be restored to a known correct state under abnormal scenarios, and improves the reliability and security of the file system.
Smart Images

Figure CN123137589A_ABST
Abstract
Description
Technical Field
[0001] This disclosure relates to the field of data reading and writing technology, and in particular to a method, apparatus, device and storage medium for storing and reading electronic documents. Background Technology
[0002] With the increasing demand for information security, transparent encryption technology has become a key means of protecting enterprises' core data assets. This technology deploys a file filtering driver at the operating system kernel level to intercept application operations such as opening, reading, writing, and closing files in real time, thereby achieving automatic encryption and decryption of specified file types.
[0003] In related technologies, when an application performs a file write (save) operation, the encryption driver intercepts the written data stream. The driver first obtains the key from the file's encryption header information, encrypts the data blocks, and then directly overwrites the encrypted data into the original file's physical storage location. Typically, the entire file saving process involves multiple steps: first, writing the encrypted file body; and finally, writing or updating an encryption header containing key metadata (such as the key, algorithm identifier, version number, etc.) at a specific location in the file (such as the file header or file footer). The driver considers a complete file write operation complete only when the file is normally closed by the application. When the application reopens the file, the encryption driver first reads the file header information to determine if it is a protected encrypted file. If so, it decrypts the subsequent data stream in real time based on the metadata in the file header, ensuring that authorized users can use the file normally without any awareness of its security.
[0004] However, the above method is prone to file corruption and inaccessibility if an abnormal interruption occurs during the write operation. Summary of the Invention
[0005] In view of this, this disclosure proposes an electronic document storage and retrieval method, apparatus, device, and storage medium.
[0006] According to one aspect of this disclosure, a method for storing and retrieving electronic documents is provided, comprising: In response to a new file request, the file is created and logically divided into a checkpoint region, a data stream region, a data block region, and a user data region; In response to the write request, the data block generated by this modification is appended to the end of the user data area, and the data stream area and the data block area are updated based on this modification; Construct checkpoint records and append them to the checkpoint area. When a checkpoint record is successfully written and passes verification, switch the content view of the file to the state pointed to by the checkpoint record. In response to a file open request, the file is scanned backward from the end, and a content view of the file is constructed based on the last checkpoint found.
[0007] In some embodiments, the step of scanning backwards from the end of the file in response to a file open request and constructing a content view of the file based on the last checkpoint found includes: Scan backwards from the end of the file to find the checkpoint region that matches the preset signature and passes self-verification; The first checkpoint detected by the scan is recorded as the root structure of the file; Based on the pointer to the root structure, load the data stream region and the data block region; Based on the loaded data stream region and the data block region, construct the content view of the file.
[0008] In some embodiments, the checkpoint record includes a self-checking code, as well as a check code for the data stream region and a check code for the data block region; The checkpoint record that passes the first self-check code scan and passes both the check code for the data stream region and the check code for the data block region is used as the root structure of the file.
[0009] In some embodiments, the checkpoint region is located at a preset fixed boundary position in the file; or The checkpoint area is set at the beginning of the file, or at the end of the file, or in an index file independent of the file.
[0010] In some embodiments, the size of the checkpoint area is fixed.
[0011] In some embodiments, the data block record includes a logical length field and a physical length field; When the physical length is zero and the physical offset is a preset special value, the data indicated by the data block record is sparse data; The difference between the logical length and the physical length supports compressed data storage.
[0012] In some embodiments, the method further includes: When a preset trigger condition is met, the valid data pointed to by the latest checkpoint record will be moved to a new storage area. The preset trigger condition includes reaching a preset period or the file being closed. Update the location information of the data stream area and the data block area according to the storage location after the relocation, generate a compact new checkpoint record, and release the storage space occupied by the old data before the relocation.
[0013] According to another aspect of this disclosure, an electronic document storage and reading device is provided, comprising: The new file module is used to respond to a new file request, create a file, and logically divide the file into a checkpoint area, a data stream area, a data block area, and a user data area. The write module is used to respond to a write request by appending the data block generated by the current modification to the end of the user data area, and updating the data stream area and the data block area based on the current modification. The update module is used to construct checkpoint records and append the checkpoint records to the checkpoint area. When the checkpoint record is successfully written and passes the verification, the content view of the file is switched to the state pointed to by the checkpoint record. The reading module is used to scan backwards from the end of the file in response to a file open request, and construct a content view of the file based on the last checkpoint found.
[0014] According to another aspect of this disclosure, an electronic document storage and retrieval apparatus is provided, comprising: a processor; a memory for storing processor-executable instructions; wherein the processor is configured to perform the above-described method.
[0015] According to another aspect of this disclosure, a non-volatile computer-readable storage medium is provided that stores computer program instructions thereon, wherein the computer program instructions, when executed by a processor, implement the above-described method.
[0016] This disclosed embodiment transforms file saving operations into atomic transactions through an append-only write strategy of "writing the log first, then committing the checkpoint." No matter how complex the encryption process, the file content view remains unchanged as long as the checkpoint is not committed. This completely solves the problem of file corruption caused by "power outage halfway through writing" in transparent encryption, ensuring that the file can still be restored to a known, correct state even in abnormal scenarios.
[0017] Other features and aspects of this disclosure will become clear from the following detailed description of exemplary embodiments with reference to the accompanying drawings. Attached Figure Description
[0018] The accompanying drawings, which are included in and form part of this specification, illustrate exemplary embodiments, features, and aspects of this disclosure together with the specification and serve to explain the principles of this disclosure.
[0019] Figure 1 This is a flowchart illustrating an electronic document storage and retrieval method according to some embodiments of the present disclosure.
[0020] Figure 2This is a schematic diagram illustrating the logical division of files according to some embodiments of this disclosure.
[0021] Figure 3 This is a flowchart illustrating an electronic document storage and retrieval method according to some embodiments of the present disclosure, specifically the retrieval method.
[0022] Figure 4 This is a block diagram illustrating an electronic document storage and reading device according to some embodiments of the present disclosure.
[0023] Figure 5 This is a block diagram illustrating an electronic document storage and retrieval device according to some embodiments of the present disclosure. Detailed Implementation
[0024] Various exemplary embodiments, features, and aspects of this disclosure will now be described in detail with reference to the accompanying drawings. The same reference numerals in the drawings denote elements that have the same or similar functions. Although various aspects of the embodiments are shown in the drawings, they are not necessarily drawn to scale unless specifically indicated otherwise.
[0025] The term “exemplary” as used herein means “serving as an example, embodiment, or illustration.” Any embodiment illustrated herein as “exemplary” is not necessarily to be construed as superior to or better than other embodiments.
[0026] Furthermore, to better illustrate this disclosure, numerous specific details are set forth in the following detailed description. Those skilled in the art will understand that this disclosure can be practiced without certain specific details. In some instances, methods, means, components, and circuits well known to those skilled in the art have not been described in detail in order to highlight the main points of this disclosure.
[0027] With the increasing demand for information security, transparent encryption technology has become a key means of protecting core enterprise data assets. This technology deploys a file filtering driver at the operating system kernel layer to intercept application operations such as opening, reading, writing, and closing files in real time, enabling automatic encryption and decryption of specified file types. In existing mainstream implementations, when an application performs a file write (save) operation, the encryption driver intercepts the written data stream. The driver first obtains the key based on the file's encryption header information, encrypts the data blocks, and then directly overwrites the encrypted data into the original file's physical storage location. Typically, the entire file saving process involves multiple steps: first, writing the encrypted file body content; and finally, writing or updating an encryption header containing key metadata (such as keys, algorithm identifiers, version numbers, etc.) at a specific location in the file (such as the file header or file footer). The driver only considers a complete file write operation complete when the file is normally closed by the application. When the application reopens the file, the encryption driver first reads the file header information to determine if it is a protected encrypted file. If so, it decrypts the subsequent data stream in real time based on the metadata in the file header, ensuring that authorized users can use the file normally without being aware of it.
[0028] The above scheme achieves transparent encryption of file content, but its processing mechanism during file writing has serious reliability vulnerabilities, especially when dealing with system anomalies. The core problem of existing technology lies in its non-atomic overwrite mechanism. A complete file saving operation is not an indivisible whole, but consists of multiple sub-steps such as "writing file content" and "updating the file encryption header" in sequence. This mechanism is highly susceptible to external interference, with specific defects as follows: Data inconsistency risk: When the system encounters unexpected situations such as abnormal power outages, operating system crashes, or forced termination of encryption processes, write operations may be interrupted in any intermediate state. The most typical scenario is that the file content data has been successfully written to the disk, but the file header containing critical decryption information has not been written or has been written incompletely.
[0029] Permanent file corruption: Due to the lack of a complete and correct file header, the encryption driver will be unable to obtain the necessary parameters (such as the key) for decryption when it subsequently attempts to open the file, resulting in the file being unable to be correctly identified and decrypted.
[0030] Asset loss: This type of data corruption caused by write interruption is usually irreversible. Ultimately, it manifests as files becoming completely inaccessible, posing a significant security threat and integrity risk to critical data assets of the enterprise.
[0031] In view of the above, this disclosure provides a method, apparatus, device and storage medium for storing and reading electronic documents. Figure 1This is a flowchart illustrating an electronic document storage and retrieval method according to some embodiments of this disclosure. For example... Figure 1 As shown, the electronic document storage and retrieval method includes the following steps: Step S1: In response to the new file request, create the file and logically divide the file into a checkpoint area, a data stream area, a data block area, and a user data area.
[0032] When creating a new file, the system first initializes a checkpoint region. This initial checkpoint record contains pointers to empty stream regions and data block regions. Once the file's initial state is successfully established, a valid self-checksum is generated, indicating that the initial state of an empty file has been established. The checkpoint region can serve as the root of the file structure.
[0033] Step S2: In response to the write request, append the data block generated by this modification to the end of the user data area, and update the data stream area and data block area based on this modification.
[0034] When a user modifies a document and saves it, the system does not overwrite the existing data but follows an append-only write mode. The data block resulting from the modification is appended to the user data area at the end of the file. During this stage, the file view still points to the old data; the newly written data and metadata are not visible to file read operations.
[0035] Step S3: Construct checkpoint records and append them to the checkpoint area. When a checkpoint record is successfully written and passes verification, switch the file's content view to the state pointed to by the checkpoint record.
[0036] Once all user data and metadata have been successfully written to disk, the cryptographic driver constructs a new checkpoint record. This new checkpoint record contains pointers to the latest data stream and data block regions, an incrementing sequence number, and a CRC checksum that covers the entire critical region of the file. This new checkpoint record is then appended to the file. Only after this write operation succeeds will the file's content view instantly switch to the new state. This process is atomic; that is, an external observer (such as another process or a power outage event) will see either a completely old or completely new file state, never an intermediate inconsistent state. Any crash that occurs before the new checkpoint is written will leave the file in its previous valid state.
[0037] Step S4: In response to a file open request, scan backward from the end of the file and build a content view of the file based on the last checkpoint found.
[0038] If a power outage or other abnormal event occurs during file writing or system commit, the recovery mechanism will automatically activate. After the operating system restarts, when the user attempts to load a file, the system will scan backwards from the end of the file, searching for the last valid checkpoint record. Validity is confirmed through a preset signature and CRC checksum. The encryption driver will find the most recently successfully committed checkpoint record and, based on the pointers it contains, reconstruct the file's content view.
[0039] Therefore, this embodiment transforms file saving operations into atomic transactions through an append-only write strategy of "writing the log first, then committing the checkpoint." No matter how complex the encryption process, the file content view remains unchanged as long as the checkpoint is not committed. This solves the problem of file corruption caused by "power outage halfway through writing" in transparent encryption, ensuring that the file can still be restored to a known, correct state even in abnormal scenarios.
[0040] Figure 2 This is a schematic diagram illustrating the logical division of files according to some embodiments of this disclosure. For example... Figure 2 As shown, when creating a new file, the system first initializes a checkpoint area. This initial checkpoint record contains pointers to empty stream areas and data block areas. Stream Area: A contiguous table storing descriptors for all streams within the file. Each descriptor contains the stream name and a pointer to its corresponding data block (Extent). Data Block Area: Consists of a series of data block record tables used to describe the physical layout of the data in the stream. Each record defines the data's offset within the stream and its physical location within the file. User Data Area: Stores the actual file content.
[0041] In some embodiments, the checkpoint region is located at a preset fixed boundary position in the file; or the checkpoint region is set at the beginning or end of the file, or in an index file independent of the file. This disclosure does not limit the checkpoint to be stored at the beginning, end, or in an independent index file. Setting the checkpoint region at the end of the file facilitates appending and scanning from the end to the beginning. Setting the checkpoint region at the beginning of the file facilitates quick reading of the initial checkpoint, but new checkpoints can be submitted using double slots or index jumps. Setting the checkpoint region in an independent index file enables multiple files to share the index, centrally manage versions and recovery information, suitable for databases, document libraries, or enterprise encrypted file management systems. Regardless of the location, the checkpoint region should be identifiable by a preset signature and checksum. The fixed boundary position can refer to a fixed offset at the beginning of the file, a fixed offset at the end of the file, or a fixed region aligned by sectors. The independent index file can be located on the same storage medium or different storage media and can be associated with the target file through a file identifier, handle, or globally unique ID.
[0042] Furthermore, the size of the checkpoint area is fixed, reducing implementation complexity.
[0043] For example, the checkpoint area is greater than or equal to 1kb and less than or equal to 10kb. Preferably, the size of the checkpoint area is fixed at 4kb.
[0044] In some embodiments, a data block record includes a logical length field and a physical length field. When the physical length is zero and the physical offset is a preset special value, the data indicated by the data block record is sparse data. Compressed storage of data is supported through the difference between the logical length and the physical length. The logical length represents the length occupied by the data in the file's logical view, and the physical length represents the actual storage length occupied by the data in the user data area. If both the logical length and physical length are 4KB, it represents uncompressed ordinary data. If the logical length is 4KB and the physical length is 1KB, it means that the logical data is compressed to only 1KB; during reading, 1KB of physical data is read first, and then decompressed to 4KB of logical data. If the logical length is 4KB, the physical length is 0, and the physical offset is a preset special value, such as 0xFFFFFFFF or a specific null value identifier, it means that the logical range is sparse data, such as a zero-based region or an unallocated region; during reading, the default value can be returned directly without actual storage. Sparse data and compressed data can be used in combination. The effective length field in the data block area can be used to represent the actual effective data length, facilitating truncation, padding, or partial updates. By using logical length and physical length fields, it supports both sparse data representation and compressed storage, which can reduce the actual space occupied by the file, improve storage efficiency, and at the same time, not violate the checkpoint transaction mechanism, and improve the efficiency of storing and allocating file length.
[0045] Based on the above file logic division, when a user modifies a document and saves it, the system does not overwrite the original data but follows an append-only write mode. The data block resulting from this modification is appended to the user data area at the end of the file. New stream descriptions and data block records are appended to the end of the data stream area and data block area, respectively, making them point to the newly written data block. At this stage, the file view still points to the old data; the newly written data and metadata are not visible to file read operations. In other words, the old checkpoints remain valid, pointing to the old data stream area and data block area, so the old version of the content is still seen during reading.
[0046] Figure 3 This is a flowchart illustrating a method for reading and storing electronic documents according to some embodiments of this disclosure. For example... Figure 3 As shown, in some embodiments of this disclosure, in response to a file open request, the file is scanned backward from the end, and a content view of the file is constructed based on the last checkpoint found. That is, the reading method includes the following steps: Step S41: Scan backwards from the end of the file to find checkpoint regions that match the preset signature and pass self-verification.
[0047] Step S42: Record the first checkpoint scanned as the root structure of the file.
[0048] Step S43: Based on the pointer to the root structure, load the data stream region and the data block region.
[0049] Step S44: Construct a content view of the file based on the loaded data stream area and data block area.
[0050] In other words, when reading a file, scanning backward from the end of the file can be done with a fixed step size or according to the size of the checkpoint region. The checkpoint region may contain a preset signature, such as a version identifier or serial number. Starting from the end of the file, the system reads the candidate checkpoint regions segment by segment, first verifying whether the preset signature matches, and then verifying the self-checking code, such as a CRC checksum. If the signature matches and the self-checking passes, the checkpoint is recorded as a valid checkpoint. Since checkpoints are written in append mode, the most recently committed checkpoint usually exists at the end of the file. The first valid checkpoint found is the most recently successfully committed checkpoint. Then, the pointers in the checkpoint are used to locate the data stream region and the data block region. The data stream region records the name and start position of each stream, and the data block region records the offset, physical location, and effective length of the data in the stream. Based on this information, the system can reconstruct a view of the file's content and decrypt encrypted data in the user data region as needed.
[0051] By scanning backward from the end of the file and selecting the first valid checkpoint, the system can quickly locate the state of the most recent successful commit, enabling automatic rollback and recovery. Uncommitted data is ignored, and users see the complete file as it was during the last successful save, thus preventing permanent file corruption.
[0052] Furthermore, the checkpoint record contains a self-checksum, as well as checksums for the data stream region and checksums for the data block region. The checkpoint record that passes the first self-checksum verification and whose checksums for both the data stream region and the data block region verification are used as the root structure of the file.
[0053] The checkpoint area can include the stream area CRC, the data block area CRC, and the checkpoint CRC. The stream area CRC verifies the integrity of the data stream area, the data block area CRC verifies the integrity of the data block area, and the checkpoint CRC verifies the integrity of the checkpoint area itself. Verification algorithms can include CRC32, CRC64, hash algorithms, message authentication codes, etc. The verification order can be: first verify the checkpoint CRC to confirm the integrity of the checkpoint record itself; then verify the stream area CRC and the data block area CRC based on the pointer and length in the checkpoint; only if all verifications pass is the checkpoint used as the root structure. If any verification fails, the scan continues to the next candidate checkpoint. Through multi-level verification using checkpoint self-check codes, data stream area check codes, and data block area check codes, invalid checkpoints caused by power outages, partial writes, or media damage can be accurately identified, preventing the construction of file views using incomplete metadata and further improving recovery reliability.
[0054] In some embodiments, the electronic document storage and retrieval method further includes a cleanup mechanism. Upon meeting preset trigger conditions, valid data pointed to by the latest checkpoint record is migrated to a new storage area, wherein the preset trigger conditions include reaching a preset period or the file being closed. The location information in the data stream area and data block area is updated according to the migrated storage location, generating a compact new checkpoint record, and releasing the storage space occupied by the old data before the migration.
[0055] Because of the append-only write mode, old data that has been replaced by newer versions remains in the file, causing the file size to continuously expand. To address this, a "cleaner" process runs in the background. This cleaner process is triggered periodically or when the file is closed, migrating all valid data—that is, data pointed to by the latest checkpoint—to a new storage area. The migrated data includes checkpoint and user data. In other words, the migrated data includes data from all four regions of valid data blocks recorded before the valid checkpoint, specifically including checkpoint and user data. After the migration is complete, the system needs to recalculate the file position in the data stream area and data block area of the checkpoint, update the position information in the data stream area and data block area, generate a new, compact checkpoint record, and release the disk space occupied by the old data, thereby reclaiming and optimizing file storage space.
[0056] In some other embodiments of this disclosure, an encryption driver step is also included. The encryption driver encrypts data in the user data area during writing and decrypts it based on the data block record pointed to by the checkpoint during reading. Keys, algorithm identifiers, version numbers, etc., can be stored in the checkpoint area, a separate index file, or a protected metadata area. Because checkpoint commits are atomic, even if a power outage occurs during the update of the encryption header or key metadata, it can be rolled back to the complete state corresponding to the old checkpoint, avoiding the file becoming permanently undecryptable due to an incomplete encryption header.
[0057] According to another aspect of this disclosure, an electronic document storage and reading device 100 is also provided. Figure 4 This is a block diagram illustrating an electronic document storage and reading device 100 according to some embodiments of the present disclosure. Figure 4 As shown, the device includes: a new file module 110, used to create a file and logically divide it into a checkpoint area, a data stream area, a data block area, and a user data area in response to a new file request; a write module 120, used to append data blocks generated by the current modification to the end of the user data area in response to a write request, and update the data stream area and the data block area based on the current modification; an update module 130, used to construct checkpoint records and append checkpoint records to the checkpoint area, wherein when a checkpoint record is successfully written and passes verification, the file's content view is switched to the state pointed to by the checkpoint record; and a read module 140, used to scan backwards from the end of the file in response to a file open request, and construct the file's content view based on the last checkpoint found.
[0058] Furthermore, according to another aspect of this disclosure, an electronic document storage and reading device 200 is also provided. See also... Figure 5The electronic document storage and reading device 200 of this disclosure includes a processor 210 and a memory 220 for storing executable instructions of the processor 210. The processor 210 is configured to implement any of the aforementioned electronic document storage and reading methods when executing the executable instructions.
[0059] It should be noted here that the number of processors 210 can be one or more. Furthermore, the electronic document storage and reading device 200 of this embodiment may also include an input device 230 and an output device 240. The processors 210, memory 220, input device 230, and output device 240 can be connected via a bus or other means, without specific limitations here.
[0060] The memory 220, as a computer-readable storage medium, can be used to store software programs, computer-executable programs, and various modules, such as the program or module corresponding to the electronic document storage and reading method of this disclosure embodiment. The processor 210 executes various functional applications and data processing of the electronic document storage and reading device 200 by running the software program or module stored in the memory 220.
[0061] Input device 230 can be used to receive input digital numbers or signals. These signals may include key signals related to user settings and function control of the device / terminal / server. Output device 240 may include a display device such as a screen.
[0062] According to another aspect of this disclosure, a non-volatile computer-readable storage medium is also provided, on which computer program instructions are stored, which, when executed by processor 210, implement any of the preceding electronic document storage and retrieval methods.
[0063] The various embodiments of this disclosure have been described above. These descriptions are exemplary and not exhaustive, and are not limited to the disclosed embodiments. Many modifications and variations will be apparent to those skilled in the art without departing from the scope and spirit of the described embodiments. The terminology used herein is chosen to best explain the principles, practical applications, or technical improvements to the technology in the market, or to enable others skilled in the art to understand the embodiments disclosed herein.
Claims
1. A method for storing and retrieving electronic documents, characterized in that, include: In response to a new file request, the file is created and logically divided into a checkpoint region, a data stream region, a data block region, and a user data region; In response to the write request, the data block generated by this modification is appended to the end of the user data area, and the data stream area and the data block area are updated based on this modification; Construct checkpoint records and append them to the checkpoint area. When a checkpoint record is successfully written and passes verification, switch the content view of the file to the state pointed to by the checkpoint record. In response to a file open request, the file is scanned backward from the end, and a content view of the file is constructed based on the last checkpoint found.
2. The electronic document storage and retrieval method according to claim 1, characterized in that, In response to a file open request, the process of scanning backwards from the end of the file and constructing a content view of the file based on the last checkpoint found includes: Scan backwards from the end of the file to find the checkpoint region that matches the preset signature and passes self-verification; The first checkpoint detected by the scan is recorded as the root structure of the file; Based on the pointer to the root structure, load the data stream region and the data block region; Based on the loaded data stream region and the data block region, construct the content view of the file.
3. The electronic document storage and retrieval method according to claim 2, characterized in that, The checkpoint record includes a self-checking code, as well as a check code for the data stream region and a check code for the data block region; The checkpoint record that passes the first self-check code scan and passes both the check code for the data stream region and the check code for the data block region is used as the root structure of the file.
4. The electronic document storage and retrieval method according to claim 1, characterized in that, The checkpoint area is located at a preset fixed boundary position in the file; or The checkpoint area is set at the beginning of the file, or at the end of the file, or in an index file independent of the file.
5. The electronic document storage and retrieval method according to claim 4, characterized in that, The size of the checkpoint area is fixed.
6. The electronic document storage and retrieval method according to claim 1, characterized in that, The data block record includes a logical length field and a physical length field; When the physical length is zero and the physical offset is a preset special value, the data indicated by the data block record is sparse data; The difference between the logical length and the physical length supports compressed data storage.
7. The electronic document storage and retrieval method according to claim 1, characterized in that, The method further includes: When a preset trigger condition is met, the valid data pointed to by the latest checkpoint record will be moved to a new storage area. The preset trigger condition includes reaching a preset period or the file being closed. Update the location information of the data stream area and the data block area according to the storage location after the relocation, generate a compact new checkpoint record, and release the storage space occupied by the old data before the relocation.
8. An electronic document storage and retrieval device, characterized in that, include: The new file module is used to respond to a new file request, create a file, and logically divide the file into a checkpoint area, a data stream area, a data block area, and a user data area. The write module is used to respond to a write request by appending the data block generated by the current modification to the end of the user data area, and updating the data stream area and the data block area based on the current modification. The update module is used to construct checkpoint records and append the checkpoint records to the checkpoint area. When the checkpoint record is successfully written and passes the verification, the content view of the file is switched to the state pointed to by the checkpoint record. The reading module is used to scan backwards from the end of the file in response to a file open request, and construct a content view of the file based on the last checkpoint found.
9. An electronic document storage and retrieval device, characterized in that, include: processor; Memory used to store processor-executable instructions; The processor is configured to implement the method of any one of claims 1 to 7 when executing the executable instructions.
10. A non-volatile computer-readable storage medium storing computer program instructions thereon, characterized in that, When the computer program instructions are executed by the processor, they implement the method described in any one of claims 1 to 7.
