Method for generating file index data, file access method, directory reading method, computing device, storage medium, and product
By dynamically generating target hash seeds in the storage system, the hash collision problem is resolved, and the retrieval efficiency and accuracy of the storage system are improved.
Patent Information
- Application Number
- PCT/CN2026/085035
- Authority / Receiving Office
- WO · WO
- Patent Type
- Applications
- Current Assignee / Owner
- Priority Date
- 2025-05-22
- Filing Date
- 2026-03-20
- Publication Date
- 2026-11-26
AI Technical Summary
Hash algorithms are prone to hash collisions when generating file index data, which affects the retrieval efficiency and accuracy of the storage system.
By determining the hash seed set corresponding to the target directory, a target hash seed is generated, and a globally unique hash value is generated based on the target hash seed and the file identifier. The hash seed set is dynamically updated to avoid hash collisions.
It improves the query efficiency and accuracy of the storage system and avoids hash collisions.
Smart Images

Figure CN2026085035_26112026_PF_FP_ABST
Abstract
Description
Methods for generating file index data, file access methods, directory reading methods, computing devices, storage media and products
[0001] This disclosure claims priority to Chinese Patent Application No. 202510671831.X, filed with the China Patent Office on May 22, 2025, entitled “Method for generating document index data, document access method, directory reading method, computing device, storage medium and product”, the entire contents of which are incorporated herein by reference. Technical Field
[0002] This disclosure relates to the field of storage technology, and in particular to a method for generating file index data, a file access method, a directory reading method, a computing device, a computer-readable storage medium, and a computer program product. Background Technology
[0003] In storage systems, to enable fast location and retrieval of stored files, a hash algorithm is typically used when a file request is submitted to the storage system. This hash value is calculated based on the file identifier. This hash value is then used as the file's index data, allowing for quick location of the file within the storage system and improving file access efficiency.
[0004] However, due to the nature of hash algorithms, which convert longer file identifiers into shorter hash values, it is inevitable that different file identifiers will produce the same hash value, i.e., hash collisions. Once a hash collision occurs, it becomes difficult to accurately determine the corresponding file when retrieving a file from the file index table, thus affecting the retrieval efficiency and accuracy of the storage system.
[0005] Therefore, how to avoid hash collisions when generating index data for files, thereby improving the retrieval efficiency and accuracy of the storage system, has become an urgent technical problem to be solved. Summary of the Invention
[0006] This disclosure provides a method for generating file index data, a file access method, a directory reading method, a computing device, a computer-readable storage medium, and a computer program product.
[0007] In a first aspect, this disclosure provides a method for generating file index data, including:
[0008] Determine the target directory corresponding to the target file;
[0009] Obtain the hash seed set corresponding to the target directory, wherein the hash seed set includes at least one hash seed;
[0010] Based on any hash seed and the file identifier of the target file, generate a first hash value corresponding to each hash seed, and search the file index table of the storage system to see if the first hash value exists.
[0011] If the first hash value corresponding to each of the hash seeds exists in all of the file index tables, a target hash seed is generated.
[0012] A second hash value is generated based on the target hash seed and the file identifier of the target file, and the second hash value is used as the index data of the target file.
[0013] Update the hash seed set corresponding to the target directory based on the target hash seed.
[0014] Secondly, this disclosure provides a file access method, including:
[0015] Receive an access request for a target file, the access request including the file identifier of the target file and the directory identifier of the target directory to be accessed;
[0016] Obtain the hash seed set of the target directory, wherein the hash seed set includes at least one default hash seed;
[0017] Based on any of the default hash seeds and the file identifier, a third hash value is generated, and the existence of the third hash value is checked from the file index table.
[0018] If a third hash value corresponding to at least one default hash seed exists in all of the file index tables, an extended hash seed is generated, and a fourth hash value is generated based on the extended hash seed and the file identifier, and the target file is accessed based on the fourth hash value.
[0019] Thirdly, this disclosure provides a directory reading method, including:
[0020] Receive read requests for the target directory sent by the client;
[0021] In response to the read request, multiple files recorded in the target directory are determined, wherein the index data corresponding to the multiple files is generated through the following operations: any one file is taken as the target file; a hash seed set corresponding to the target directory is obtained, the hash seed set including at least one hash seed; based on any hash seed and the file identifier of the target file, a fifth hash value corresponding to each hash seed is generated, and the existence of the fifth hash value is checked in the file index table of the storage system; if the fifth hash value corresponding to each hash seed exists in all files in the file index table, a target hash seed is generated; a sixth hash value is generated based on the target hash seed and the file identifier of the target file, and the sixth hash value is used as the index data of the target file;
[0022] Based on the index data, the multiple files are paginated to obtain multiple directory pages;
[0023] The multiple directory pages are sent to the client in sequence.
[0024] Fourthly, this disclosure provides an apparatus for generating file index data, comprising:
[0025] The first determination module is used to determine the target directory corresponding to the target file;
[0026] The first acquisition module is used to acquire the hash seed set corresponding to the target directory, wherein the hash seed set includes at least one hash seed;
[0027] The first generation module is used to generate a first hash value corresponding to each hash seed based on any hash seed and the file identifier of the target file, and to search for the existence of the first hash value in the file index table of the storage system.
[0028] The second generation module is used to generate a target hash seed when the first hash value corresponding to each hash seed exists in the file index table.
[0029] The third generation module is used to generate a second hash value based on the target hash seed and the file identifier of the target file, and use the second hash value as the index data of the target file;
[0030] The first update module is used to update the hash seed set corresponding to the target directory according to the target hash seed.
[0031] Fifthly, this disclosure provides a file access device, including:
[0032] The first receiving module is configured to receive an access request for a target file, the access request including the file identifier of the target file and the directory identifier of the target directory to be accessed;
[0033] The second acquisition module is used to acquire the hash seed set of the target directory. The hash seed set includes at least one hash seed, and the at least one hash seed includes at least one default hash seed and an extended hash seed. The extended hash seed is generated when the first hash value corresponding to the at least one default hash seed exists in the index data.
[0034] The fourth generation module is used to generate a third hash value based on any of the default hash seeds and the file identifier, and to search the file index table to see if the third hash value exists.
[0035] The fifth generation module is used to generate an extended hash seed when the file index table contains a third hash value corresponding to each of the at least one default hash seed, and to generate a fourth hash value based on the extended hash seed and the file identifier, and to access the target file based on the fourth hash value.
[0036] Sixthly, this disclosure provides a directory reading device, including:
[0037] The second receiving module is used to receive read requests for the target directory sent by the client;
[0038] The second determining module is configured to, in response to the read request, determine multiple files recorded in the target directory, wherein the index data corresponding to the multiple files is generated through the following operations: taking any one file as the target file; obtaining a hash seed set corresponding to the target directory, the hash seed set including at least one hash seed; generating a fifth hash value corresponding to each hash seed based on any hash seed and the file identifier of the target file, and checking whether the fifth hash value exists in the file index table of the storage system; if the fifth hash value corresponding to each hash seed exists in all the file index tables, generating a target hash seed; generating a sixth hash value based on the target hash seed and the file identifier of the target file, and using the sixth hash value as the index data of the target file;
[0039] The pagination module is used to paginate the multiple files based on the index data to obtain multiple directory pages;
[0040] The sending module is used to send the plurality of directory pages to the client in sequence.
[0041] In a seventh aspect, this disclosure provides a computing device, including a processing component and a storage component;
[0042] The storage component stores a computer program; the computer program is invoked and executed by the processing component to implement the file index data generation method provided in the embodiments of this disclosure, or to implement the file access method provided in the embodiments of this disclosure, or to implement the directory reading method provided in the embodiments of this disclosure.
[0043] Eighthly, this disclosure provides a computer-readable storage medium having a computer program stored thereon. When executed by a processing component, the computer program implements a method for generating file index data, a method for accessing files, or a method for reading directories provided in this disclosure.
[0044] Ninthly, this disclosure provides a computer program product, including a computer program or instructions, which, when executed by a processing component, implement the file index data generation method provided in this disclosure, or implement the file access method provided in this disclosure, or implement the directory reading method provided in this disclosure.
[0045] This embodiment employs the following technical solution: determining the target directory corresponding to the target file; obtaining a hash seed set corresponding to the target directory, the hash seed set including at least one hash seed; generating a first hash value corresponding to each hash seed based on any hash seed and the file identifier of the target file, and checking whether the first hash value exists in the file index table of the storage system; generating a target hash seed if the first hash value corresponding to each hash seed exists in the file index table; generating a second hash value based on the target hash seed and the file identifier of the target file, and using the second hash value as the index data of the target file; and updating the hash seed set corresponding to the target directory according to the target hash seed. This solution allows for the dynamic generation of a new target hash seed in the event of a hash collision, thereby enabling the generation of globally unique hash values using the target hash seed, avoiding hash collisions, and ultimately improving the query efficiency and accuracy of the storage system.
[0046] These or other aspects of this disclosure will become more apparent in the following description of embodiments. Attached Figure Description
[0047] The accompanying drawings, which are included to provide a further understanding of this disclosure and form part of this disclosure, illustrate exemplary embodiments of the present disclosure and are used to explain the disclosure, but do not constitute an undue limitation of the disclosure. In the drawings:
[0048] Figure 1 illustrates the storage and management structure of directory entries in the file system in the database and memory.
[0049] Figure 2 shows a system architecture diagram in which the technical solution of an embodiment of this disclosure can be applied;
[0050] Figure 3 is a flowchart of an embodiment of a method for generating file index data provided in this disclosure;
[0051] Figure 4 shows a flowchart of a file access method provided in an embodiment of this disclosure;
[0052] Figure 5 shows a flowchart of a directory reading method provided in an embodiment of this disclosure;
[0053] Figure 6 shows a block diagram of a file index data generation apparatus provided in an embodiment of the present disclosure;
[0054] Figure 7 shows a block diagram of a file access device provided in an embodiment of the present disclosure;
[0055] Figure 8 shows a block diagram of a directory reading device provided in an embodiment of the present disclosure;
[0056] Figure 9 shows a block diagram of a computing device provided in an embodiment of this disclosure. Detailed Implementation
[0057] To make the objectives, technical solutions, and advantages of this disclosure clearer, the technical solutions of this disclosure will be clearly and completely described below in conjunction with specific embodiments and corresponding drawings. Obviously, the described embodiments are only a part of the embodiments of this disclosure, and not all of them. All other embodiments obtained by those skilled in the art based on the embodiments of this disclosure without creative effort are within the scope of protection of this disclosure.
[0058] In storage systems, to enable fast location and retrieval of stored files, a hash algorithm is typically used when a file request is submitted to the storage system. This hash value is calculated based on the file identifier. This hash value is then used as the file's index data, allowing for quick location of the file within the storage system and improving file access efficiency.
[0059] However, due to the nature of hash algorithms, which convert longer file identifiers into shorter hash values, it is inevitable that different file identifiers will produce the same hash value, i.e., hash collisions. Once a hash collision occurs, it becomes difficult to accurately determine the corresponding file when retrieving a file from the file index table, thus affecting the retrieval efficiency and accuracy of the storage system.
[0060] Figure 1 shows a schematic diagram of the storage and management structure of directory entries in the file system in the database and memory.
[0061] As shown in Figure 1, in the database storage structure, each row of data uniquely identifies a directory entry using the inode ID (Parentinodeld) of the parent directory and a hash value calculated based on the filename (Hash(Name)). It also stores the file identifier (Name) and file metadata (such as ino, mode, uid, etc.). For example, in the directory with parent directory ID 1, the hash values of directory entries such as "bin" and "lib" are all different, while in the directory with parent directory ID 2, the hash values of "ls" and "cat" are both 0x98, indicating a hash collision.
[0062] In a memory management structure, when querying directory entries using a hash table, fast location can be achieved in O(1) time complexity by using the hash value if there is no hash collision. However, if a hash collision occurs (e.g., 0x98 corresponds to "ls" and "cat"), it becomes impossible to determine whether the target file to be queried is "ls" or "cat" when using the hash value 0x98 for querying.
[0063] To address the technical problem that existing methods struggle to accurately identify the corresponding file when retrieving a file from a file index table in the event of a hash collision, thus affecting the retrieval efficiency and accuracy of the storage system, this disclosure provides a solution. The basic idea is as follows: Determine the target directory corresponding to the target file; obtain a hash seed set corresponding to the target directory, the hash seed set including at least one hash seed; generate a first hash value based on any hash seed and the file identifier of the target file, and check if the first hash value exists in the index data; if at least one hash seed with a corresponding first hash value exists in the index data, generate a target hash seed; generate a second hash value based on the target hash seed and the file identifier of the target file, and use the second hash value as the index data of the target file; update the hash seed set corresponding to the target directory according to the target hash seed. This technical solution allows for the dynamic generation of a new target hash seed in the event of a hash collision, thereby enabling the generation of a globally unique hash value using the target hash seed and avoiding hash collisions.
[0064] The technical solutions of the embodiments of this disclosure will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this disclosure, and not all embodiments. Based on the embodiments of this disclosure, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this disclosure.
[0065] Figure 2 illustrates a system architecture diagram in which a technical solution of an embodiment of the present disclosure can be applied. The system architecture may include a client 201 and a server 202.
[0066] In this system, client 201 and server 202 can establish a connection via a network. The network provides a communication link between client 201 and server 202. The network can include various connection types, such as wired, wireless, or fiber optic cable. Client 201 can interact with server 202 via the network to receive or send messages, etc.
[0067] The client 201 can be a browser, an app (application), a web application such as an H5 (HyperText Markup Language 5) application, a lightweight application (also known as a mini-program), or a cloud application. The client 201 can be deployed on an electronic device and depends on the device or certain apps on the device to run. Electronic devices can have displays and support information browsing, such as personal mobile terminals like mobile phones, tablets, personal computers, desktop computers, smart speakers, smartwatches, etc. For ease of understanding, Figure 1 primarily uses a device image to represent the client. Various other types of applications can also be configured on electronic devices, such as human-computer interaction applications, model training applications, text processing applications, web browser applications, shopping applications, search applications, instant messaging tools, email clients, social media platform software, etc. An electronic device can refer to a device used by a user that has the computing, internet access, and communication functions required by the user, such as a mobile phone, tablet, personal computer, wearable device, etc. Electronic devices typically include at least one processing component and at least one storage component. Electronic devices may also include basic configurations such as network interface card (NIC) chips, I / O (input / output) buses, and audio / video components; this disclosure does not limit their inclusion of these components. Optionally, depending on the implementation of the electronic device, it may also include some peripheral devices, such as keyboards, mice, pens, and printers; this disclosure does not limit their inclusion of these components.
[0068] The server 202 may include servers that provide various services, such as a server for background training that supports the model used on the client 201, or a server that processes interactive information sent by the client.
[0069] It should be noted that a 202 server-side configuration can be implemented as a distributed server cluster consisting of multiple servers, or as a single server. The server can also be a server in a distributed system, or a server integrated with blockchain. Furthermore, the server can be a cloud server providing basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communication, middleware services, domain name services, security services, content delivery networks (CDNs), and big data and artificial intelligence platforms, or an intelligent cloud computing server or intelligent cloud host with artificial intelligence technology.
[0070] It should be noted that the method for generating file index data provided in this embodiment is generally executed by the server 202, and the corresponding file index data generation device is generally set in the server 202.
[0071] It should be understood that the number of clients and servers in Figure 2 is merely illustrative. Depending on implementation needs, there can be any number of clients and servers.
[0072] The implementation details of the technical solutions of the embodiments of this disclosure are described in detail below.
[0073] Figure 3 is a flowchart of an embodiment of a method for generating file index data provided in this disclosure. The method for generating file index data shown in Figure 3 can be executed by a server and may include the following steps:
[0074] 301: Determine the target directory corresponding to the target file.
[0075] 302: Retrieves the hash seed set corresponding to the target directory. The hash seed set includes at least one hash seed.
[0076] When a user wants to generate index data for a target file, the client can provide the server with the complete path information of the target file. The server can then parse the path information to determine the target directory corresponding to the target file.
[0077] The target directory can be a logical container for files, containing a management structure of multiple files or subdirectories. This management structure stores basic file attributes such as modification time, size, and filename. To achieve efficient file management, a corresponding hash seed set can be maintained for each target directory. This hash seed set can include at least one hash seed.
[0078] 303: Based on any hash seed and the file identifier of the target file, generate the first hash value corresponding to each hash seed, and check whether the first hash value exists in the file index table of the storage system.
[0079] After determining the hash seed set, a first hash value can be generated based on any hash seed and the file identifier of the target file. The file identifier can include the filename or other information that uniquely identifies the file. The generated first hash value can be used as candidate index data for the file.
[0080] To verify the uniqueness of the first hash value, after generating the first hash value, a search can be performed in the file index table to see if a duplicate first hash value exists. The file index table, which can be stored in memory or persistent storage, records the hash values allocated in the file system and their corresponding file information.
[0081] In some embodiments, if no first hash value corresponding to any hash seed is found in the file index table, the first hash value is used as the index data of the target file.
[0082] If no hash value matching the first hash value is found in the file index table, it means that the first hash value is unique and can be directly used as the index data for the target file. Otherwise, it can be confirmed that a hash collision has occurred with the first hash value.
[0083] In the event of a hash collision, other available hash seeds in the hash seed set can be tried sequentially, repeating the process of generating a new first hash value and searching. If none of the existing hash seeds can generate a unique first hash value, a new target hash seed can be generated.
[0084] [Corrected according to Rule 91 22.09.2026] 304: If there is at least one first hash value corresponding to each hash seed in the file index table, generate the target hash seed.
[0085] The target hash seed can be a completely new seed value, used to further expand the range of the hash seed set.
[0086] In the embodiments of this disclosure, in order to ensure the randomness of the target hash seed, a pseudo-random number algorithm or similar method can be used to randomly generate the target hash seed.
[0087] 305: Generate a second hash value based on the target hash seed and the file identifier of the target file, and use the second hash value as the index data of the target file.
[0088] 306: Update the hash seed set corresponding to the target directory based on the target hash seed.
[0089] After generating the target hash seed, a second hash value can be regenerated based on the target hash seed and the file identifier of the target file, and its uniqueness verified. If it is confirmed that the second hash value does not conflict with the hash value currently recorded in the file index table, the regenerated second hash value can be used as the index data of the target file, and the newly generated target hash seed can be added to the hash seed set to update the hash seed set. Specifically, using the generated second hash value as the index data of the target file can be implemented by using both the second hash value and the file identifier of the target file as the index data of the target file.
[0090] In the embodiments of this disclosure, by employing the following technical solution: determining the target directory corresponding to the target file; obtaining the hash seed set corresponding to the target directory, the hash seed set including at least one hash seed; generating a first hash value corresponding to each hash seed based on any hash seed and the file identifier of the target file, and checking whether the first hash value exists in the file index table of the storage system; generating a target hash seed if the first hash value corresponding to each hash seed exists in all files in the file index table; generating a second hash value based on the target hash seed and the file identifier of the target file, and using the second hash value as the index data of the target file; and updating the hash seed set corresponding to the target directory according to the target hash seed, a new target hash seed can be dynamically generated in the event of a hash collision, thereby enabling the generation of globally unique hash values using the target hash seed, avoiding hash collisions, and thus improving the query efficiency and accuracy of the storage system.
[0091] In embodiments of this disclosure, in order to dynamically maintain the size of the hash seed set and avoid resource waste due to excessive expansion of hash seeds, in some embodiments, after using the second hash value as the index data of the target file, the method may further include: updating the reference count of the target hash seed, where the reference count represents the number of index data generated based on the target hash seed; and deleting the corresponding hash seed from the hash seed set if the reference count of any hash seed in the hash seed set meets the deletion condition.
[0092] After generating the index data for the target files, the reference count of the target hash seed can be updated. The reference count is used to count the number of index data (i.e., hash values) generated using that target hash seed in the target directory. For example, during a file indexing process, if the target hash seed is used to generate unique hash values for at least one file, its reference count will increase accordingly. Conversely, if some files are deleted or reassigned to generate index data for other hash seeds, the reference count of the target hash seed will decrease.
[0093] To achieve dynamic management of reference counting, the reference count of the relevant hash seed can be automatically updated with each operation (such as adding, deleting, or modifying a file). Specifically, whenever a file is successfully indexed and assigned a hash value to a target hash seed, it can be checked whether the seed already exists in the hash seed set of the target directory. If it exists, its reference count is directly incremented; if it does not exist, the seed is added to the hash seed set and its reference count is initialized to 1. Similarly, when a file is deleted or its index data is reallocated, the reference count of the corresponding target hash seed can be checked. If the reference count drops to zero, it means that the seed is no longer used by any file. At this point, it can be determined that the hash seed meets the deletion criteria, and thus it can be removed from the hash seed set, thereby freeing up resources.
[0094] In the embodiments of this disclosure, to ensure system reliability, reference count information can be stored together with the hash seed set in the metadata of the target directory. This metadata can be stored in memory to accelerate access, and also needs to be persisted to disk or other non-volatile storage media to prevent data loss after server restart. In practical applications, the reference count can be appended as a field to the hash seed set to form a key-value pair data structure. For example, each hash seed may correspond to an entry containing the reference count, facilitating fast querying and updating of the reference count.
[0095] In this embodiment of the disclosure, the reference counting mechanism improves the efficiency and resource utilization of the file index data generation method by dynamically tracking the usage of the target hash seed.
[0096] In practical applications, the probability of hash collisions in file systems is usually low. To avoid additional computational overhead, some embodiments generate a first hash value corresponding to each hash seed based on any hash seed and the file identifier of the target file, and check whether the first hash value exists in the file index table of the storage system. Specifically, this can be implemented as follows: determine the default hash seed from at least one hash seed as the first hash seed; generate the first hash value based on the first hash seed and the file identifier of the target file; check whether the first hash value exists in the file index table; if the first hash value exists in the file index table, obtain the next hash seed from the hash seed set, and use the next hash seed as the first hash seed, and continue to execute the step of generating the first hash value based on the first hash seed and the file identifier of the target file, until the hash seed set is traversed.
[0097] In the embodiments of this disclosure, when the probability of hash collisions occurring in the file system is low, a unique hash value can usually be generated using a default hash seed. Therefore, a first hash value can be generated based on the default hash seed. The default hash seed can be a fixed, agreed-upon value, thus eliminating the need for persistent storage.
[0098] After generating the first hash value using the default hash seed, the file index table is checked to see if the same hash value already exists. If a hash value identical to the first hash value is found in the file index table, the collision resolution process can begin. At this point, the next available hash seed can be obtained from the hash seed set and used as the new first hash seed. The process of generating the first hash value and checking for collisions is repeated until the hash seed set has been traversed.
[0099] In some embodiments, the method further includes: receiving a file write request for a target file, the file write request including a directory identifier of the target directory to which the file is to be written.
[0100] In some embodiments, determining the target directory corresponding to the target file can specifically be implemented as follows: in response to a file write request, determining the target directory corresponding to the directory identifier.
[0101] When a user initiates a file write request to a server using a client, they typically provide a specific target directory path and the target file name. For example, in a file system, a user can select a directory and upload a new file through the client interface. In this case, the server can receive the file write request through the client interface and locate the target directory based on the information in the request. This information may include, for example, the target directory identifier, which could be implemented as the target directory path (the location where the user wants to write the file), and the target file name (the name the user specifies for the new file). Additionally, it may include the file content, i.e., the actual data uploaded by the user (such as text, images, etc.).
[0102] Upon receiving a file write request, the server can perform preliminary validation, such as checking the validity of the target directory path and whether the filename conforms to naming rules. If validation fails, the server can return an error message; if validation succeeds, it can parse the target directory path, breaking it down into multiple parts to locate the specific directory entry. For example, assuming the user-provided path is / home / user / documents, the server can sequentially search for the three directory entries: home, user, and documents. Each directory entry has a unique identifier (such as a directory ID) in the file system, stored in a database or memory. After parsing, the server can obtain the unique identifier of the target directory and load its metadata to obtain the hash seed set corresponding to the target directory.
[0103] When the server generates index data for a new file, as mentioned earlier, it first calculates a first hash value based on the default hash seed (e.g., zero) and the target file's filename, and then checks the file index table for a matching hash value. If the hash value is already occupied, a hash collision is considered to have occurred. At this point, the server tries other seeds in the hash seed set, recalculating the first hash value one by one, until an unoccupied hash value is found. However, in practical applications, especially when there are a large number of files in a directory, frequently traversing the hash seed set and querying the file index table can incur significant performance overhead. To reduce performance overhead, in some embodiments, when at least one hash seed corresponds to a first hash value in each file index table, the method may further include: recording the first hash values existing in the file index table to a collision hash value set.
[0104] When the server detects a conflict between the first hash value and existing index data recorded in the file index table, it records the conflicting first hash value in the conflict hash value set. The purpose of the conflict hash value set is to store all hash values that have hash conflicts, so that subsequent lookup operations can quickly determine whether a hash value may have a conflict.
[0105] In some embodiments, checking whether the first hash value exists in the file index table of the storage system can be specifically implemented as follows: checking whether the first hash value exists in the set of conflicting hash values; if not, checking whether the first hash value exists in the file index table; if so, determining that the first hash value exists in the file index table.
[0106] In the operation of checking if a first hash value exists in the index data, the server can first determine if the first hash value exists in the set of conflicting hash values. If the first hash value does not exist in the set of conflicting hash values, it can be determined that the first hash value does not have a conflict, thus eliminating the need for further queries to the database or hash seed set. If the first hash value exists in the set of conflicting hash values, it indicates that the first hash value may have a conflict.
[0107] To further reduce the resource consumption of querying conflicting hash value sets and improve query efficiency, in some embodiments, recording the first hash value into the conflicting hash value set can be specifically implemented as follows: obtaining the bit array corresponding to the conflicting hash value set; calculating the position index of the first hash value in the bit array using a hash function; and setting the value of the bit corresponding to the position index in the bit array to a preset value.
[0108] The server can first create a bit array of length m for the collection of conflicting hashes, initializing all bits to 0. The length m of the bit array can be determined based on the expected number of conflicting hashes to be stored and the allowable error rate. For example, if it is expected to store 10 million conflicting hashes and the allowable error rate is 1%, a suitable value of m can be calculated using the mathematical formula for a Bloom filter. Furthermore, the server can choose k independent hash functions, each mapping the input data (such as the hashes of conflicting hashes) to a specific position in the bit array.
[0109] When a hash collision is detected, the server may record it in the Bloom filter. Specifically: First, the server can calculate k array positions using k hash functions. Then, the bits at these positions are set to a preset value, such as 1, to mark that the hash value has been recorded in the collision hash value set. For example, assuming the Bloom filter's bit array length is 1000, the collision hash value is 123456789, and the server calculates the positions using three hash functions as 12, 345, and 678, then the 12th, 345th, and 678th bits of the bit array are set to 1.
[0110] In some embodiments, checking whether a first hash value exists in the set of conflicting hash values can be specifically implemented as follows: obtaining the bit array corresponding to the set of conflicting hash values; calculating the position index of the first hash value in the bit array using a hash function; if the value of the bit corresponding to the position index is a preset value, determining that the first hash value exists in the set of conflicting hash values; otherwise, determining that the first hash value does not exist in the set of conflicting hash values.
[0111] In the process of searching for the existence of a first hash value in the set of conflicting hash values, the server can first check the Bloom filter to determine whether the current hash value might exist in the set of conflicting hash values. Specifically: the server also calculates the corresponding k array positions using k hash functions and checks whether all the bits at these positions are 1. If all bits are 1, it can be confirmed that the hash value may exist in the set of conflicting hash values; otherwise, it is determined that the hash value does not exist in the set. For example, for the hash value 123456789 to be searched, the positions calculated by the system using three hash functions are still 12, 345, and 678. If the 12th, 345th, and 678th bits of the bit array are all 1, it is considered that the hash value may have a conflict; otherwise, it is determined that the hash value has not been recorded.
[0112] Based on the set of conflicting hash values, when generating index data for a target file, the server can first calculate a first hash value based on the default hash seed and check the set of conflicting hash values. If the first hash value is not found in the set of conflicting hash values, it means that the first hash value does not have a hash collision, and it can be directly used as the index data for the target file. If the first hash value exists in the set of conflicting hash values, the hash seed set and the file index table can be further queried. In this way, it is possible to avoid trying each hash seed in the hash seed set one by one, thereby significantly reducing computational overhead.
[0113] Figure 4 shows a flowchart of a file access method according to an embodiment of the present disclosure. As shown in Figure 4, the file access method may specifically include the following steps:
[0114] 401: Received an access request for a target file. The access request includes the file identifier of the target file and the directory identifier of the target directory to be accessed.
[0115] 402: Get the hash seed set of the target directory. The hash seed set includes at least one hash seed. The at least one hash seed includes at least one default hash seed and an extended hash seed. The extended hash seed is generated when there is at least one first hash value corresponding to each default hash seed in the index data.
[0116] 403: Generate a third hash value based on any default hash seed and file identifier, and check if the third hash value exists in the file index table;
[0117] 404: If at least one third hash value corresponding to each default hash seed exists in the file index table, an extended hash seed is generated, and a fourth hash value is generated based on the extended hash seed and the file identifier. The target file is then accessed based on the fourth hash value.
[0118] The detailed implementation methods and beneficial effects of each step in this embodiment have been described in detail in the foregoing embodiments, and will not be elaborated here.
[0119] In the embodiments of this disclosure, after accessing the target file, modifications and deletions can be performed on the target file, or new files can be added. Specifically, for modifications and deletions, the target file can be located based on the fourth hash value, and then the modifications and deletions can be performed directly on the target file.
[0120] For add operations, at the start of the operation, the server can first calculate the add hash value based on the file identifier of the new file, and then perform a search operation based on the hash value to determine if a file or directory with the same name already exists. If a file with the same name is found, it means that a file with the same name has been created, the add operation fails, and an error code is returned. If no file with the same name is found, the new file can be written to the directory, and the add hash value and file identifier can be used as index data for the new file.
[0121] Figure 5 shows a flowchart of a directory reading method provided in an embodiment of this disclosure. As shown in Figure 5, the directory reading method may specifically include the following steps:
[0122] 501: Received a read request from the client for the target directory;
[0123] 502: In response to a read request, determine multiple files recorded in the target directory, wherein the index data corresponding to the multiple files is generated through the following operations: take any one file as the target file; obtain the hash seed set corresponding to the target directory, the hash seed set including at least one hash seed; based on any hash seed and the file identifier of the target file, generate a fifth hash value corresponding to each hash seed, and check whether the fifth hash value exists in the file index table of the storage system; if the fifth hash value corresponding to each hash seed exists in the file index table, generate a target hash seed; generate a sixth hash value based on the target hash seed and the file identifier of the target file, and use the sixth hash value as the index data of the target file;
[0124] 503: Based on index data, multiple files are paginated to obtain multiple directory pages;
[0125] 504: Multiple directory pages are sent to the client sequentially.
[0126] The detailed implementation methods and beneficial effects of each step in this embodiment have been described in detail in the foregoing embodiments, and will not be elaborated here.
[0127] In the embodiments of this disclosure, hash collisions are avoided when generating index data for any file; therefore, each file in the target directory is assigned a unique index data. This allows for pagination of multiple files in the target directory based on the index data, resulting in multiple directory pages. Each directory page contains basic information about a set of files, such as filename, modification time, and size. A cursor (i.e., the index data of the last file) is typically appended to the end of each directory page to indicate the starting position of the next page. The server can then send the constructed directory pages to the client. The client can initiate a subsequent read request based on the returned cursor to retrieve the file for the next directory page. Through globally unique index data, the server can accurately retrieve the file for the next directory page after receiving the client's next read request.
[0128] It should be noted that some processes described in the above embodiments and accompanying drawings include multiple operations appearing in a specific order. However, it should be clearly understood that these operations may not be executed in the order they appear in this document, or they may be executed in parallel. The operation numbers, such as 201, 202, etc., are merely used to distinguish different operations and do not represent any execution order. Furthermore, these processes may include more or fewer operations, and these operations may be executed sequentially or in parallel. It should also be noted that the descriptions such as "first" and "second" in this document are used to distinguish different messages, devices, modules, etc., and do not represent a sequential order, nor do they limit "first" and "second" to different types.
[0129] Figure 6 shows a block diagram of a file index data generation apparatus provided in an embodiment of this disclosure. As shown in Figure 6, the file index data generation apparatus may specifically include:
[0130] The first determining module 601 is used to determine the target directory corresponding to the target file;
[0131] The first acquisition module 602 is used to acquire the hash seed set corresponding to the target directory, and the hash seed set includes at least one hash seed.
[0132] The first generation module 603 is used to generate a first hash value corresponding to each hash seed based on any hash seed and the file identifier of the target file, and to search for the existence of the first hash value in the file index table of the storage system.
[0133] The second generation module 604 is used to generate a target hash seed when the first hash value corresponding to each hash seed exists in the file index table.
[0134] The third generation module 605 is used to generate a second hash value based on the target hash seed and the file identifier of the target file, and use the second hash value as the index data of the target file.
[0135] The first update module 606 is used to update the hash seed set corresponding to the target directory based on the target hash seed.
[0136] In some embodiments, after using the second hash value as index data for the target file, the apparatus may further include:
[0137] The second update module is used to update the reference count of the target hash seed, where the reference count represents the number of index data generated based on the target hash seed;
[0138] The deletion module is used to delete the corresponding hash seed from the hash seed set when the reference count of any hash seed in the hash seed set meets the deletion condition.
[0139] In some embodiments, the first generation module 603 is specifically used for:
[0140] The default hash seed from at least one hash seed is determined as the first hash seed;
[0141] Generate the first hash value based on the first hash seed and the file identifier of the target file;
[0142] Check if the first hash value exists in the file index table;
[0143] If the first hash value exists in the file index table, the next hash seed is obtained from the hash seed set and used as the first hash seed. The process of generating the first hash value based on the first hash seed and the file identifier of the target file continues until the hash seed set is traversed.
[0144] In some embodiments, the device may further include:
[0145] The request receiving module is used to receive file write requests for the target file. The file write request includes the directory identifier of the target directory to be written to.
[0146] In some embodiments, the first determining module 601 is specifically used to: in response to a file write request, determine the target directory corresponding to the directory identifier.
[0147] In some embodiments, the device may further include:
[0148] The index data determination module is used to use the first hash value as the index data of the target file when no first hash value corresponding to any hash seed is found in the file index table.
[0149] In some embodiments, where at least one hash seed corresponds to a first hash value in each of the file index tables, the apparatus may further include:
[0150] The conflict recording module is used to record the first hash value existing in the file index table to the conflict hash value set;
[0151] In some embodiments, the first generation module 603 is specifically used for:
[0152] Check if a first hash value exists in the set of conflict hash values. If not, check if a first hash value exists in the file index table. If so, determine if a first hash value exists in the file index table.
[0153] In some embodiments, the conflict logging module is specifically used for:
[0154] Get the bit array corresponding to the set of conflict hash values;
[0155] Calculate the index of the first hash value in the bit array using a hash function;
[0156] Set the value of the bit corresponding to the position index in the bit array to the preset value.
[0157] In some embodiments, the first generation module 603 is specifically used for:
[0158] Get the bit array corresponding to the set of conflict hash values;
[0159] Calculate the index of the first hash value in the bit array using a hash function;
[0160] If the bit corresponding to the position index is set to a preset value, it is determined that the first hash value exists in the set of conflicting hash values; otherwise, it is determined that the first hash value does not exist in the set of conflicting hash values.
[0161] The file index data generation device in Figure 6 can execute the file index data generation method of the embodiment shown in Figure 3. Its implementation principle and technical effects will not be elaborated further. The specific methods by which each module and unit of the file index data generation device in the above embodiments performs its operations have been described in detail in the embodiments related to this method, and will not be elaborated upon here.
[0162] Figure 7 shows a block diagram of a file access device provided in an embodiment of the present disclosure. As shown in Figure 7, the file access device may specifically include:
[0163] The first receiving module 701 is used to receive an access request for a target file. The access request includes the file identifier of the target file and the directory identifier of the target directory to be accessed.
[0164] The second acquisition module 702 is used to acquire the hash seed set of the target directory. The hash seed set includes at least one hash seed. The at least one hash seed includes at least one default hash seed and an extended hash seed. The extended hash seed is generated when at least one default hash seed exists in the index data and each of them corresponds to a first hash value.
[0165] The fourth generation module 703 is used to generate a third hash value based on any of the default hash seeds and the file identifier, and to search the file index table to see if the third hash value exists.
[0166] The fifth generation module 704 is used to generate an extended hash seed when the file index table contains a third hash value corresponding to each of the at least one default hash seed, and to generate a fourth hash value based on the extended hash seed and the file identifier, and to access the target file based on the fourth hash value.
[0167] The file access device in Figure 7 can execute the file access method of the embodiment shown in Figure 4. Its implementation principle and technical effects will not be elaborated further. The specific methods by which each module and unit of the file access device in the above embodiments performs its operations have been described in detail in the embodiments related to the method, and will not be elaborated upon here.
[0168] Figure 8 shows a block diagram of a directory reading device provided in an embodiment of this disclosure. As shown in Figure 8, the directory reading device may specifically include:
[0169] The second receiving module 801 is used to receive a read request for the target directory sent by the client;
[0170] The second determining module 802 is configured to, in response to the read request, determine multiple files recorded in the target directory, wherein the index data corresponding to the multiple files is generated through the following operations: taking any one file as the target file; obtaining a hash seed set corresponding to the target directory, the hash seed set including at least one hash seed; generating a fifth hash value corresponding to each hash seed based on any hash seed and the file identifier of the target file, and checking whether the fifth hash value exists in the file index table of the storage system; if the fifth hash value corresponding to each hash seed exists in all the file index tables, generating a target hash seed; generating a sixth hash value based on the target hash seed and the file identifier of the target file, and using the sixth hash value as the index data of the target file;
[0171] The paging module 803 is used to paginate multiple files based on index data to obtain multiple directory pages;
[0172] The sending module 804 is used to send multiple directory pages to the client sequentially.
[0173] The directory reading device shown in Figure 8 can execute the directory reading method described in the embodiment shown in Figure 5. Its implementation principle and technical effects will not be elaborated further. The specific methods by which each module and unit of the directory reading device in the above embodiments performs its operations have been described in detail in the embodiments related to this method, and will not be elaborated upon here.
[0174] Figure 9 is a schematic diagram of an embodiment of a computing device provided in this disclosure. As shown in Figure 9, in practice, the computing device may include a storage component 901 and a processing component 902.
[0175] Storage component 901 is used to store computer programs and can be configured to store various other data to support operation on a computing device. Examples of this data include instructions for any application or method used to operate on the computing device, data structures, contact data, phone book data, messages, pictures, videos, etc.
[0176] The processing component 902, coupled to the storage component 901, is used to execute the computer program in the storage component 901 to implement the file index data generation method provided in the embodiments of this disclosure, or to implement the file access method provided in the embodiments of this disclosure, or to implement the directory reading method provided in the embodiments of this disclosure.
[0177] The processing component described above includes one or more processors to execute computer instructions to complete all or part of the steps in the method described above. Alternatively, the processing component may be implemented as one or more application-specific integrated circuits (ASICs), digital signal processors (DSPs), digital signal processing devices (DSPDs), programmable logic devices (PLDs), field-programmable gate arrays (FPGAs), controllers, microcontrollers, microprocessors, or other electronic components for performing the method described above.
[0178] The aforementioned storage components can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as Static Random-Access Memory (SRAM), Electrically Erasable Programmable Read Only Memory (EEPROM), Erasable Programmable Read Only Memory (EPROM), Programmable Read-Only Memory (PROM), Read-Only Memory (ROM), magnetic storage, flash memory, magnetic disk, or optical disk.
[0179] The aforementioned communication component is configured to facilitate wired or wireless communication between the device housing the communication component and other devices. The device housing the communication component can access wireless networks based on communication standards, such as mobile communication networks, or combinations thereof. In one exemplary embodiment, the communication component receives broadcast signals or broadcast-related information from an external broadcast management system via a broadcast channel.
[0180] The aforementioned display components may include a screen, which may include a Liquid Crystal Display (LCD) and a Touch Panel (TP). If the screen includes a Touch Panel, the screen can be implemented as a touchscreen to receive input signals from the user. The Touch Panel includes one or more touch sensors to sense touches, swipes, and gestures on the Touch Panel. The touch sensors can sense not only the boundaries of touch or swipe actions but also the duration and pressure associated with the touch or swipe operation.
[0181] The aforementioned power supply components provide power to various components within the device in which they reside. These power supply components may include a power management system, one or more power sources, and other components associated with generating, managing, and distributing power to the device in which they reside.
[0182] The aforementioned audio component can be configured to output and / or input audio signals. For example, the audio component includes a microphone (MIC) configured to receive external audio signals when the device containing the audio component is in an operating mode, such as call mode, recording mode, or voice recognition mode. The received audio signals can be further stored in memory or transmitted via a communication component. In some embodiments, the audio component also includes a speaker for outputting audio signals.
[0183] Accordingly, this disclosure also provides a computer-readable storage medium storing a computer program, which, when executed by a processor, enables the processor to implement the steps in the above-described method embodiments. The computer-readable storage medium includes volatile or non-volatile or a combination thereof, and can be removable or non-removable. Examples of computer-readable storage media include, but are not limited to, phase-change random access memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random-access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), flash memory or other memory technologies, CD-ROM, Digital Video Disc (DVD) or other optical storage, magnetic tape, magnetic disk storage or other magnetic storage devices, or any other non-transmission medium.
[0184] Accordingly, this disclosure also provides a computer program product, which includes a computer program or instructions that, when executed by a processor, cause the processor to implement the steps in the above-described method embodiments. It should be understood that each step or combination of steps in the above-described method flow can be implemented by the computer program or instructions. Furthermore, these computer programs or instructions can be applied to the processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device, enabling the processor of the general-purpose computer, special-purpose computer, embedded processor, or other programmable data processing device to function as an apparatus for implementing the corresponding functions in the above-described method embodiments.
[0185] Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the specific working processes of the systems, devices, and units described above can be referred to the corresponding processes in the foregoing method embodiments, and will not be repeated here.
[0186] It should also be noted that the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such process, method, article, or apparatus. Unless otherwise specified, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes that element.
[0187] Finally, it should be noted that the above are merely embodiments of this disclosure and are not intended to limit the scope of this disclosure. Various modifications and variations can be made to this disclosure by those skilled in the art. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of this disclosure should be included within the scope of the claims of this disclosure.
Claims
1. A method for generating file index data, wherein, include: Determine the target directory corresponding to the target file; Obtain the hash seed set corresponding to the target directory, wherein the hash seed set includes at least one hash seed; Based on any hash seed and the file identifier of the target file, generate a first hash value corresponding to each hash seed, and search the file index table of the storage system to see if the first hash value exists. If the first hash value corresponding to each of the hash seeds exists in all of the file index tables, a target hash seed is generated. A second hash value is generated based on the target hash seed and the file identifier of the target file, and the second hash value is used as the index data of the target file. Update the hash seed set corresponding to the target directory based on the target hash seed.
2. The method of claim 1, wherein, After using the second hash value as the index data of the target file, the method further includes: Update the reference count of the target hash seed, where the reference count represents the number of index data generated based on the target hash seed; If the reference count of any hash seed in the hash seed set meets the deletion condition, the corresponding hash seed is deleted from the hash seed set.
3. The method of claim 2, wherein, The step of generating a first hash value corresponding to each hash seed based on any hash seed and the file identifier of the target file, and checking whether the first hash value exists in the file index table of the storage system includes: The default hash seed among the at least one hash seed is determined as the first hash seed; Based on the first hash seed and the file identifier of the target file, a first hash value is generated; Check if the first hash value exists in the file index table; If the first hash value exists in the file index table, the next hash seed is obtained from the hash seed set, and the next hash seed is used as the first hash seed. The step of generating the first hash value based on the first hash seed and the file identifier of the target file is continued until the hash seed set is traversed.
4. The method of claim 3, wherein, The method further includes: Receive a file write request for the target file, the file write request including a directory identifier of the target directory to be written to; The determination of the target directory corresponding to the target file includes: In response to the file write request, the target directory corresponding to the directory identifier is determined.
5. The method of claim 4, wherein, The method further includes: If no first hash value corresponding to any hash seed is found in the file index table, the first hash value is used as the index data of the target file.
6. The method of claim 5, wherein, When the first hash value corresponding to each of the hash seeds exists in all of the file index tables, the method further includes: Record the first hash value existing in the file index table into the conflict hash value set; The step of checking whether the first hash value exists in the file index table of the storage system includes: Check if the first hash value exists in the set of conflict hash values. If not, check if the first hash value exists in the file index table. If yes, determine that the first hash value exists in the file index table.
7. The method of claim 6, wherein, The step of recording the first hash value into the conflict hash value set includes: Obtain the bit array corresponding to the set of conflict hash values; The position index of the first hash value in the bit array is calculated using a hash function; Set the value of the bit corresponding to the position index in the bit array to a preset value; The step of checking whether the first hash value exists in the set of conflicting hash values includes: Obtain the bit array corresponding to the set of conflict hash values; The position index of the first hash value in the bit array is calculated using a hash function; If the bit corresponding to the position index is the preset value, it is determined that the first hash value exists in the conflict hash value set; otherwise, it is determined that the first hash value does not exist in the conflict hash value set.
8. A file access method, wherein, include: Receive an access request for a target file, the access request including the file identifier of the target file and the directory identifier of the target directory to be accessed; Obtain the hash seed set of the target directory, wherein the hash seed set includes at least one default hash seed; Based on any of the default hash seeds and the file identifier, a third hash value is generated, and the existence of the third hash value is checked from the file index table. If a third hash value corresponding to at least one default hash seed exists in all of the file index tables, an extended hash seed is generated, and a fourth hash value is generated based on the extended hash seed and the file identifier, and the target file is accessed based on the fourth hash value.
9. A directory reading method, wherein, include: Receive read requests for the target directory sent by the client; In response to the read request, multiple files recorded in the target directory are determined, wherein the index data corresponding to the multiple files is generated through the following operations: any one file is selected as the target file; a hash seed set corresponding to the target directory is obtained, the hash seed set including at least one hash seed; based on any hash seed and the file identifier of the target file, a fifth hash value corresponding to each hash seed is generated, and the existence of the fifth hash value is checked in the file index table of the storage system; if the fifth hash value corresponding to each hash seed exists in all files in the file index table, a target hash seed is generated; a sixth hash value is generated based on the target hash seed and the file identifier of the target file, and the sixth hash value is used as the index data of the target file. Based on the index data, the multiple files are paginated to obtain multiple directory pages; The multiple directory pages are sent to the client in sequence.
10. A computing device, wherein, This includes processing components and storage components; The storage component stores a computer program; the computer program is invoked and executed by the processing component to implement the file index data generation method as described in any one of claims 1 to 7, or to implement the file access method as described in claim 8, or to implement the directory reading method as described in claim 9.
11. A computer readable storage medium, wherein, It stores a computer program, which, when executed by a processing component, implements the method for generating file index data as described in any one of claims 1 to 7, or the file access method as described in claim 8, or the directory reading method as described in claim 9.
12. A computer program product, wherein, It includes a computer program or instructions that, when executed by a processing component, implement the method for generating file index data as described in any one of claims 1 to 7, or implement the file access method as described in claim 8, or implement the directory reading method as described in claim 9.
13. An apparatus for generating document index data, comprising: The first determination module is used to determine the target directory corresponding to the target file; The first acquisition module is used to acquire the hash seed set corresponding to the target directory, wherein the hash seed set includes at least one hash seed; The first generation module is used to generate a first hash value corresponding to each hash seed based on any hash seed and the file identifier of the target file, and to search for the existence of the first hash value in the file index table of the storage system. The second generation module is used to generate a target hash seed when the first hash value corresponding to each hash seed exists in the file index table. The third generation module is used to generate a second hash value based on the target hash seed and the file identifier of the target file, and use the second hash value as the index data of the target file; The first update module is used to update the hash seed set corresponding to the target directory according to the target hash seed.
14. The apparatus of claim 13, further comprising: The second update module is used to update the reference count of the target hash seed, wherein the reference count represents the number of index data generated based on the target hash seed; The deletion module is used to delete the corresponding hash seed from the hash seed set when the reference count of any hash seed in the hash seed set meets the deletion condition.
15. The apparatus according to claim 14, wherein, The first generation module is specifically used for: The default hash seed among the at least one hash seed is determined as the first hash seed; Based on the first hash seed and the file identifier of the target file, a first hash value is generated; Check if the first hash value exists in the file index table; If the first hash value exists in the file index table, the next hash seed is obtained from the hash seed set, and the next hash seed is used as the first hash seed. The step of generating the first hash value based on the first hash seed and the file identifier of the target file is continued until the hash seed set is traversed.
16. The apparatus of claim 15, further comprising: The request receiving module is used to receive a file write request for the target file, wherein the file write request includes a directory identifier of the target directory to which the file is requested to be written; The first determining module is further configured to: in response to the file write request, determine the target directory corresponding to the directory identifier.
17. The apparatus of claim 16, further comprising: The index data determination module is used to use the first hash value as the index data of the target file when no first hash value corresponding to any hash seed is found in the file index table.
18. The apparatus of claim 17, further comprising: The conflict recording module is used to record the first hash value existing in the file index table to the conflict hash value set when the first hash value corresponding to each of the hash seeds exists in the file index table. The first generation module is further configured to: search for the existence of the first hash value in the set of conflict hash values; if not, search for the existence of the first hash value in the file index table; if so, determine that the first hash value exists in the file index table.
19. A file access device, comprising: The first receiving module is configured to receive an access request for a target file, the access request including the file identifier of the target file and the directory identifier of the target directory to be accessed; The second acquisition module is used to acquire the hash seed set of the target directory. The hash seed set includes at least one hash seed, and the at least one hash seed includes at least one default hash seed and an extended hash seed. The extended hash seed is generated when the first hash value corresponding to the at least one default hash seed exists in the index data. The fourth generation module is used to generate a third hash value based on any of the default hash seeds and the file identifier, and to search the file index table to see if the third hash value exists. The fifth generation module is used to generate an extended hash seed when the file index table contains a third hash value corresponding to each of the at least one default hash seed, and to generate a fourth hash value based on the extended hash seed and the file identifier, and to access the target file based on the fourth hash value.
20. A directory reading device, comprising: The second receiving module is used to receive read requests for the target directory sent by the client; The second determining module is configured to, in response to the read request, determine multiple files recorded in the target directory, wherein the index data corresponding to the multiple files is generated through the following operations: taking any one file as the target file; obtaining a hash seed set corresponding to the target directory, the hash seed set including at least one hash seed; generating a fifth hash value corresponding to each hash seed based on any hash seed and the file identifier of the target file, and checking whether the fifth hash value exists in the file index table of the storage system; if the fifth hash value corresponding to each hash seed exists in all the file index tables, generating a target hash seed; generating a sixth hash value based on the target hash seed and the file identifier of the target file, and using the sixth hash value as the index data of the target file; The pagination module is used to paginate the multiple files based on the index data to obtain multiple directory pages; The sending module is used to send the plurality of directory pages to the client in sequence.
