File management method and system based on black-white tree hierarchical random packaging and token addressing

CN122903378APending Publication Date: 2026-10-13UNIV OF ELECTRONICS SCI & TECH OF CHINA
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202610796948.5
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-06-04
Publication Date
2026-10-13

AI Technical Summary

Technical Problem

但上述技术方案仅涉及对文件内容的加密存储,仍然存在一定的数据安全风险

Benefits of technology

1、本发明,通过在白节点内随机确定有效数据起始位置,对剩余空间进行随机填充,并结合节点块随机物理分配方式,使文件内容与底层物理位置之间不再形成直接、稳定的线性映射关系,从而降低通过块布局推断文件内容分布的可能性,解决了现有文件系统在数据布局规律性较强、访问入口暴露、索引结构容易被关联分析以及删除后原有定位关系仍可能被重建等问题。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122903378A_ABST
    Figure CN122903378A_ABST
Patent Text Reader

Abstract

The application discloses a file management method and system based on black and white tree layered random packaging and token addressing, relates to the field of file storage and data security, and comprises the following steps: cutting a file to be accessed into multiple data segments, and respectively constructing white nodes for carrying real file contents; performing random packaging and preset node processing on the white nodes to generate white node blocks, then constructing black nodes carrying node index relationships through index item aggregation, and recursively forming a black and white tree structure; subsequently, allocating underlying physical blocks to the black and white nodes through a bitmap block management mechanism, and generating an access token through root black node parameter coding to establish a mapping relationship of a path to the access token; based on the access token, file reading, deleting and updating operations can be completed. The application realizes layered isolation of file contents, index structures and underlying physical layouts, reduces direct correlation between file data and physical blocks, and improves the security and privacy protection capability of the file access process.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of file storage and data security, specifically to a file management method and system based on black-and-white tree hierarchical random encapsulation and token addressing. Background Technology

[0002] With the increasing demands for data security, file systems not only need to provide basic data writing, reading, and deletion functions, but also need to minimize the direct correlation between file content, index structure, and underlying physical layout. Existing file systems typically use directory entries, paths, inodes, or other fixed index structures to locate and manage files. Even when file content is encrypted, the physical block distribution, index organization, and access paths often exhibit strong regularity, allowing attackers to infer the correspondence between file data and the underlying media, thus limiting privacy protection capabilities. On the other hand, traditional encrypted storage schemes usually directly bind addressing information to the data body or fixed metadata structure. File reading relies on pre-exposed paths or index entries, making it difficult to further hide underlying node relationships at the access entry layer. When attackers possess file paths, index entries, or underlying metadata information, they can still perform correlation analysis on file location, structural relationships, and even data block distribution. Furthermore, conventional file deletion mostly manifests as directory entry deletion, index dereferencing, or block occupancy mark release. If the original location relationship can still be reconstructed, the underlying data remains at risk of being recovered or subjected to correlation analysis.

[0003] Chinese invention patent document CN111090616A, published on May 1, 2020, discloses a file management method, corresponding device, equipment, and storage medium. The method includes: dividing the acquired target file into file blocks, storing each file block in a corresponding storage space according to a preset method, and forming an index table based on the storage location of each file block. Compared with the prior art, this invention divides the acquired target file into multiple file blocks and stores them in corresponding storage spaces, achieving distributed storage of the target file and ensuring file security. However, the above technical solution only involves encrypted storage of file content, and certain data security risks still exist. Summary of the Invention

[0004] To overcome the defects and shortcomings of the existing technology, the present invention provides a file management method and system based on black-and-white tree hierarchical random encapsulation and token addressing, which enables file data to be not directly mapped to the underlying physical block in a linear manner and to tokenize the file access entry, thereby reducing the direct correlation between file content, index structure and physical layout.

[0005] This invention is achieved through the following technical solution: The file management method based on black-and-white tree hierarchical random encapsulation and token addressing includes the following steps: S1. Receive the file to be accessed, divide the file to be accessed into multiple data segments according to the preset node payload capacity, and construct a white node for each data segment to carry the actual file content. S2. After performing node encapsulation processing on each white node, perform preset node processing according to the processing level to generate the corresponding white node binary block; S3. Generate corresponding index entries for each white node binary block, and aggregate multiple index entries to form black nodes for carrying index relationships. When the capacity of the current layer black nodes is insufficient, recursively generate upper-level indexes for black nodes and construct higher-level black nodes until a unique root black node is formed. Perform node encapsulation processing corresponding to white nodes and preset node processing based on processing level on each black node to generate corresponding black node binary blocks, thereby forming a black-white tree structure in which white nodes carry file data and black nodes carry node index relationships. S4. Allocate underlying physical blocks for each white node and each black node through the bitmap block management mechanism, write the node binary blocks corresponding to each white node and each black node into the underlying storage medium, supplement the physical block position corresponding to the node into the relevant index entries, and update the bitmap marker. S5. After all nodes have been written, the root black node is used as the file recovery entry point. The parameters corresponding to the root black node are extracted and encoded to generate an access token for file access and to establish a mapping relationship between the path and the access token. S6. Obtain an access token based on the mapping relationship and execute file read request, file delete request, or file update request.

[0006] In step S1, the file to be accessed is sequentially divided into multiple data segments. , , ..., And satisfy:

[0007] In the formula, For the file to be accessed, This indicates sequential splicing.

[0008] The node encapsulation process includes: writing a node identifier field into a pre-set length node block, determining the starting offset of the node's payload according to a random seed, writing the corresponding data fragment or index item into the starting offset, and randomly filling the remaining space of the fixed-length node block; wherein, when the node is a white node, the payload is the corresponding data fragment; when the node is a black node, the payload is a set of index items consisting of one or more index items.

[0009] In S3, the index item includes at least the node location, node type, node payload start offset, effective length, node random seed, and processing level; the black node is used to carry the index relationship to white nodes or other levels of black nodes.

[0010] In step S4, allocating underlying physical blocks to each white node and each black node through the bitmap block management mechanism includes: first reading the current set of free blocks, then shuffling the candidate physical blocks based on a random strategy, and finally selecting the target physical block from them.

[0011] In S5, the parameters corresponding to the root black node include at least the physical block location where the node is located, the starting offset of the node's effective payload, the effective length, the node's random seed, and the processing level.

[0012] In step S6, the execution of the file read request specifically includes: First, the access token is obtained according to the mapping relationship, and the access token is decoded to restore the parameters of the root black node. Then, the physical block where the root black node is located is read, and reverse node processing is performed to obtain the set of index items in the root black node. The reverse node processing refers to the reverse processing corresponding to the preset node processing. If the index entry points to a black node, continue reading the next-level black node and perform reverse node processing; if the index entry points to a white node binary block, add the white node binary block to the white node access list. After traversing the entire black-and-white tree structure, data fragments are extracted from the binary blocks of each white node in the white node access list in sequence, based on the starting offset and effective length of its node payload. All data fragments are then sequentially concatenated to restore the original file content.

[0013] In step S6, the file deletion request specifically includes: First, the access token is obtained according to the mapping relationship, and the access token is decoded to restore the parameters of the root black node. Then, the physical block where the root black node is located is read, and reverse node processing is performed to obtain the set of index items in the root black node. The reverse node processing refers to the reverse processing corresponding to the preset node processing. Starting from the root black node, traverse all associated black and white node binary blocks to obtain the underlying physical block set corresponding to the file. Then, clear the occupancy marks of these physical blocks in the bitmap and return them to the free block set.

[0014] In step S6, the file update request specifically includes: Read the original file content based on the old access token and write it to the temporary image; The original file content is modified in a temporary image to obtain an updated file; For the updated file, re-execute the S1-S5 process to generate a new black-and-white tree structure and a new access token; Update the file path mapping to point to the new access token; Release the node chain corresponding to the original file content based on the old access token.

[0015] A file management system based on black-and-white tree hierarchical random encapsulation and token addressing includes: The file segmentation module is used to receive the file to be accessed, segment the file to be accessed according to the preset node payload capacity to obtain multiple data segments, and construct a white node for each data segment to carry the actual file content. The white node encapsulation module is used to perform node encapsulation processing on each white node and then perform preset node processing according to the processing level to generate the corresponding white node binary block. The black node construction module is used to generate corresponding index entries for each white node binary block and aggregate multiple index entries to form a black node to carry the index relationship. When the capacity of the current layer black node is insufficient, the upper-level index is recursively generated for the black node and a higher-level black node is constructed until a unique root black node is formed. Node encapsulation processing is performed on each black node to generate the corresponding black node binary block, thereby forming a black-and-white tree structure in which white nodes carry file data and black nodes carry node index relationships. The physical block allocation module is used to allocate underlying physical blocks to each white node and each black node through the bitmap block management mechanism, write the node binary blocks corresponding to each white node and each black node to the underlying storage medium, supplement the corresponding physical block positions to the relevant index entries, and update the bitmap markers. The token generation and parsing module is used to extract the corresponding parameters of the root black node as the file recovery entry point after all nodes have finished writing, encode them, generate an access token for file access, and establish a mapping relationship between the path and the access token. The execution module is used to execute file read requests, file delete requests, or file update requests; The execution module includes a file reading unit for traversing the black-and-white tree based on the access token, extracting data fragments from each white node block and concatenating them sequentially to restore the original file; a file deletion unit for traversing the black-and-white tree based on the access token, collecting the occupied physical blocks and releasing them back to the free block set; and a file update unit for first generating a new black-and-white tree and a new token based on the updated file, and then releasing the physical blocks occupied by the old black-and-white tree.

[0016] Compared with the prior art, the advantages of the present invention are as follows: 1. This invention, by randomly determining the starting position of valid data within white nodes and randomly filling the remaining space, combined with a random physical allocation method for node blocks, eliminates the direct and stable linear mapping relationship between file content and underlying physical location. This reduces the possibility of inferring the file content distribution through block layout and solves the problems of existing file systems, such as strong regularity in data layout, exposed access entry points, easy correlation analysis of index structure, and the possibility of rebuilding the original positioning relationship after deletion.

[0017] 2. This invention adopts a hierarchical organization method in which "white nodes carry actual data and black nodes carry index relationships" to separate the data ontology from the addressing relationship. Compared with the traditional method of directory entries or fixed indexes directly pointing to data blocks, this method is more conducive to reducing the privacy risks caused by the exposure of the addressing structure.

[0018] 3. This invention encapsulates the root black node addressing parameters and related decoding parameters with a token, so that file access does not need to use a fixed path or public index structure as the underlying entry point, thereby reducing the direct exposure of external metadata to the internal node layout. Attached Figure Description

[0019] Figure 1 This is a flowchart of the method steps of the present invention; Figure 2 This is a schematic diagram of the system framework of the present invention. Detailed Implementation

[0020] The technical solutions in the embodiments of the present invention will be clearly and completely described below. Obviously, the described embodiments are only a part of the embodiments of the present invention, and not all of them. Based on the embodiments of the present invention, all other embodiments obtained by those of ordinary skill in the art without creative effort are within the scope of protection of the present invention.

[0021] Example 1 As a preferred embodiment of the present invention, this embodiment discloses a file management method based on black-and-white tree hierarchical random encapsulation and token addressing, including the following steps: S1, User First, submit the file to be saved. Upon receiving the file, the file to be stored is sequentially segmented according to the preset node payload capacity, resulting in multiple data fragments. , , ..., And satisfy:

[0022] In the formula, For the file to be accessed, Indicates sequential splicing; For each data segment Construct a corresponding white node White nodes The actual file content used to carry this fragment; S2. Perform node encapsulation processing on each white node: For each white node... First, write the node identifier field into the fixed-length node block, and then use a random seed. Determine the initial offset of the white node's payload. and data fragments Write to this location, and then fill the remaining space in the node block with random bytes; the node encapsulation process includes: writing a node identifier field into a pre-set length node block, determining the starting offset of the node's payload according to a random seed, writing the corresponding data fragment or index item to the starting offset, and randomly filling the remaining space of the fixed-length node block; wherein, when the node is a white node, the payload is the corresponding data fragment; when the node is a black node, the payload is a set of index items consisting of one or more index items; Then, based on the processing level Perform preset node processing on the entire node block to generate the corresponding white node binary block. At this point, the actual data location of the white node is determined by... and If determined jointly, it can be represented as ; S3. Generate corresponding index entries for each white node binary block. Index item At least include the node's location, node type, and the starting offset of the node's payload. Effective length Random seed for nodes and processing levels ; and aggregate multiple index entries to form a black node used to carry the index relationship. black node It does not directly carry file content, but is used to describe the positioning relationship of white nodes or lower-level black nodes. When the capacity of the current level black node is insufficient, it recursively generates upper-level indexes for black nodes and constructs higher-level black nodes until a unique root black node is formed. Each black node is encapsulated and pre-processed based on the processing level for the corresponding white node, generating a corresponding black node binary block, thus forming a black-and-white tree structure in which white nodes carry file data and black nodes carry node index relationships. S4. After the black-and-white tree is formed, the underlying physical blocks are allocated to each white node and each black node through the bitmap block management mechanism. The node binary blocks corresponding to each white node and each black node are written to the underlying storage medium. First, the current set of free blocks is read. The candidate physical blocks are shuffled based on a random strategy, and then the target physical block is selected from them. The process involves adding the physical block location corresponding to the node to the relevant index entry and updating the bitmap marker to indicate that the physical block has been occupied; this process can be represented as follows: ← or ← Because the distribution of nodes in the underlying medium is random, there is no longer a direct one-to-one correspondence between the file's logical structure and its physical block layout; S5. After all nodes have finished writing, the system will blacken the root node. This serves as the entry point for restoring the entire file, and extracts the physical block location of the root black node, the starting offset of the node's effective payload, the effective length, the node's random seed, and the processing level, etc. parameter It is encoded to generate an access token for file access. This process can be represented as

[0023] Then, a mapping relationship between the path and the token is established. ,Right now In this way, the path layer only stores the logical access entry point, without directly exposing the physical locations of the underlying white and black nodes. When a user accesses a file subsequently, they actually obtain the path first. Then through Restore the corresponding file.

[0024] S6, when the user When initiating a file read request, the system first determines the path mapping relationship. Obtain access token and to Perform parsing and restore the root black node. The system then reads the physical block containing the root black node and performs reverse node processing on it. This reverse node processing is the inverse processing corresponding to the preset node processing, resulting in the set of index entries for that black node. If an index entry points to a black node, the system continues reading the next-level black node; if an index entry points to a white node, the system adds that white node to the white node access list. After the entire black-and-white tree traversal is complete, the system restores the valid data fragments from each white node in sequence and concatenates them to obtain...

[0025] Therefore, as long as If the node chain is valid and complete, the system can correctly recover the original file content.

[0026] Example 2 As another preferred embodiment of the present invention, this embodiment discloses a file management method based on black-and-white tree hierarchical random encapsulation and token addressing, including the following steps: S1, User First, submit the file to be saved. Upon receiving the file, the file to be stored is sequentially segmented according to the preset node payload capacity, resulting in multiple data fragments. , , ..., And satisfy:

