CN115168291A - Hierarchical directory implementation method and device, electronic equipment and storage medium - Google Patents
Hierarchical directory implementation method and device, electronic equipment and storage medium Download PDFInfo
- Publication number
- CN115168291A CN115168291A CN202210650301.3A CN202210650301A CN115168291A CN 115168291 A CN115168291 A CN 115168291A CN 202210650301 A CN202210650301 A CN 202210650301A CN 115168291 A CN115168291 A CN 115168291A
- Authority
- CN
- China
- Prior art keywords
- directory
- file
- processed
- modification operation
- parent
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Pending
Links
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/10—File systems; File servers
- G06F16/13—File access structures, e.g. distributed indices
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/10—File systems; File servers
- G06F16/16—File or folder operations, e.g. details of user interfaces specifically adapted to file systems
- G06F16/164—File meta data generation
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/20—Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
- G06F16/22—Indexing; Data structures therefor; Storage structures
- G06F16/2219—Large Object storage; Management thereof
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Data Mining & Analysis (AREA)
- Databases & Information Systems (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Software Systems (AREA)
- Human Computer Interaction (AREA)
- Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
Abstract
The disclosure provides a hierarchical directory implementation method, a hierarchical directory implementation device, electronic equipment and a storage medium, which relate to the field of artificial intelligence such as cloud computing, cloud storage and content distribution, and can be applied in an intelligent cloud scene, wherein the method comprises the following steps: for a file in an object storage system corresponding to a file modification operation to be executed, responding to the fact that a parent directory of the file exists, and taking the parent directory as a directory to be processed, otherwise, constructing a directory path corresponding to the file, and taking each layer of directory on the directory path as the directory to be processed respectively, wherein the lowest layer of directory is the parent directory of the file, and only the uppermost layer of directory is the existing directory; executing the file modification operation; and respectively recording metadata information corresponding to the file modification operation in a child node list of any directory to be processed. By applying the scheme disclosed by the invention, the corresponding hierarchical directory structure can be maintained for the object storage system, and the consistency of data and the like are ensured.
Description
Technical Field
The present disclosure relates to the field of artificial intelligence technologies, and in particular, to a hierarchical directory implementation method and apparatus, an electronic device, and a storage medium in the fields of cloud computing, cloud storage, and content distribution.
Background
The object storage system does not usually maintain a hierarchical directory structure between objects, but in some practical application scenarios, the hierarchical directory needs to be used, so that the practical needs cannot be met.
Disclosure of Invention
The disclosure provides a hierarchical directory implementation method, a hierarchical directory implementation device, an electronic device and a storage medium.
A hierarchical directory implementation method, comprising:
for a file in an object storage system corresponding to a file modification operation to be executed, responding to a determination that a parent directory of the file exists, and taking the parent directory as a directory to be processed, otherwise, constructing a directory path corresponding to the file, and taking each layer of directory as the directory to be processed respectively, wherein the lowest layer of directory on the directory path is the parent directory of the file, and only the uppermost layer of directory is the existing directory;
executing the file modification operation;
and for any directory to be processed, respectively recording metadata information corresponding to the file modification operation in a child node list of the directory to be processed.
A hierarchical directory implementing apparatus, comprising: a preparation module, an execution module and a completion module;
the preparation module is used for responding to the fact that a parent directory of a file is determined to exist in a file in an object storage system corresponding to the file modification operation to be executed, taking the parent directory as a directory to be processed, otherwise, constructing a directory path corresponding to the file, taking each layer of directory as the directory to be processed, wherein the directory at the lowest layer on the directory path is the parent directory of the file, and only the directory at the uppermost layer is the existing directory;
the execution module is used for executing the file modification operation;
and the completion module is used for respectively recording metadata information corresponding to the file modification operation in the child node list of the directory to be processed aiming at any directory to be processed.
An electronic device, comprising:
at least one processor; and
a memory communicatively coupled to the at least one processor; wherein the content of the first and second substances,
the memory stores instructions executable by the at least one processor to enable the at least one processor to perform a method as described above.
A non-transitory computer readable storage medium storing computer instructions for causing a computer to perform the method as described above.
A computer program product comprising computer programs/instructions which, when executed by a processor, implement a method as described above.
One embodiment in the above disclosure has the following advantages or benefits: the corresponding directory can be updated and/or constructed for each file modification operation, which can be a file modification operation for the object storage system, accordingly, the object storage system can maintain a corresponding hierarchical directory structure, the consistency of data in the hierarchical directory structure and data in the object storage system can be ensured, moreover, the direct operation of a file without a parent directory is supported, and the creation of multiple layers of directories at one time and the like can be realized.
It should be understood that the statements in this section are not intended to identify key or critical features of the embodiments of the present disclosure, nor are they intended to limit the scope of the present disclosure. Other features of the present disclosure will become apparent from the following description.
Drawings
The drawings are included to provide a better understanding of the present solution and are not to be construed as limiting the present disclosure. Wherein:
FIG. 1 is a flow chart of an embodiment of a hierarchical directory implementation method according to the present disclosure;
FIG. 2 is a schematic diagram of a hierarchical directory implementation apparatus 200 according to an embodiment of the present disclosure;
FIG. 3 shows a schematic block diagram of an electronic device 300 that may be used to implement embodiments of the present disclosure.
Detailed Description
Exemplary embodiments of the present disclosure are described below with reference to the accompanying drawings, in which various details of the embodiments of the disclosure are included to assist understanding, and which are to be considered as merely exemplary. Accordingly, those of ordinary skill in the art will recognize that various changes and modifications of the embodiments described herein can be made without departing from the scope and spirit of the disclosure. Also, descriptions of well-known functions and constructions are omitted in the following description for clarity and conciseness.
In addition, it should be understood that the term "and/or" herein is merely one type of association relationship that describes an associated object, meaning that three relationships may exist, e.g., a and/or B may mean: a exists alone, A and B exist simultaneously, and B exists alone. In addition, the character "/" herein generally indicates that the former and latter related objects are in an "or" relationship.
Fig. 1 is a flowchart of an embodiment of a hierarchical directory implementation method according to the present disclosure. As shown in fig. 1, the following detailed implementation is included.
In step 101, 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 used as a directory to be processed, otherwise, a directory path corresponding to the file is constructed, each layer of directories therein are respectively used as directories to be processed, a lowest layer directory on the directory path is a parent directory of the file, and only a top layer directory is an existing directory.
In step 102, the file modification operation is executed.
In step 103, for any directory to be processed, the metadata information corresponding to the current file modification operation is recorded in the child node list of the directory to be processed respectively.
If a hierarchical directory structure is to be maintained for the object storage system, data consistency issues are involved because the hierarchical directory structure is independent of the object storage system.
By adopting the scheme of the 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, correspondingly, the corresponding hierarchical directory structure can be maintained for the object storage system, the consistency of data in the hierarchical directory structure and data in the object storage system can be ensured, moreover, the method supports the direct operation of a file with a non-existent parent directory, and can realize the creation of a multilayer directory at one time and the like.
The implementation of the scheme of the present disclosure can be mainly divided into three stages, namely, a preparation stage, an execution stage and a completion stage, and specific implementations of the stages are described below.
One) preparation phase
To ensure consistency of data in the hierarchical directory structure with data in the object storage system, a preparation phase is introduced.
For the file modification operation to be executed, it may be determined whether the parent directory of the file corresponding to the file exists first, and different processing manners may be subsequently adopted according to different determination results, as shown in 1) and 2) below.
1) There is a parent directory of the file
In response to determining that the parent directory of the file exists, the parent directory may be treated as a pending directory.
For example, if the file corresponding to the file modification operation to be executed is file d, its parent directory is a/b/c, and the parent directory already exists, then the parent directory may be used as the to-be-processed directory.
In one embodiment of the present disclosure, after determining that the parent directory of the file exists, it may further be determined whether a directory having the same name as the file exists in the directory belonging to the same parent directory as the file, and in response to determining that a directory having the same name as the file exists in the directory belonging to the same parent directory as the file, the file modification operation may be directly ended, otherwise, the subsequent processing may be continued. The child nodes may include directories and files.
For example, if the file corresponding to the file modification operation to be executed is file d and the parent directory thereof is a/b/c, it may be determined whether the child node of the a/b/c includes directory d, and if so, the file modification operation may be directly ended, and the file modification operation may be considered to have failed.
Through the processing, the homonymy of the file and the directory can be avoided, namely, the occurrence of logic errors is avoided, and the correctness of the hierarchical directory structure is ensured.
In an embodiment of the present disclosure, for the to-be-processed directory, the following processing may be further performed: adding a temporary record in a key-value pair form corresponding to the current file modification operation to a child node list of the to-be-processed directory, wherein keys of the temporary record comprise: the file name of the file.
The child node list may include a plurality of records, in which names, metadata information, and the like of the child nodes are respectively recorded, and a common storage form in the child node list is a key-value pair form.
In the scheme of the disclosure, the temporary record can be generated firstly in the preparation stage. The key of the temporary record may include a file name, and what information is included in the value of the temporary record may be determined according to actual needs, for example, a unique operation identifier (opid) generated for the current file modification operation may be included, and in addition, some other information may be further included, such as basic information of the current file modification operation, for example, an operation type.
The operation identifier may be randomly generated, is a number for identifying the file modification operation, and has uniqueness.
2) There is no parent directory for the file
1) The method includes that when a parent directory of a file corresponding to a 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, a directory path corresponding to the file can be constructed, all layers of directories on the directory path are respectively used as directories to be processed, in addition, the lowest layer of directories on the directory path are the parent directory of the file, and only the uppermost layer of directories are existing directories, that is, all other layers of directories are created directories.
In an embodiment of the present disclosure, the constructing a directory path corresponding to the file may include: determining the name of a parent directory of the file; taking the parent directory of the file as a to-be-processed object, executing the following first processing: determining the name of a 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 according to the name, taking the parent directory of the object to be processed as the object to be processed, and repeatedly executing the first processing; and in response to determining that the parent directory of the object to be processed already exists according to the name, taking a path with the parent directory of the file as a starting point and the parent directory of the object to be processed as an ending point as a required directory path.
In an embodiment of the present disclosure, after the name of any parent directory is determined, in response to determining that a file having the same name as the parent directory exists in the files belonging to the same parent directory as the parent directory, the file modification operation may be directly ended, otherwise, the subsequent processing may be continued.
Through the processing, the homonymy of the file and the directory can be avoided, namely, the occurrence of logic errors is avoided, and the correctness of the hierarchical directory structure is ensured.
The above process can be exemplified as follows: assuming that a file corresponding to a file modification operation to be performed is a file d, the name of a parent directory of the file d can be determined first, assuming to be w/a/b/c, and it can be determined whether a file with the same name as w/a/b/c exists in files belonging to the same parent directory as w/a/b/c, assuming not to exist, then w/a/b/c can be taken as an 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 a file with the same name as w/a/b exists in files belonging to the same parent directory as w/a/b, assuming not to exist, then it can be further determined whether w/a/b exists, assuming not to exist, then w/a/b can be taken as an 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 a file with the same name as w/a file belonging to the same directory as w/a/b exists, assuming to be w/a path, then it can be determined whether a path exists, if w/b, then it can be further determined whether a path exists in files belonging to exist, if w/a/b, if w/b exists, then it can be determined that a path exists, if w/b, then it exists, then it can be a path exists, then it can be determined that a path exists in files belonging to constitute a path.
How to determine the name of the parent directory is not limited, and the existing implementation mode can be adopted.
In an object storage system, there is no concept of hierarchical directories, and thus when a parent directory does not exist, it is also allowed to create, for example, a new file or directory.
After the processing mode is adopted, the method is compatible with the implementation mode, for example, the method can support direct operation of a file without a parent directory, and can realize one-time creation of a plurality of layers of directories and the like.
In an embodiment of the present disclosure, for each layer of to-be-processed directories on the directory path, the following processes may be respectively performed: adding a temporary record in a key value pair form corresponding to the file modification operation in the child node list of the to-be-processed directory, wherein if the to-be-processed directory is a parent directory of a file, the key of the temporary record may include: the file name of the file, if the to-be-processed directory is not the parent directory of the file, the temporarily recorded key may include: the name of the lower layer directory adjacent to the pending directory on the directory path.
That is, the key of the temporary record may include a file name or a directory name, and what information is included in the value of the temporary record may be determined according to actual needs, for example, may include a unique operation identifier generated for the current file modification operation, and may further include some other information, such as a basic information of the current file modification operation, such as an operation type.
Taking directory paths composed of w/a, w/a/b and w/a/b/c as an example, the temporary record key corresponding to the directory w/a may include the name of the directory w/a/b, the temporary record key corresponding to the directory w/a/b may include the name of the directory w/a/b/c, and the temporary record key corresponding to the directory w/a/b/c may include the file name of the file d.
By means of the temporary record, the constructed hierarchical directory structure can be effectively recorded, the effect of occupying can be achieved, for example, if the current file modification operation is the file writing operation for the file d, and the file modification operation of other people is to delete the file d, then the temporary record can inform other people of executing the file writing operation, the deletion is not allowed, in addition, the effects of error compatibility and the like can be achieved, for example, after the file modification operation is executed, the final information record cannot be generated in time due to a certain fault reason, and then the final information record can be generated by means of the temporary record after the fault is recovered.
Two) execution phase
After the processing of the preparation phase is completed, the execution phase, that is, the current file modification operation, can be executed.
In one embodiment of the present disclosure, the file modification operation may include: the file writing operation and the file deleting operation can be compatible with various operation types, and the method has universal applicability.
Three) completion phase
After the file modification operation is executed, for any directory to be processed, the metadata information corresponding to the file modification operation can be recorded in the child node list of the directory to be processed respectively. That is, the metadata information is written into the child node list of each parent directory, and the temporary record generated in the preparation stage is deleted.
In one embodiment of the present disclosure, for any directory to be processed, a final information record in the form of a key value pair may be generated according to the temporary record, where information in the key of the information record is the same as information in the key of the temporary record, and the metadata information is recorded in the value of the information record.
Specifically, in an embodiment of the present disclosure, a temporary record corresponding to the current file modification operation may be determined according to the operation identifier, and an information record may be generated according to the determined temporary record.
For a certain directory to be processed, multiple temporary records may exist, for example, multiple operations may be occurring in the same file, and accordingly, multiple temporary records may be generated, each temporary record has its own operation identifier, accordingly, the temporary record corresponding to the current file modification operation may be determined according to the operation identifier, and a finally required information record may be generated according to the determined temporary record, the information record may also be in a key-value pair form, in addition, information in a key of the information record is the same as information in a key of the temporary record, and the metadata information is recorded in a value of the information record.
In this way, by means of the operation identifier, the required temporary record can be determined quickly and efficiently, and the required information record can be generated quickly and efficiently based on the temporary record.
In addition, take directory paths composed of w/a, w/a/b and w/a/b/c as an example, wherein the metadata information corresponding to the directory w/a refers to the metadata information of the directory w/a/b, and the metadata information corresponding to the directory w/a/b/c refers to the metadata information of the file d.
The contents respectively included in the different metadata information are not limited, and may be determined according to actual needs. For example, the metadata information of the directory may include creation time and version number of the directory, and the metadata information of the file may include file related information such as modification time and version number.
In practical applications, if the to-be-processed directory only includes a parent directory of a file, that is, if the parent directory of the file exists, the final information record may be generated directly for the to-be-processed directory in the above manner, and if the to-be-processed directory includes a multi-layer directory on a directory path, the final information record may be generated for the multi-layer directory in the above manner in the order from top to bottom, for example, for directory w/a, directory w/a/b, and directory w/a/b/c.
When an information record is generated, the content, such as the operation identifier, in the value of the original temporary record may be deleted and replaced with metadata information.
In an embodiment of the present disclosure, when generating an information record in a final key value pair form according to a temporary record, in response to determining that a version number corresponding to the current file modification operation is higher than a recorded version number, metadata information may be updated to the value of the temporary record to obtain the information record, where the metadata information includes the version number corresponding to the current file modification operation.
For example, after a file modification operation such as a file write operation is performed, a version number corresponding to the file write operation is returned, the version numbers are sequentially incremented without repetition, and accordingly, it is determined whether the version number corresponding to the file write operation is higher than a recorded version number, if so, the metadata information may be updated to a temporarily recorded value to obtain an information record, otherwise, the file may be considered to have been modified by another person, and in order to prevent an old operation from overwriting a new operation, the metadata information with a larger version number may be retained, and the processing is ended.
It is noted that while for simplicity of explanation, the foregoing method embodiments are described as a series of acts, those skilled in the art will appreciate that the present disclosure is not limited by the order of acts, as some steps may, in accordance with the present disclosure, occur in other orders and concurrently. Further, those skilled in the art will appreciate that the embodiments described in the specification are presently preferred and that acts and modules are not required for the present disclosure.
In short, by adopting the scheme of the embodiment of the method, the corresponding hierarchical directory structure can be maintained for the object storage system, the consistency between the data in the hierarchical directory structure and the data in the object storage system can be ensured, the direct operation of a file without a parent directory is supported, and the creation of multiple layers of directories and the like can be realized at one time.
The above is a description of embodiments of the method, and the embodiments of the apparatus are described below to further illustrate the aspects of the disclosure.
Fig. 2 is a schematic diagram illustrating a structure of a hierarchical directory implementation apparatus 200 according to an embodiment of the present disclosure. As shown in fig. 2, includes: a preparation module 201, an execution module 202, and a completion module 203.
The preparing module 201 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, use the parent directory as a to-be-processed directory, otherwise, construct a directory path corresponding to the file, and use each layer of directories therein as the to-be-processed directories, where a lowermost directory on the directory path is a parent directory of the file, and only an uppermost directory is an existing directory.
The execution module 202 is configured to execute the file modification operation this time.
A completing module 203, configured to record, for any to-be-processed directory, metadata information corresponding to the current file modifying operation in a child node list of the to-be-processed directory.
By adopting the scheme of the device 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, accordingly, the corresponding hierarchical directory structure can be maintained for the object storage system, the consistency of data in the hierarchical directory structure and data in the object storage system can be ensured, moreover, the direct operation of a file with a non-existent parent directory is supported, and the creation of a multilayer directory and the like at one time can be realized.
For a file modification operation to be executed, the preparation module 201 may first determine whether a parent directory of a corresponding file exists, and then may adopt different processing manners according to different determination results.
The preparation module 201 may use the parent directory as a to-be-processed directory in response to determining that the parent directory of the file exists, may construct a directory path corresponding to the file in response to determining that the parent directory of the file does not exist, and may use each layer of directory therein as the to-be-processed directory.
Specifically, in an embodiment of the present disclosure, the preparation module 201 may determine a name of a parent directory of the file, and perform the following first process with the parent directory of the file as a to-be-processed object: determining the name of a parent directory of an object to be processed; in response to determining that the parent directory of the object to be processed does not exist according to the name, taking the parent directory of the object to be processed as the object to be processed, and repeatedly executing the first processing; and in response to determining that the parent directory of the object to be processed already exists according to the name, taking a path with the parent directory of the file as a starting point and the parent directory of the object to be processed as an ending point as a directory path.
In an embodiment of the present disclosure, the preparation module 201 may end the current file modification operation in response to determining that a directory having a name identical to that of the file exists in the directory belonging to the same parent directory as that of the file after determining that the parent directory of the file exists, and/or the preparation module 201 may end the current file modification operation in response to determining that a file having a name identical to that of the parent directory exists in the file belonging to the same parent directory as that of the parent directory after determining that the name of any parent directory exists.
In addition, in an embodiment of the present disclosure, the preparation module 201 may further perform the following processing for any directory to be processed: adding a temporary record in a key value pair form corresponding to the file modification operation in the child node list of the to-be-processed directory, wherein if the to-be-processed directory is a parent directory of the file, a key of the temporary record comprises: if the to-be-processed directory is not the parent directory of the file, the temporarily recorded key includes: the name of the lower layer directory adjacent to the pending directory on the directory path.
That is, the key of the temporary record may include a file name or a directory name, and what information is included in the value of the temporary record may be determined according to actual needs, for example, the key may include a unique operation identifier generated for the current file modification operation, and may further include some other information, such as a basic information of the current file modification operation, such as an operation type.
Accordingly, in an embodiment of the present disclosure, the completing module 203 may generate, for any directory to be processed, a final information record in the form of a key value pair according to the temporary record, where information in a key of the information record is the same as information in a key of the temporary record, and the value of the information record may record the metadata information.
Specifically, in an embodiment of the present disclosure, the completing module 203 may determine a temporary record corresponding to the file modifying operation according to the operation identifier, and may generate an information record according to the determined temporary record.
For a certain directory to be processed, multiple temporary records may exist, for example, multiple operations may be occurring in the same file, and accordingly, multiple temporary records may be generated, each temporary record has its own operation identifier, accordingly, the temporary record corresponding to the current file modification operation may be determined according to the operation identifier, and a finally required information record may be generated according to the determined temporary record, the information record may also be in a key-value pair form, in addition, information in a key of the information record is the same as information in a key of the temporary record, and the metadata information is recorded in a value of the information record.
The content included in the different metadata information is not limited, and may be determined according to actual needs.
In practical applications, if the to-be-processed directory only includes a parent directory of the file, that is, if the parent directory of the file exists, the final information record may be generated directly for the to-be-processed directory in the above manner, and if the to-be-processed directory includes a multi-layer directory on the directory path, the final information records may be generated for the multi-layer directory in the above manner in the order from top to bottom.
When an information record is generated, the content, such as the operation identifier, in the value of the original temporary record may be deleted and replaced with metadata information.
In an embodiment of the present disclosure, when generating an information record in a final key value pair form according to a temporary record, in response to determining that a version number corresponding to the current file modification operation is higher than a recorded version number, the completing module 203 may update metadata information into the value of the temporary record to obtain the information record, where the metadata information includes the version number corresponding to the current file modification operation.
In an embodiment of the present disclosure, the file modification operation may include: file write operations and file delete operations.
The specific work flow of the embodiment of the apparatus shown in fig. 2 may refer to the related description in the foregoing method embodiment, and is not repeated.
The scheme disclosed by the disclosure can be applied to the field of artificial intelligence, in particular to the fields of cloud computing, cloud storage, content distribution and the like. Artificial intelligence is a subject for studying a computer to simulate some thinking processes and intelligent behaviors (such as learning, reasoning, thinking, planning and the like) of a human, and has a hardware technology and a software technology, the artificial intelligence hardware technology generally comprises technologies such as a sensor, a special artificial intelligence chip, cloud computing, distributed storage, big data processing and the like, and the artificial intelligence software technology mainly comprises a computer vision technology, a voice recognition technology, a natural language processing technology, machine learning/deep learning, a big data processing technology, a knowledge graph technology and the like.
In the technical scheme of the disclosure, the processes of collecting, storing, using, processing, transmitting, providing, disclosing and the like of the personal information of the related user all accord with the regulations of related laws and regulations, and do not violate the common customs of public order.
The present disclosure also provides an electronic device, a readable storage medium, and a computer program product according to embodiments of the present disclosure.
FIG. 3 shows a schematic block diagram of an electronic device 300 that may be used to implement embodiments of the present disclosure. Electronic devices are intended to represent various forms of digital computers, such as laptops, desktops, workstations, servers, blade servers, mainframes, and other appropriate computers. Electronic devices may also represent various forms of mobile devices, such as personal digital assistants, cellular telephones, smart phones, wearable devices, and other similar computing devices. The components shown herein, their connections and relationships, and their functions, are meant to be examples only, and are not meant to limit implementations of the disclosure described and/or claimed herein.
As shown in fig. 3, the apparatus 300 includes a computing unit 301 that can perform various appropriate actions and processes according to a computer program stored in a Read Only Memory (ROM) 302 or a computer program loaded from a storage unit 308 into a Random Access Memory (RAM) 303. In the RAM 303, various programs and data necessary for the operation of the device 300 can also be stored. The computing unit 301, the ROM 302, and the RAM 303 are connected to each other via a bus 304. An input/output (I/O) interface 305 is also connected to bus 304.
Various components in device 300 are connected to I/O interface 305, including: an input unit 306 such as a keyboard, a mouse, or the like; an output unit 307 such as various types of displays, speakers, and the like; a storage unit 308 such as a magnetic disk, optical disk, or the like; and a communication unit 309 such as a network card, modem, wireless communication transceiver, etc. The communication unit 309 allows the device 300 to exchange information/data with other devices via a computer network such as the internet and/or various telecommunication networks.
Various implementations of the systems and techniques described here above may be implemented in digital electronic circuitry, integrated circuitry, field Programmable Gate Arrays (FPGAs), application Specific Integrated Circuits (ASICs), application Specific Standard Products (ASSPs), system on a chip (SOCs), complex Programmable Logic Devices (CPLDs), computer hardware, firmware, software, and/or combinations thereof. These various embodiments may include: implemented in one or more computer programs that are executable and/or interpretable on a programmable system including at least one programmable processor, which may be special or general purpose, receiving data and instructions from, and transmitting data and instructions to, a storage system, at least one input device, and at least one output device.
Program code for implementing the methods of the present disclosure may be written in any combination of one or more programming languages. These program codes may be provided to a processor or controller of a general purpose computer, special purpose computer, or other programmable data processing apparatus, such that the program codes, when executed by the processor or controller, cause the functions/operations specified in the flowchart and/or block diagram to be performed. The program code may execute entirely on the machine, partly on the machine, as a stand-alone software package partly on the machine and partly on a remote machine or entirely on the remote machine or server.
In the context of this disclosure, a machine-readable medium may be a tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device. The machine-readable medium may be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium may 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 a machine-readable storage medium would include an electrical connection based on one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
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 a user; and a keyboard and a pointing device (e.g., a mouse or a trackball) by which a user can provide input to the computer. Other kinds of devices may also be used to provide for interaction with a user; 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.
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: local Area Networks (LANs), wide Area Networks (WANs), and the Internet.
The computer system may include clients and servers. A client and server are generally remote from each other and typically interact through a communication network. The relationship of client and server arises by virtue of computer programs running on the respective computers and having a client-server relationship to each other. The server may be a cloud server, a server of a distributed system, or a server with a combined blockchain.
It should be understood that various forms of the flows shown above may be used, with steps reordered, added, or deleted. For example, the steps described in the present disclosure may be executed in parallel, sequentially, or in different orders, and are not limited herein as long as the desired results of the technical solutions disclosed in the present disclosure can be achieved.
The above detailed description should not be construed as limiting the scope of the disclosure. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions may be made in accordance with design requirements and other factors. Any modification, equivalent replacement, and improvement made within the spirit and principle of the present disclosure should be included in the scope of protection of the present disclosure.
Claims (17)
1. A hierarchical directory implementation method, comprising:
for a file in an object storage system corresponding to a file modification operation to be executed, responding to a determination that a parent directory of the file exists, and taking the parent directory as a directory to be processed, otherwise, constructing a directory path corresponding to the file, and taking each layer of directory as the directory to be processed respectively, wherein the lowest layer of directory on the directory path is the parent directory of the file, and only the uppermost layer of directory is the existing directory;
executing the file modification operation;
and for any directory to be processed, recording metadata information corresponding to the file modification operation in a child node list of the directory to be processed respectively.
2. The method of claim 1, wherein the constructing the directory path corresponding to the file comprises:
determining the name of a parent directory of the file;
taking the parent directory of the file as a to-be-processed object, and executing the following first processing:
determining 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 according to the name, taking the parent directory of the object to be processed as the object to be processed, and repeatedly executing the first processing;
and in response to determining that the parent directory of the object to be processed already exists according to the name, taking a path with the parent directory of the file as a starting point and the parent directory of the object to be processed as an ending point as the directory path.
3. The method of claim 2, further comprising:
after the parent directory of the file is determined to exist, the directory with the same name as the file exists in the directory which belongs to the same parent directory as the file, and the file modification operation is finished;
and/or after the name of any father directory is determined, in response to the fact that the file with the same name as the father directory exists in the files belonging to the same father directory with the father directory, ending the file modification operation.
4. The method of claim 2, further comprising:
before executing the file modification operation, the following processing is respectively executed for any directory to be processed: adding a temporary record in a key value pair form corresponding to the file modification operation in the child node list of the to-be-processed directory, wherein if the to-be-processed directory is the parent directory of the file, the key of the temporary record comprises: if the to-be-processed directory is not the parent directory of the file, the temporarily recorded key includes: the name of a lower layer directory adjacent to the directory to be processed on the directory path;
the recording, for any to-be-processed directory, metadata information corresponding to the current file modification operation in the child node list of the to-be-processed directory includes: and generating an information record in a key-value pair form according to the temporary record, wherein the information in the key of the information record is the same as that in the key of the temporary record, and the metadata information is recorded in the value of the information record.
5. The method of claim 4, wherein,
the temporarily recorded values include: generating a unique operation identifier aiming at the file modification operation;
the generating of the information record in the form of a key-value pair according to the temporary record comprises: and determining a temporary record corresponding to the file modification operation according to the operation identifier, and generating the information record according to the temporary record.
6. The method of claim 4, wherein said generating an information record in the form of a key-value pair from said temporary record comprises:
and in response to determining that the version number corresponding to the current file modification operation is higher than the recorded version number, updating the metadata information into the value of the temporary record to obtain the information record, wherein the metadata information comprises the version number corresponding to the current file modification operation.
7. The method according to any one of claims 1 to 6,
the file modification operation comprises the following steps: file write operations and file delete operations.
8. A hierarchical directory implementing apparatus, comprising: the device comprises a preparation module, an execution module and a completion module;
the preparation module is used for responding to the fact that a parent directory of a file is determined to exist in a file in an object storage system corresponding to the file modification operation to be executed, taking the parent directory as a directory to be processed, otherwise, constructing a directory path corresponding to the file, taking each layer of directory as the directory to be processed, wherein the directory at the lowest layer on the directory path is the parent directory of the file, and only the directory at the uppermost layer is the existing directory;
the execution module is used for executing the file modification operation;
and the completion module is used for respectively recording metadata information corresponding to the file modification operation in a child node list of any directory to be processed.
9. The apparatus of claim 8, wherein,
the preparation module determines the name of the parent directory of the file, takes the parent directory of the file as a to-be-processed object, and executes the following first processing: determining 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 according to the name, taking the parent directory of the object to be processed as the object to be processed, and repeatedly executing the first processing; and in response to determining that the parent directory of the object to be processed already exists according to the name, taking a path with the parent directory of the file as a starting point and the parent directory of the object to be processed as an ending point as the directory path.
10. The apparatus of claim 9, wherein,
the preparation module is further configured to, after determining that the parent directory of the file exists, end the file modification operation in response to determining that a directory having the same name as the file exists in directories that belong to the same parent directory as the file;
and/or the preparation module is further used for responding to the fact that the file with the same name as the father directory exists in the files belonging to the same father directory with the father directory after the name of any father directory is determined, and ending the file modification operation.
11. The apparatus of claim 9, wherein,
the preparation module is further configured to, for any directory to be processed, respectively perform the following processing: adding a temporary record in a key value pair form corresponding to the file modification operation in the child node list of the to-be-processed directory, wherein if the to-be-processed directory is the parent directory of the file, the key of the temporary record comprises: if the to-be-processed directory is not the parent directory of the file, the temporarily recorded key includes: the name of a lower layer directory adjacent to the directory to be processed on the directory path;
and the completion module generates information records in a key-value pair form according to the temporary records aiming at any directory to be processed, wherein the information in the keys of the information records is the same as that in the keys of the temporary records, and the metadata information is recorded in the values of the information records.
12. The apparatus of claim 11, wherein,
the temporarily recorded values include: generating a unique operation identifier aiming at the file modification operation;
and the completion module determines a temporary record corresponding to the file modification operation according to the operation identifier, and generates the information record according to the temporary record.
13. The apparatus of claim 11, wherein,
and the completion module updates the metadata information to the value of the temporary record to obtain the information record in response to the fact that the version number corresponding to the current file modification operation is higher than the recorded version number, wherein the metadata information comprises the version number corresponding to the current file modification operation.
14. The apparatus according to any one of claims 8 to 13,
the file modification operation comprises: file write operations and file delete operations.
15. An electronic device, comprising:
at least one processor; and
a memory communicatively coupled to the at least one processor; wherein the content of the first and second substances,
the memory stores instructions executable 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 having stored thereon computer instructions for causing a computer to perform the method of any one of claims 1-7.
17. A computer program product comprising a computer program/instructions which, when executed by a processor, implement the method of any one of claims 1-7.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202210650301.3A CN115168291A (en) | 2022-06-09 | 2022-06-09 | Hierarchical directory implementation method and device, electronic equipment and storage medium |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202210650301.3A CN115168291A (en) | 2022-06-09 | 2022-06-09 | Hierarchical directory implementation method and device, electronic equipment and storage medium |
Publications (1)
Publication Number | Publication Date |
---|---|
CN115168291A true CN115168291A (en) | 2022-10-11 |
Family
ID=83485643
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202210650301.3A Pending CN115168291A (en) | 2022-06-09 | 2022-06-09 | Hierarchical directory implementation method and device, electronic equipment and storage medium |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN115168291A (en) |
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN116089364A (en) * | 2023-04-11 | 2023-05-09 | 山东英信计算机技术有限公司 | Storage file management method and device, AI platform and storage medium |
-
2022
- 2022-06-09 CN CN202210650301.3A patent/CN115168291A/en active Pending
Cited By (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN116089364A (en) * | 2023-04-11 | 2023-05-09 | 山东英信计算机技术有限公司 | Storage file management method and device, AI platform and storage medium |
CN116089364B (en) * | 2023-04-11 | 2023-07-14 | 山东英信计算机技术有限公司 | Storage file management method and device, AI platform and storage medium |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN112527281B (en) | Operator upgrading method and device based on artificial intelligence, electronic equipment and medium | |
CN111767321A (en) | Node relation network determining method and device, electronic equipment and storage medium | |
CN113641677A (en) | Data processing method and device, electronic equipment and storage medium | |
CN113792024A (en) | Method, device, equipment and storage medium for migrating data | |
CN112528067A (en) | Graph database storage method, graph database reading method, graph database storage device, graph database reading device and graph database reading equipment | |
CN115168291A (en) | Hierarchical directory implementation method and device, electronic equipment and storage medium | |
CN113868273B (en) | Metadata snapshot method and device | |
JP2023553220A (en) | Process mining for multi-instance processes | |
CN109408322B (en) | A kind of automatic business process implementation method of cloud platform | |
CN113553458A (en) | Data export method and device in graph database | |
CN112783447A (en) | Method, apparatus, device, medium, and article of manufacture for processing snapshots | |
CN116483707A (en) | Test method, test device, test apparatus, test program, and test program | |
US12007965B2 (en) | Method, device and storage medium for deduplicating entity nodes in graph database | |
CN114327271B (en) | Lifecycle management method, apparatus, device and storage medium | |
CN115794742A (en) | File path data processing method, device, equipment and storage medium | |
CN112988278B (en) | Meta file modification method and device of resource file, electronic equipment and storage medium | |
CN114168119A (en) | Code file editing method and device, electronic equipment and storage medium | |
CN114519071A (en) | Generation method, matching method, system, device and medium of rule matching model | |
CN114780021B (en) | Copy repairing method and device, electronic equipment and storage medium | |
US11614993B1 (en) | System and method for restoring deleted objects and their assignments to other objects based on any deletion of the other objects | |
CN114650222B (en) | Parameter configuration method, device, electronic equipment and storage medium | |
US20230161664A1 (en) | Method of responding to operation, electronic device, and storage medium | |
CN110096504B (en) | Streaming event feature matching method and device | |
CN115658612A (en) | Object renaming method and device, electronic equipment and storage medium | |
CN117667242A (en) | Data processing method, device, electronic equipment and storage medium |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination |