Hierarchical directory implementation method and device, electronic equipment and storage medium

By responding to file modification operations in the object storage system, determining the parent directory, and constructing the directory path, the problem of maintaining the hierarchical directory structure in the object storage system is solved, and data consistency and multi-level directory creation are achieved.

CN115168291BActive Publication Date: 2026-03-20BEIJING BAIDU NETCOM SCI & TECH CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-06-09
Publication Date
2026-03-20

AI Technical Summary

Technical Problem

Object storage systems do not maintain hierarchical directory structures, which makes them unable to meet the needs of practical applications.

Method used

By responding to file modification operations in the object storage system, the existence of the parent directory is determined, the directory path is constructed, and metadata information is recorded in the list of child nodes, ensuring data consistency in the hierarchical directory structure.

Benefits of technology

It enables the maintenance of hierarchical directory structure in object storage systems, ensures data consistency, supports direct manipulation of files that do not exist in the parent directory, and can create multi-level directories at once.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115168291B_ABST
    Figure CN115168291B_ABST
Patent Text Reader

Abstract

The disclosure provides a hierarchical directory implementation method and device, electronic equipment and storage medium, relates to the fields of artificial intelligence such as cloud computing, cloud storage and content distribution, and can be applied in an intelligent cloud scene. The method can include the following steps: in response to determining that there is a parent directory of a file in an object storage system corresponding to a to-be-executed file modification operation, taking the parent directory as a to-be-processed directory, otherwise, constructing a directory path corresponding to the file, taking each layer directory on the directory path as a to-be-processed directory, wherein the lowest layer directory is the parent directory of the file, and only the uppermost layer directory is an existing directory; executing the file modification operation; and for any to-be-processed directory, recording metadata information corresponding to the file modification operation in a child node list of the to-be-processed directory. The scheme disclosed in the disclosure can be used to maintain a corresponding hierarchical directory structure for an object storage system and ensure data consistency.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present disclosure relates to the field of artificial intelligence, in particular to a hierarchical directory implementation method and device, electronic equipment and storage medium in the fields of cloud computing, cloud storage and content distribution. BACKGROUND

[0002] An object storage system usually does not maintain a hierarchical directory structure among objects, but in some actual application scenarios, a hierarchical directory is needed, which cannot meet the actual needs. SUMMARY

[0003] The present disclosure provides a hierarchical directory implementation method, device, electronic equipment and storage medium.

[0004] A hierarchical directory implementation method comprises:

[0005] For a file in an object storage system corresponding to a file modification operation to be executed, in response to determining that a parent directory of the file exists, the parent directory is taken as a to-be-processed directory, otherwise, a directory path corresponding to the file is constructed, and each layer directory in the directory path is taken as the to-be-processed directory, the lowest layer directory on the directory path is the parent directory of the file, and only the uppermost layer directory is an existing directory;

[0006] Performing the file modification operation this time;

[0007] For any to-be-processed directory, metadata information corresponding to the file modification operation this time is recorded in a child node list of the to-be-processed directory.

[0008] A hierarchical directory implementation device comprises a preparation module, an execution module and a completion module.

[0009] The preparation module is configured to, for a file in an object storage system corresponding to a file modification operation to be executed, in response to determining that a parent directory of the file exists, take the parent directory as a to-be-processed directory, otherwise, construct a directory path corresponding to the file, and take each layer directory in the directory path as the to-be-processed directory, the lowest layer directory on the directory path is the parent directory of the file, and only the uppermost layer directory is an existing directory;

[0010] The execution module is configured to perform the file modification operation this time.

[0011] The completion module is configured to, for any to-be-processed directory, record metadata information corresponding to the file modification operation this time in a child node list of the to-be-processed directory.

[0012] An electronic equipment comprises:

[0013] at least one processor; and

[0014] a memory in communication with the at least one processor; wherein

[0015] The memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to perform the method as described above.

[0016] A non-transitory computer-readable storage medium storing computer instructions for causing a computer to perform the method as described above.

[0017] A computer program product comprising computer programs / instructions which, when executed by a processor, implement the method as described above.

[0018] One embodiment in the above disclosure has the following advantages or beneficial effects: the corresponding directory can be updated and / or constructed for each file modification operation, which can be a file modification operation for an object storage system, accordingly, the object storage system can be maintained to maintain the corresponding hierarchical directory structure, and the consistency of the data in the hierarchical directory structure and the data in the object storage system can be ensured, and direct operation on a file that does not exist in a parent directory is supported, and one-time creation of multiple layers of directories can be implemented.

[0019] It should be understood that the content described in this part is not intended to identify key or important features of the embodiments of the disclosure, nor to limit the scope of the disclosure. Other features of the disclosure will become apparent from the following description. BRIEF DESCRIPTION OF DRAWINGS

[0020] The accompanying drawings are used to better understand the present scheme and do not limit the disclosure. Among them:

[0021] Figure 1 A flowchart of the hierarchical directory implementation method embodiment of the disclosure is shown.

[0022] Figure 2 A constituent structure schematic diagram of the hierarchical directory implementation device embodiment 200 of the disclosure is shown.

[0023] Figure 3 A schematic block diagram of an electronic device 300 that can be used to implement embodiments of the disclosure is shown. DETAILED DESCRIPTION

[0024] Exemplary embodiments of the present disclosure are described herein with reference to the accompanying drawings, which are cited as illustrative examples. Various details of the embodiments of the present disclosure are described herein in order to provide a thorough understanding of the present disclosure. It will be understood by those of ordinary skill in the art that various changes and modifications can be made to the embodiments described herein without departing from the scope and spirit of the present disclosure. Also, in the following description, descriptions of well-known functions and constructions are omitted for clarity and conciseness.

[0025] In addition, it should be understood that the term "and / or" herein is merely used to describe an associated relationship between associated objects, and can represent three relationships, for example, A and / or B can represent three cases of A alone, A and B together, and B alone. In addition, the character " / " herein generally represents an "or" relationship between the front and rear associated objects.

[0026] Figure 1 A flowchart of an embodiment of a method for implementing a hierarchical directory according to the present disclosure is shown in FIG. 1. As shown in FIG. 1, the following specific implementation methods are included. Figure 1

[0027] In step 101, for a file in the object storage system corresponding to a file modification operation to be performed, in response to determining that there is a parent directory of the file, the parent directory is taken as a to-be-processed directory, otherwise, a directory path corresponding to the file is constructed, and each layer directory in the directory path is taken as a to-be-processed directory respectively, the lowest layer directory on the directory path is the parent directory of the file, and only the uppermost layer directory is an existing directory.

[0028] In step 102, the file modification operation is performed.

[0029] In step 103, for any to-be-processed directory, metadata information corresponding to the file modification operation is recorded in the child node list of the to-be-processed directory respectively.

[0030] If a hierarchical directory structure is to be maintained for the object storage system, since the hierarchical directory structure is independent of the object storage system, a data consistency problem will be involved.

[0031] By using the scheme described in the above method embodiment, the corresponding directory can be updated and / or constructed for each file modification operation, the file modification operation can be a file modification operation for the object storage system, and accordingly, the corresponding hierarchical directory structure can be maintained for the object storage system, and the consistency of the data in the hierarchical directory structure and the data in the object storage system can be ensured. In addition, a file whose parent directory does not exist can be directly operated, and one-time creation of multiple layers of directories can be implemented.

[0032] ​The implementation of the scheme described in the present disclosure can be mainly divided into three stages, i.e., a preparation stage, an execution stage, and a completion stage, and the specific implementation of each stage is described below.

[0033] i) Preparation stage

[0034] In order to ensure the consistency of the data in the hierarchical directory structure and the data in the object storage system, a preparation stage is introduced.

[0035] For a file modification operation to be executed, it can be first determined whether the parent directory of the corresponding file exists, and according to different determination results, different processing methods can be used subsequently, such as those shown in 1) and 2) below.

[0036] 1) The parent directory of the file exists

[0037] In response to determining that the parent directory of the file exists, the parent directory can be taken as a to-be-processed directory.

[0038] For example, the file corresponding to the file modification operation to be executed is file d, and its parent directory is a / b / c, and the parent directory already exists, so the parent directory can be taken as a to-be-processed directory.

[0039] In an embodiment of the present disclosure, in response to determining that the parent directory of the file exists, it can be further determined whether there is a directory with the same name as the file in the directory belonging to the same parent directory as the file, and in response to determining that there is a directory with the same name as the file in the directory belonging to the same parent directory as the file, the file modification operation can be directly ended, otherwise, the subsequent processing can be continued. The child nodes can include directories and files.

[0040] For example, the file corresponding to the file modification operation to be executed is file d, and its parent directory is a / b / c, and it can be determined whether the child nodes of a / b / c include directory d, if yes, the file modification operation can be directly ended, that is, it can be considered that the file modification operation fails.

[0041] Through the above processing, the same names of files and directories can be avoided, that is, logical errors can be avoided, and the correctness of the hierarchical directory structure is ensured.

[0042] In an embodiment of the present disclosure, for the above to-be-processed directory, the following processing can also be performed: adding a temporary record in the form of a key-value pair corresponding to the file modification operation to the child node list of the to-be-processed directory, and the key of the temporary record includes the file name of the file.

[0043] The child node list can include multiple records, which respectively record the names and metadata information of each child node, and the commonly used storage form in the child node list is in the form of a key-value pair.

[0044] In the solution of the present disclosure, a temporary record can be generated in the preparation stage. The key of the temporary record can include a file name, and the value of the temporary record can include information according to actual needs, for example, a unique operation identifier (OPID) generated for the current file modification operation, and further include some other information, such as the operation type and basic information of the current file modification operation.

[0045] The operation identifier can be randomly generated, and is a number used to identify the current file modification operation, and has uniqueness.

[0046] 2) The parent directory of the file does not exist

[0047] 1) describes the processing mode when the parent directory of the file corresponding to the file modification operation to be executed exists. If the parent directory of the file corresponding to the file modification operation to be executed does not exist, the directory path corresponding to the file can be constructed, each layer of directory on the directory path is taken as a to-be-processed directory, in addition, the lowest layer of directory on the directory path is the parent directory of the file, and only the uppermost layer of directory is an existing directory, that is, each layer of directory is a created directory.

[0048] In an embodiment of the present disclosure, the construction of the directory path corresponding to the file can include: determining the name of the parent directory of the file; taking the parent directory of the file as a to-be-processed object, and performing the following first processing: determining the name of the parent directory of the to-be-processed object; in response to determining that the parent directory of the to-be-processed object does not exist according to the name, taking the parent directory of the to-be-processed object as a to-be-processed object, and repeatedly performing the first processing; and in response to determining that the parent directory of the to-be-processed object already exists according to the name, taking the path starting from the parent directory of the file and ending at the parent directory of the to-be-processed object as the required directory path.

[0049] In an embodiment of the present disclosure, after the name of any parent directory is determined, in response to determining that there is a file with the same name as the parent directory in the file belonging to the same parent directory as the parent directory, the current file modification operation can be directly ended, otherwise, the subsequent processing can be continued.

[0050] Through the above processing, the same names of files and directories can be avoided, that is, the logical error is avoided, and the correctness of the hierarchical directory structure is ensured.

[0051] The above process can be illustrated as follows: assuming that the file modification operation to be performed corresponds to file d, the name of the parent directory of file d can be determined first, assuming to be w / a / b / c, and it can be determined whether there is a file with the same name as w / a / b / c among the files belonging to the same parent directory as w / a / b / c, assuming that there is not, then w / a / b / c can be taken as the object to be processed, and the name of the parent directory of w / a / b / c can be determined, assuming to be w / a / b, then it can be determined whether there is a file with the same name as w / a / b among the files belonging to the same parent directory as w / a / b, assuming that there is not, then it can be further determined whether w / a / b exists, assuming that it does not, then w / a / b can be taken as the object to be processed, and the name of the parent directory of w / a / b can be determined, assuming to be w / a, further, it can be determined whether there is a file with the same name as w / a among the files belonging to the same parent directory as w / a, assuming that there is not, then it can be further determined whether w / a exists, assuming that it does, then the path composed of w / a, w / a / b and w / a / b / c can be taken as the required directory path.

[0052] How to determine the name of the parent directory is not limited, such as using the existing implementation.

[0053] In the object storage system, there is no concept of hierarchical directory, so when the parent directory does not exist, it is also allowed to create a new file or directory.

[0054] After using the above processing method, the above implementation can be compatible, such as supporting direct operation on a file whose parent directory does not exist, and implementing one-time creation of multiple layers of directories.

[0055] In one embodiment of the present disclosure, for each layer of directory to be processed on the directory path, the following processing can be performed respectively: a temporary record in the form of a key-value pair corresponding to the file modification operation is added to the child node list of the directory to be processed, wherein if the directory to be processed is the parent directory of a file, the key of the temporary record can include the file name of the file, and if the directory to be processed is not the parent directory of a file, the key of the temporary record can include the name of the lower layer directory adjacent to the directory to be processed on the directory path.

[0056] That is, the key of the temporary record can include the file name or the directory name, and what information is included in the value of the temporary record can be determined according to actual needs, for example, a unique operation identifier generated for the file modification operation can be included, and in addition, some other information such as the operation type and basic information of the file modification operation can be further included.

[0057] Taking a directory path consisting of w / a, w / a / b and w / a / b / c as an example, the name of the directory w / a / b can be included in the key of the temporary record corresponding to the directory w / a, the name of the directory w / a / b / c can be included in the key of the temporary record corresponding to the directory w / a / b, and the file name of the file d can be included in the key of the temporary record corresponding to the directory w / a / b / c.

[0058] By means of the temporary record, the constructed hierarchical directory structure can be effectively recorded, and the temporary record can play a placeholder role. For example, if the current file modification operation is a file write operation on the file d, and the file modification operation of another person is to delete the file d, the temporary record can inform the other person that the file write operation is being performed and the deletion is not allowed. In addition, the temporary record can also play a role in error compatibility. For example, after the file modification operation is performed, the final information record cannot be generated in time due to some fault, and the temporary record can be used to generate the final information record after the fault is recovered.

[0059] II) Execution phase

[0060] After the preparation phase is completed, the execution phase can be executed, that is, the current file modification operation is executed.

[0061] In an embodiment of the present disclosure, the file modification operation can include a file write operation and a file deletion operation, that is, various operation types can be compatible, and the present disclosure has universal applicability.

[0062] III) Completion phase

[0063] After the current file modification operation is executed, for any to-be-processed directory, the metadata information corresponding to the current file modification operation can be recorded in the child node list of the to-be-processed directory, that is, the metadata information is written into the child node list of each parent directory, and the temporary record generated in the preparation phase is deleted.

[0064] In an embodiment of the present disclosure, for any to-be-processed directory, the final information record in the form of a key-value pair can be generated according to the temporary record, the information in the key of the information record is the same as the information in the key of the temporary record, and the metadata information is recorded in the value of the information record.

[0065] Specifically, in an embodiment of the present disclosure, the temporary record corresponding to the current file modification operation can be determined according to the operation identifier, and the information record can be generated according to the determined temporary record.

[0066] For a to-be-processed directory, there can be multiple temporary records, for example, the same file can be undergoing multiple operations, and accordingly, multiple temporary records can be generated, each having a respective operation identifier, and accordingly, the temporary record corresponding to the current file modification operation can be determined according to the operation identifier, and the final required information record can be generated according to the determined temporary record. The information record can also be in the form of a key-value pair. In addition, the information in the key of the information record is the same as the information in the key of the temporary record, and the metadata information is recorded in the value of the information record.

[0067] In the above manner, the required temporary record can be quickly and efficiently determined with the aid of the operation identifier, and the required information record can be quickly and efficiently generated based on the temporary record.

[0068] In addition, taking a directory path composed of w / a, w / a / b, and w / a / b / c as an example, the metadata information corresponding to the directory w / a is the metadata information of the directory w / a / b, and the metadata information corresponding to the directory w / a / b / c is the metadata information of the file d.

[0069] The contents included in different metadata information are not limited and can be determined according to actual needs. For example, the metadata information of a directory can include the creation time and version number of the directory, and the metadata information of a file can include the modification time and version number of the file.

[0070] In actual applications, if the to-be-processed directory only includes the parent directory of a file, i.e., the parent directory of the file exists, then the final information record can be generated for the to-be-processed directory in the above manner. If the to-be-processed directory includes multiple directories on the directory path, then for the multiple directories, the final information record can be generated in the above manner in a top-down order, such as for the directory w / a, the directory w / a / b, and the directory w / a / b / c.

[0071] When generating the information record, the contents in the value of the original temporary record, such as the operation identifier, can be deleted and replaced with the metadata information.

[0072] In one embodiment of the present disclosure, when generating the final information record in the form of a key-value pair according to the temporary record, in response to determining that the version number corresponding to the current file modification operation is higher than the recorded version number, the metadata information can be updated into the value of the temporary record to obtain the information record, and the metadata information includes the version number corresponding to the current file modification operation.

[0073] For example, after performing a file modification operation such as a file write operation, the version number corresponding to this file write operation will be returned. The version number is sequentially incremented and there is no repetition. Accordingly, it can be determined whether the version number corresponding to this file write operation is higher than the recorded version number. If so, the metadata information can be updated to the value of the temporary record to obtain the information record. Otherwise, it can be assumed that the file has been modified by someone else. To prevent the old operation from overwriting the new operation, the metadata information with the larger version number can be retained, that is, the processing ends.

[0074] It should be noted that, for the sake of simplicity, the foregoing method embodiments are described as a series of actions. However, those skilled in the art should understand that this disclosure is not limited to the described order of actions, as some steps may be performed in other orders or simultaneously according to this disclosure. Furthermore, those skilled in the art should also understand that the embodiments described in the specification are preferred embodiments, and the actions and modules involved are not necessarily essential to this disclosure.

[0075] In summary, the scheme described in the embodiments of this disclosure can maintain the corresponding hierarchical directory structure for the object storage system, ensure the consistency between the data in the hierarchical directory structure and the data in the object storage system, support direct operation on a file whose parent directory does not exist, and enable the creation of multiple levels of directories at once.

[0076] The above is an introduction to the method embodiments. The following describes the solution described in this disclosure further through device embodiments.

[0077] Figure 2 This is a schematic diagram of the structural composition of Embodiment 200 of the hierarchical directory implementation device described in this disclosure. Figure 2 As shown, it includes: preparation module 201, execution module 202 and completion module 203.

[0078] The preparation module 201 is used to prepare the file in the object storage system corresponding to the file modification operation to be performed. In response to determining that the parent directory of the file exists, the parent directory is used as the directory to be processed. Otherwise, the directory path corresponding to the file is constructed, and each level of the directory is used as the directory to be processed. The lowest level directory in the directory path is the parent directory of the file, and only the top level directory is an existing directory.

[0079] Execution module 202 is used to perform this file modification operation.

[0080] The completion module 203 is used to record metadata information corresponding to the current file modification operation in the child node list of any directory to be processed.

[0081] By adopting the scheme described in the device embodiment, the corresponding directory can be updated and / or constructed for each file modification operation, which can be a file modification operation on the object storage system, and accordingly, the object storage system can be enabled to maintain the corresponding hierarchical directory structure, and the consistency between the data in the hierarchical directory structure and the data in the object storage system can be ensured, and direct operation on a file that does not exist in a parent directory is supported, and one-time creation of multiple layers of directories is implemented.

[0082] For a file modification operation to be performed, the preparation module 201 can first determine whether the parent directory of the corresponding file exists, and different processing modes can be adopted according to the determination result.

[0083] Among them, the preparation module 201 can take the parent directory of the file as a to-be-processed directory in response to determining that the parent directory of the file exists, and can construct the directory path corresponding to the file and take each layer of the directory in the directory path as a to-be-processed directory in response to determining that the parent directory of the file does not exist.

[0084] Specifically, in one embodiment of the present disclosure, the preparation module 201 can determine the name of the parent directory of the file, and take the parent directory of the file as a to-be-processed object, and perform the following first processing: determine the name of the parent directory of the to-be-processed object; in response to determining that the parent directory of the to-be-processed object does not exist according to the name, take the parent directory of the to-be-processed object as a to-be-processed object, and repeat the first processing; and in response to determining that the parent directory of the to-be-processed object already exists according to the name, take the path starting from the parent directory of the file and ending at the parent directory of the to-be-processed object as a directory path.

[0085] In one embodiment of the present disclosure, the preparation module 201 can end the file modification operation in response to determining that a directory with the same name as the file exists in the directories belonging to the same parent directory as the file after determining that the parent directory of the file exists, and / or the preparation module 201 can end the file modification operation in response to determining that a file with the same name as the parent directory exists in the files belonging to the same parent directory as the parent directory after determining the name of any parent directory.

[0086] In addition, in one embodiment of the present disclosure, the preparation module 201 can also perform the following processing for any to-be-processed directory: add a temporary record in the form of a key-value pair corresponding to the file modification operation to the child node list of the to-be-processed directory, and if the to-be-processed directory is the parent directory of the file, the key of the temporary record includes the file name of the file, and if the to-be-processed directory is not the parent directory of the file, the key of the temporary record includes the name of the lower layer directory adjacent to the to-be-processed directory on the directory path.

[0087] The file name or the directory name can be included in the key of the temporary record, and the information included in the value of the temporary record can be determined according to actual needs. For example, the unique operation identifier generated for the current file modification operation can be included, and some other information such as the operation type and the basic information of the current file modification operation can be further included.

[0088] Correspondingly, in one embodiment of the present disclosure, the completion module 203 can generate the final information record in the form of a key-value pair according to the temporary record for any to-be-processed directory. The information in the key of the information record is the same as the information in the key of the temporary record, and the metadata information can be recorded in the value of the information record.

[0089] Specifically, in one embodiment of the present disclosure, the completion module 203 can determine the temporary record corresponding to the current file modification operation according to the operation identifier, and generate the information record according to the determined temporary record.

[0090] For a to-be-processed directory, there can be multiple temporary records. For example, the same file can be undergoing multiple operations, and correspondingly, multiple temporary records can be generated, each having a respective operation identifier. Correspondingly, the temporary record corresponding to the current file modification operation can be determined according to the operation identifier, and the final information record required can be generated according to the determined temporary record. The information record can also be in the form of a key-value pair. In addition, the information in the key of the information record is the same as the information in the key of the temporary record, and the metadata information is recorded in the value of the information record.

[0091] The content included in different metadata information is not limited, and can be determined according to actual needs.

[0092] In actual application, if the to-be-processed directory only includes the parent directory of the file, that is, the parent directory of the file exists, then the final information record can be generated for the to-be-processed directory in the above manner. If the to-be-processed directory includes multiple directories on the directory path, then for the multiple directories, the final information record can be generated in the above manner in the order from top to bottom.

[0093] When the information record is generated, the content in the value of the original temporary record, such as the operation identifier, can be deleted, and the metadata information can be used instead.

[0094] In one embodiment of the present disclosure, when the final information record in the form of a key-value pair is generated according to the temporary record, in response to determining that the version number corresponding to the current file modification operation is higher than the recorded version number, the metadata information can be updated to the value of the temporary record to obtain the information record. The metadata information includes the version number corresponding to the current file modification operation.

[0095] In one embodiment of this disclosure, the file modification operation may include: file writing operation and file deletion operation.

[0096] Figure 2 The specific workflow of the device embodiment shown can be found in the relevant descriptions in the foregoing method embodiments, and will not be repeated here.

[0097] The solutions described in this disclosure can be applied to the field of artificial intelligence, particularly in areas such as cloud computing, cloud storage, and content distribution. Artificial intelligence is the study of enabling computers to simulate certain human thought processes and intelligent behaviors (such as learning, reasoning, thinking, and planning). It involves both hardware and software technologies. Artificial intelligence hardware technologies generally include sensors, dedicated AI chips, cloud computing, distributed storage, and big data processing. Artificial intelligence software technologies mainly include computer vision, speech recognition, natural language processing, machine learning / deep learning, big data processing, and knowledge graph technologies.

[0098] The collection, storage, use, processing, transmission, provision, and disclosure of user personal information involved in the technical solution disclosed herein comply with the provisions of relevant laws and regulations and do not violate public order and good morals.

[0099] According to embodiments of this disclosure, this disclosure also provides an electronic device, a readable storage medium, and a computer program product.

[0100] Figure 3 A schematic block diagram of an electronic device 300 that can be used to implement embodiments of the present disclosure is shown. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workbenches, servers, blade servers, mainframe computers, and other suitable computers. The electronic device may also represent various forms of mobile devices, such as personal digital assistants, cellular phones, smartphones, wearable devices, and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely illustrative and are not intended to limit the implementation of the present disclosure described and / or claimed herein.

[0101] like Figure 3 As shown, device 300 includes a computing unit 301, which can perform various appropriate actions and processes based on a computer program stored in read-only memory (ROM) 302 or a computer program loaded from storage unit 308 into random access memory (RAM) 303. The RAM 303 may also store various programs and data required for the operation of device 300. The computing unit 301, ROM 302, and RAM 303 are interconnected via bus 304. Input / output (I / O) interface 305 is also connected to bus 304.

[0102] The plurality of components in the device 300 are connected to the I / O interface 305, including: an input unit 306, such as a keyboard, a mouse, etc.; an output unit 307, such as various types of displays, speakers, etc.; a storage unit 308, such as a magnetic disk, an optical disk, etc.; and a communication unit 309, such as a network card, a modem, a wireless communication transceiver, etc. The communication unit 309 allows the device 300 to exchange information / data with other devices through a computer network, such as the Internet, and / or various telecommunication networks.

[0103] The computing unit 301 can be various general and / or special-purpose processing components with processing and computing capabilities. Some examples of the computing unit 301 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various special-purpose artificial intelligence (AI) computing chips, various computing units running machine learning model algorithms, a digital signal processor (DSP), and any appropriate processor, controller, microcontroller, etc. The computing unit 301 performs various methods and processes described above, such as the methods described in the present disclosure. For example, in some embodiments, the methods described in the present disclosure can be implemented as a computer software program, which is tangibly embodied in a machine-readable medium, such as the storage unit 308. In some embodiments, part or all of the computer program can be loaded and / or installed onto the device 300 via the ROM 302 and / or the communication unit 309. When the computer program is loaded onto the RAM 303 and executed by the computing unit 301, one or more steps of the methods described in the present disclosure can be performed. Alternatively, in other embodiments, the computing unit 301 can be configured to perform the methods described in the present disclosure by any other appropriate means, such as by means of firmware.

[0104] Various implementations of the systems and techniques described above can be realized in digital electronic circuitry, integrated circuitry, a field programmable gate array (FPGA), an application specific integrated circuit (ASIC), a system on a chip (SOC), a complex programmable logic device (CPLD), computer hardware, firmware, software, and / or combinations thereof. These various implementations can include implementation in one or more computer programs that are executable and / or interpretable on a programmable system including at least one programmable processor, which can be special or general purpose, coupled to receive data and instructions from, and to transmit data and instructions to, a storage system, at least one input device, and at least one output device.

[0105] Program code for carrying out methods of the present disclosure can be written in any combination of one or more programming languages. The program code can be provided to a processor or controller of a general purpose computer, special purpose computer, or other programmable data processing apparatus to produce a machine, such that the program code, when executed by the processor or controller, produces the functions / operations specified in the flowcharts and / or block diagrams. The program code can be executed entirely on a machine, partially on a machine, partially on a machine as a standalone software package, or entirely on a remote machine or server.

[0106] In the context of the present disclosure, a machine-readable medium can be a tangible medium that contains or stores a program for use by or in connection with an instruction execution system, apparatus, or device. The machine-readable medium can be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium can include but is not limited to an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any suitable combination of the foregoing. More specific examples of the machine-readable storage medium will include one or more lines of electrical connections, portable computer disks, hard disk drives, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or Flash memory), optical fibers, portable compact disc read-only memories (CD-ROMs), optical storage devices, magnetic storage devices, or any suitable combination of the foregoing.

[0107] To provide for interaction with a user, the systems and techniques described here can be implemented on a computer having a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user and a keyboard and a pointing device (e.g., a mouse or a trackball) by which the user can provide input to the computer. Other kinds of devices can be used to provide for interaction with a user as well; for example, feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form, including acoustic, speech, or tactile input.

[0108] The systems and techniques described here can be implemented in a computing system that includes a back end component (e.g., as a data server), or that includes a middleware component (e.g., an application server), or that includes a front end component (e.g., a user computer having a graphical user interface or a Web browser through which a user can interact with an implementation of the systems and techniques described here), or any combination of such back end, middleware, or front end components. The components of the system can be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include a local area network (LAN), a wide area network (WAN), and the Internet.

[0109] The computer system can include clients and servers. This relationship can be. The servers are typically remote from the clients with the interactions between them occurring over a communication network. The relationship between a client and a server is one of client-server. The server can be a cloud server, a server of a distributed system, or a server incorporating a blockchain.

[0110] It should be understood that the steps shown in the various forms above can be reordered, added to, or deleted from. For example, the steps recited in the present disclosure can be performed in parallel, in series, or in a different order, as long as the desired results of the technical solutions of the present disclosure are achieved, and the present disclosure is not limited herein.

[0111] The specific implementation described above does not constitute a limitation on the protection scope of the present disclosure. Those skilled in the art should understand that various modifications, combinations, sub-combinations, and substitutions can be made according to design requirements and other factors. Any modifications, equivalent replacements, and improvements within the spirit and principles of the present disclosure should be included in the protection scope of the present disclosure.

Claims

1. A method for implementing a hierarchical directory, comprising: For the file in the object storage system corresponding to the file modification operation to be performed, in response to the determination that a parent directory of the file exists, the parent directory is designated as the directory to be processed; otherwise, the directory path corresponding to the file is constructed in a bottom-up order, and each level of the directory is designated as the directory to be processed. The lowest level directory in the directory path is the parent directory of the file, and only the top level directory is an existing directory. For any directory to be processed, a temporary record in the form of a key-value pair corresponding to the current file modification operation is added to the child node list of the directory to be processed. Perform this file modification operation; For any directory to be processed, metadata information corresponding to the current file modification operation is recorded in the child node list of the directory to be processed, including: generating a key-value pair information record based on the temporary record, wherein the key of the information record is the same as the information in the key of the temporary record, and the value of the information record contains the metadata information.

2. The method according to claim 1, wherein, The directory path corresponding to the file being constructed includes: Determine the name of the parent directory of the file; The parent directory of the file is taken as the object to be processed, and the following first processing is performed: Determine the name of the parent directory of the object to be processed; In response to determining that the parent directory of the object to be processed does not exist based on the name, the parent directory of the object to be processed is taken as the object to be processed, and the first process is repeated. In response to the determination that the parent directory of the object to be processed already exists based on the name, the path starting from the parent directory of the file and ending at the parent directory of the object to be processed is taken as the directory path.