[0027] In the formula, For the file to be accessed, Indicates sequential splicing; For each data segment Construct a corresponding white node White nodes The actual file content used to carry this fragment; S2. Perform node encapsulation processing on each white node: For each white node... First, write the node identifier field into the fixed-length node block, and then use a random seed. Determine the initial offset of the white node's payload. and data fragments Write to this location, and then fill the remaining space in the node block with random bytes; the node encapsulation process includes: writing a node identifier field into a pre-set length node block, determining the starting offset of the node's payload according to a random seed, writing the corresponding data fragment or index item to the starting offset, and randomly filling the remaining space of the fixed-length node block; wherein, when the node is a white node, the payload is the corresponding data fragment; when the node is a black node, the payload is a set of index items consisting of one or more index items; Then, based on the processing level Perform preset node processing on the entire node block to generate the corresponding white node binary block. At this point, the actual data location of the white node is determined by... and If determined jointly, it can be represented as ; S3. Generate corresponding index entries for each white node binary block. Index item At least include the node's location, node type, and the starting offset of the node's payload. Effective length Random seed for nodes and processing levels ; and aggregate multiple index entries to form a black node used to carry the index relationship. black node It does not directly carry file content, but is used to describe the positioning relationship of white nodes or lower-level black nodes. When the capacity of the current level black node is insufficient, it recursively generates upper-level indexes for black nodes and constructs higher-level black nodes until a unique root black node is formed. Each black node is encapsulated and pre-processed based on the processing level for the corresponding white node, generating a corresponding black node binary block, thus forming a black-and-white tree structure in which white nodes carry file data and black nodes carry node index relationships. S4. After the black-and-white tree is formed, the underlying physical blocks are allocated to each white node and each black node through the bitmap block management mechanism. The node binary blocks corresponding to each white node and each black node are written to the underlying storage medium. First, the current set of free blocks is read. The candidate physical blocks are shuffled based on a random strategy, and then the target physical block is selected from them. The process involves adding the physical block location corresponding to the node to the relevant index entry and updating the bitmap marker to indicate that the physical block has been occupied; this process can be represented as follows: ← or ← Because the distribution of nodes in the underlying medium is random, there is no longer a direct one-to-one correspondence between the file's logical structure and its physical block layout; S5. After all nodes have finished writing, the system will blacken the root node. This serves as the entry point for restoring the entire file. Parameters such as the physical block location of the root black node, the node's payload start offset, effective length, node random seed, and processing level are extracted, encoded, and used to generate an access token for file access. This process can be represented as

[0028] Then, a mapping relationship between the path and the token is established. ,Right now In this way, the path layer only stores the logical access entry point, without directly exposing the physical locations of the underlying white and black nodes. When a user accesses a file subsequently, they actually obtain the path first. Then through Restore the corresponding file.

[0029] S6, when the user When initiating a file deletion request, the system also first obtains an access token. , and by Restore the root black node Subsequently, the system traverses all associated black and white nodes starting from the root black node to obtain the set of physical blocks corresponding to the file. The system then sequentially removes the occupied markers from these physical blocks in the bitmap, returning them to the set of free blocks. After deletion, the original token... Although it may still exist in form, its corresponding node chain has been released. The file no longer has effective addressing capabilities and cannot be fully recovered as before deletion. In other words, the deletion effect in this embodiment is mainly manifested in the failure of the access point and the interruption of the node chain.

[0030] Example 3 As another preferred embodiment of the present invention, this embodiment discloses a file management method based on black-and-white tree hierarchical random encapsulation and token addressing, including the following steps: S1, User First, submit the file to be saved. Upon receiving the file, the file to be stored is sequentially segmented according to the preset node payload capacity, resulting in multiple data fragments. , , ..., And satisfy:

[0031] In the formula, For the file to be accessed, Indicates sequential splicing; For each data segment Construct a corresponding white node White nodes The actual file content used to carry this fragment; S2. Perform node encapsulation processing on each white node: For each white node... First, write the node identifier field into the fixed-length node block, and then use a random seed. Determine the initial offset of the white node's payload. and data fragments Write to this location, and then fill the remaining space in the node block with random bytes; the node encapsulation process includes: writing a node identifier field into a pre-set length node block, determining the starting offset of the node's payload according to a random seed, writing the corresponding data fragment or index item to the starting offset, and randomly filling the remaining space of the fixed-length node block; wherein, when the node is a white node, the payload is the corresponding data fragment; when the node is a black node, the payload is a set of index items consisting of one or more index items; Then, based on the processing level Perform preset node processing on the entire node block to generate the corresponding white node binary block. At this point, the actual data location of the white node is determined by... and If determined jointly, it can be represented as ; S3. Generate corresponding index entries for each white node binary block. Index item At least include the node's location, node type, and the starting offset of the node's payload. Effective length Random seed for nodes and processing levels ; and aggregate multiple index entries to form a black node used to carry the index relationship. black node It does not directly carry file content, but is used to describe the positioning relationship of white nodes or lower-level black nodes. When the capacity of the current level black node is insufficient, it recursively generates upper-level indexes for black nodes and constructs higher-level black nodes until a unique root black node is formed. Each black node is encapsulated and pre-processed based on the processing level for the corresponding white node, generating a corresponding black node binary block, thus forming a black-and-white tree structure in which white nodes carry file data and black nodes carry node index relationships. S4. After the black-and-white tree is formed, the underlying physical blocks are allocated to each white node and each black node through the bitmap block management mechanism. The node binary blocks corresponding to each white node and each black node are written to the underlying storage medium. First, the current set of free blocks is read. The candidate physical blocks are shuffled based on a random strategy, and then the target physical block is selected from them. The process involves adding the physical block location corresponding to the node to the relevant index entry and updating the bitmap marker to indicate that the physical block has been occupied; this process can be represented as follows: ← or ← Because the distribution of nodes in the underlying medium is random, there is no longer a direct one-to-one correspondence between the file's logical structure and its physical block layout; S5. After all nodes have finished writing, the system will blacken the root node. This serves as the entry point for restoring the entire file. Parameters such as the physical block location of the root black node, the node's payload start offset, effective length, node random seed, and processing level are extracted, encoded, and used to generate an access token for file access. This process can be represented as

[0032] Then, a mapping relationship between the path and the token is established. ,Right now In this way, the path layer only stores the logical access entry point, without directly exposing the physical locations of the underlying white and black nodes. When a user accesses a file subsequently, they actually obtain the path first. Then through Restore the corresponding file.

[0033] S6, when the user When a file needs to be updated, the system preferentially adopts the method of "building a new tree first, then deleting the old tree" to complete the update. Specifically, the system first uses the old token... Read the contents of the original file and write it to a temporary mirror. Users in After making the modifications, you will get the updated file. Subsequently, the system... Re-execute file splitting, white node construction, black node construction, random block allocation, and root node encoding to generate a new black-and-white tree and a new access token. .exist After successful generation, the system updates the path mapping relationship, making... Finally, based on the old token Release the node chain corresponding to the old file. In this way, there is always at least one recoverable version before and after the update, thus ensuring the consistency and availability of the file update process.

[0034] Example 4 This embodiment provides a file management system based on black-and-white tree hierarchical random encapsulation and token addressing, including: The file segmentation module is used to receive the file to be accessed, segment the file to be accessed according to the preset node payload capacity to obtain multiple data segments, and construct a white node for each data segment to carry the actual file content. The white node encapsulation module is used to perform node encapsulation processing on each white node and then perform preset node processing according to the processing level to generate the corresponding white node binary block. The black node construction module is used to generate corresponding index entries for each white node binary block and aggregate multiple index entries to form a black node to carry the index relationship. When the capacity of the current layer black node is insufficient, the upper-level index is recursively generated for the black node and a higher-level black node is constructed until a unique root black node is formed. The module also performs node encapsulation processing corresponding to the white node and preset node processing based on the processing level on each black node to generate the corresponding black node binary block, thereby forming a black-white tree structure in which white nodes carry file data and black nodes carry node index relationships. The physical block allocation module is used to allocate underlying physical blocks to each white node and each black node through the bitmap block management mechanism, write the node binary blocks corresponding to each white node and each black node to the underlying storage medium, supplement the corresponding physical block positions to the relevant index entries, and update the bitmap markers. The token generation and parsing module is used to extract the corresponding parameters of the root black node as the file recovery entry point after all nodes have finished writing, encode them, generate an access token for file access, and establish a mapping relationship between the path and the access token. The execution module is used to execute file read requests, file delete requests, or file update requests; The execution module includes a file reading unit for traversing the black-and-white tree based on the access token, extracting data fragments from each white node block and concatenating them sequentially to restore the original file; a file deletion unit for traversing the black-and-white tree based on the access token, collecting the occupied physical blocks and releasing them back to the free block set; and a file update unit for first generating a new black-and-white tree and a new token based on the updated file, and then releasing the physical blocks occupied by the old black-and-white tree.

Claims

1. A file management method based on black-and-white tree hierarchical random encapsulation and token addressing, characterized in that, Includes the following steps: S1. Receive the file to be accessed, divide the file to be accessed into multiple data segments according to the preset node payload capacity, and construct a white node for each data segment to carry the actual file content. S2. After performing node encapsulation processing on each white node, perform preset node processing according to the processing level to generate the corresponding white node binary block; S3. Generate corresponding index entries for each white node binary block, and aggregate multiple index entries to form black nodes for carrying index relationships. When the capacity of the current layer black nodes is insufficient, recursively generate upper-level indexes for black nodes and construct higher-level black nodes until a unique root black node is formed. Perform node encapsulation processing corresponding to white nodes and preset node processing based on processing level on each black node to generate corresponding black node binary blocks, thereby forming a black-white tree structure in which white nodes carry file data and black nodes carry node index relationships. S4. Allocate underlying physical blocks for each white node and each black node through the bitmap block management mechanism, write the node binary blocks corresponding to each white node and each black node into the underlying storage medium, supplement the physical block position corresponding to the node into the relevant index entries, and update the bitmap marker. S5. After all nodes have been written, the root black node is used as the file recovery entry point. The parameters corresponding to the root black node are extracted and encoded to generate an access token for file access and to establish a mapping relationship between the path and the access token. S6. Obtain an access token based on the mapping relationship and execute file read request, file delete request, or file update request.

2. The file management method based on black-and-white tree hierarchical random encapsulation and token addressing according to claim 1, characterized in that: In step S1, the file to be accessed is sequentially divided into multiple data segments. , , ..., And satisfy: In the formula, For the file to be accessed, This indicates sequential splicing.

3. The file management method based on black-and-white tree hierarchical random encapsulation and token addressing according to claim 1, characterized in that: The node encapsulation process includes: writing a node identifier field into a pre-set length node block, determining the starting offset of the node's payload according to a random seed, writing the corresponding data fragment or index item into the starting offset, and randomly filling the remaining space of the fixed-length node block; wherein, when the node is a white node, the payload is the corresponding data fragment; when the node is a black node, the payload is a set of index items consisting of one or more index items.

4. The file management method based on black-and-white tree hierarchical random encapsulation and token addressing according to claim 1, characterized in that: In S3, the index item includes at least the node location, node type, starting offset of node payload, effective length, node random seed, and processing level; the black node is used to carry the index relationship to white nodes or other levels of black nodes.

5. The file management method based on black-and-white tree hierarchical random encapsulation and token addressing according to claim 1, characterized in that: In step S4, allocating underlying physical blocks to each white node and each black node through the bitmap block management mechanism includes: first reading the current set of free blocks, then shuffling the candidate physical blocks based on a random strategy, and finally selecting the target physical block from them.

6. The file management method based on black-and-white tree hierarchical random encapsulation and token addressing according to claim 1, characterized in that: In S5, the parameters corresponding to the root black node include at least the physical block location where the node is located, the starting offset of the node's effective payload, the effective length, the node's random seed, and the processing level.