3. The method according to claim 2, further comprising: The response is to determine that a parent directory of the file exists, and then to determine that a directory with the same name as the file exists in a directory belonging to the same parent directory as the file, and then to end the current file modification operation. And / or, after determining the name of any parent directory, in response to determining that a file with the same name as the parent directory exists in the files belonging to the same parent directory, the current file modification operation ends.

4. The method according to claim 2, wherein, If the directory to be processed is the parent directory of the file, then the key of the temporary record includes: the file name of the file; if the directory to be processed is not the parent directory of the file, then the key of the temporary record includes: the name of the lower-level directory adjacent to the directory to be processed on the directory path.

5. The method according to claim 4, wherein, The value of the temporary record includes: a unique operation identifier generated for this file modification operation; The step of generating a key-value pair information record based on the temporary record includes: determining the temporary record corresponding to the current file modification operation based on the operation identifier, and generating the information record based on the temporary record.

6. The method according to claim 4, wherein, The generation of key-value pair information records based on the temporary records includes: In response to determining that the version number corresponding to the current file modification operation is higher than the recorded version number, the metadata information is updated to the value of the temporary record to obtain the information record, wherein the metadata information includes the version number corresponding to the current file modification operation.

7. The method according to any one of claims 1 to 6, wherein, The file modification operations include file writing operations and file deletion operations.

8. A hierarchical directory implementation apparatus, comprising: Preparation module, execution module, and completion module; The preparation module is used to, for the file in the object storage system corresponding to the file modification operation to be performed, in response to determining that a parent directory of the file exists, use the parent directory as the directory to be processed; otherwise, construct the directory path corresponding to the file in a bottom-up order, and use each level of the directory as the directory to be processed, with the lowest level directory of the directory path being the parent directory of the file, and only the top level directory being an existing directory; for any directory to be processed, add a temporary record in the form of a key-value pair corresponding to the current file modification operation to the child node list of the directory to be processed. The execution module is used to perform this file modification operation; The completion module is used to record metadata information corresponding to the current file modification operation in the child node list of any directory to be processed, including: generating a key-value pair information record based on the temporary record, wherein the key of the information record is the same as the information in the key of the temporary record, and the value of the information record contains the metadata information.

9. The apparatus according to claim 8, wherein, The preparation module determines the name of the parent directory of the file and uses the parent directory of the file as the object to be processed, and performs the following first process: determine the name of the parent directory of the object to be processed; In response to determining that the parent directory of the object to be processed does not exist based on the name, the parent directory of the object to be processed is taken as the object to be processed, and the first process is repeated. In response to the determination that the parent directory of the object to be processed already exists based on the name, the path starting from the parent directory of the file and ending at the parent directory of the object to be processed is taken as the directory path.

10. The apparatus according to claim 9, wherein, The preparation module is further configured to, in response to determining that a parent directory of the file exists, and in response to determining that a directory with the same name as the file exists in a directory belonging to the same parent directory as the file, end the current file modification operation; And / or, the preparation module is further configured to, after determining the name of any parent directory, terminate the current file modification operation in response to determining that a file with the same name as the parent directory exists in a file belonging to the same parent directory.

11. The apparatus according to claim 9, wherein, If the directory to be processed is the parent directory of the file, then the key of the temporary record includes: the file name of the file; if the directory to be processed is not the parent directory of the file, then the key of the temporary record includes: the name of the lower-level directory adjacent to the directory to be processed on the directory path.

12. The apparatus according to claim 11, wherein, The value of the temporary record includes: a unique operation identifier generated for this file modification operation; The completion module determines the temporary record corresponding to the current file modification operation based on the operation identifier, and generates the information record based on the temporary record.

13. The apparatus according to claim 11, wherein, In response to determining that the version number corresponding to the current file modification operation is higher than the recorded version number, the completion module updates the metadata information to the value of the temporary record to obtain the information record. The metadata information includes the version number corresponding to the current file modification operation.

14. The apparatus according to any one of claims 8 to 13, wherein, The file modification operations include file writing operations and file deletion operations.

15. An electronic device comprising: At least one processor; as well as A memory communicatively connected to the at least one processor; wherein, The memory stores instructions that can be executed by the at least one processor to enable the at least one processor to perform the method of any one of claims 1-7.

16. A non-transitory computer-readable storage medium storing computer instructions, wherein, The computer instructions are used to cause the computer to perform the method according to any one of claims 1-7.

17. A computer program product comprising a computer program / instructions that, when executed by a processor, implement the method of any one of claims 1-7.

Citation Information

Patent Citations

  • Method and device for establishing file catalog in distributed storage system

    CN108491549A