7. The file management method based on black-and-white tree hierarchical random encapsulation and token addressing according to claim 1, characterized in that: In step S6, the execution of the file read request specifically includes: First, the access token is obtained according to the mapping relationship, and the access token is decoded to restore the parameters of the root black node. Then, the physical block where the root black node is located is read, and reverse node processing is performed to obtain the set of index items in the root black node. If the index item points to a black node, then continue reading the next-level black node and perform reverse node processing; the reverse node processing refers to the reverse processing corresponding to the preset node processing; if the index item points to a white node binary block, then add the white node binary block to the white node access list. After traversing the entire black-and-white tree structure, data fragments are extracted from the binary blocks of each white node in the white node access list in sequence, based on the starting offset and effective length of its node payload. All data fragments are then sequentially concatenated to restore the original file content.

8. The file management method based on black-and-white tree hierarchical random encapsulation and token addressing according to claim 1, characterized in that: In step S6, the file deletion request specifically includes: First, the access token is obtained according to the mapping relationship, and the access token is decoded to restore the parameters of the root black node. Then, the physical block where the root black node is located is read, and reverse node processing is performed to obtain the set of index items in the root black node. The reverse node processing refers to the reverse processing corresponding to the preset node processing. Starting from the root black node, traverse all associated black and white node binary blocks to obtain the underlying physical block set corresponding to the file. Then, clear the occupancy marks of these physical blocks in the bitmap and return them to the free block set.

9. The file management method based on black-and-white tree hierarchical random encapsulation and token addressing according to claim 1, characterized in that: In step S6, the file update request specifically includes: Read the original file content based on the old access token and write it to the temporary image; The original file content is modified in a temporary image to obtain an updated file; For the updated file, re-execute the S1-S5 process to generate a new black-and-white tree structure and a new access token; Update the file path mapping to point to the new access token; Release the node chain corresponding to the original file content based on the old access token.

10. A file management system based on black-and-white tree hierarchical random encapsulation and token addressing, characterized in that: It includes a file segmentation module, which receives the file to be accessed, segments the file to be accessed according to the preset node payload capacity to obtain multiple data segments, and constructs a white node for each data segment to carry the actual file content. The white node encapsulation module is used to perform node encapsulation processing on each white node and then perform preset node processing according to the processing level to generate the corresponding white node binary block. The black node construction module is used to generate corresponding index entries for each white node binary block and aggregate multiple index entries to form a black node to carry the index relationship. When the capacity of the current layer black node is insufficient, the upper-level index is recursively generated for the black node and a higher-level black node is constructed until a unique root black node is formed. The module also performs node encapsulation processing corresponding to the white node and preset node processing based on the processing level on each black node to generate the corresponding black node binary block, thereby forming a black-white tree structure in which white nodes carry file data and black nodes carry node index relationships. The physical block allocation module is used to allocate underlying physical blocks to each white node and each black node through the bitmap block management mechanism, write the node binary blocks corresponding to each white node and each black node to the underlying storage medium, supplement the corresponding physical block positions to the relevant index entries, and update the bitmap markers. The token generation and parsing module is used to extract the corresponding parameters of the root black node as the file recovery entry point after all nodes have finished writing, encode them, generate an access token for file access, and establish a mapping relationship between the path and the access token. The execution module is used to execute file read requests, file delete requests, or file update requests; The execution module includes a file reading unit for traversing the black-and-white tree based on the access token, extracting data fragments from each white node block and concatenating them sequentially to restore the original file; a file deletion unit for traversing the black-and-white tree based on the access token, collecting the occupied physical blocks and releasing them back to the free block set; and a file update unit for first generating a new black-and-white tree and a new token based on the updated file, and then releasing the physical blocks occupied by the old black-and-white tree.

Citation Information

Patent Citations

  • File management method, corresponding device, equipment and storage medium

    CN111090616A