Metadata storage method, and metadata operation method and device of target object
By storing folder and file metadata in the file system separately and using identifiers for association, the problem of low metadata update and query performance in the file system is solved, and efficient metadata management and storage is achieved.
Patent Information
- Application Number
- CN202410696791.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-05-31
- Publication Date
- 2024-08-23
AI Technical Summary
In file systems, as the number of files reaches hundreds of thousands or millions, the performance of modifying and updating metadata of files or folders has seriously degraded. It is difficult for existing technologies to efficiently manage and store large amounts of metadata, resulting in low query performance. and waste of storage resources.
By storing the metadata of the folder object and the metadata of the file object separately, using the tile organization method and the tree organization method respectively, the folder metadata is in the folder database table, and the file metadata is in the file database table, using The folder ID is associated with the parent folder ID to avoid redundant storage and improve update efficiency.
It improves metadata update efficiency and query performance, reduces redundant storage resources, and improves the overall performance of the file system.
Smart Images

Figure CN118535576A
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of computer technology, and in particular to the field of organization and storage of metadata. Background Art
[0002] Metadata refers to data that describes data, mainly information that describes data attributes, and is used to support functions such as indicating storage locations, historical data, resource searches, and file records. In a file system, metadata is an important unit for describing a file system. In typical applications of most file systems, operations on metadata for files or folders account for more than half of all requests. In a file system, a relational database is used to store the metadata of trillions of files or folders. The metadata of all files or folders of each user is stored in a database table, which facilitates user-granular file queries and updates.
[0003] Then, as the number of files reaches hundreds of thousands or millions, the performance of modifying and updating the metadata of files or folders is seriously degraded. Summary of the invention
[0004] The present disclosure provides a metadata storage method, a target object metadata operation method and a device for solving at least one of the above technical problems.
[0005] According to one aspect of the present disclosure, a method for storing metadata is provided, wherein the method comprises:
[0006] For metadata of any target object, determine the object type of the target object;
[0007] In the case where the target object is a folder object, assigning a folder identifier to the folder object;
[0008] Based on the folder identifier, storing metadata of the folder object in a folder database table;
[0009] In the case where the target object is a file object, determining the folder identifier of the folder object to which the file object belongs, and using the folder identifier as the parent folder identifier of the file object itself;
[0010] Based on the parent folder identifier, the metadata of the file object is stored in a file database table.
[0011] According to another aspect of the present disclosure, a method for operating metadata of a target object is provided, wherein the metadata of the target object is stored according to the above method.
[0012] According to another aspect of the present disclosure, a metadata storage device is provided, wherein the device comprises:
[0013] A first determination module, configured to determine the object type of any target object based on the metadata of the target object;
[0014] A first allocation module, configured to allocate a folder identifier to the folder object when the target object is a folder object;
[0015] A first storage module, configured to store metadata of the folder object into a folder database table based on the folder identifier;
[0016] A second determination module is used to determine the folder identifier of the folder object to which the file object belongs when the target object is a file object, and use the folder identifier as the parent folder identifier of the file object itself;
[0017] The second storage module is used to store the metadata of the file object into a file database table based on the parent folder identifier.
[0018] According to another aspect of the present disclosure, a device for operating metadata of a target object is provided, wherein the metadata of the target object is stored according to the above method.
[0019] According to another aspect of the present disclosure, there is provided an electronic device, comprising:
[0020] at least one processor; and
[0021] a memory communicatively connected to the at least one processor; wherein,
[0022] The memory stores instructions that can be executed 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 above method.
[0023] According to another aspect of the present disclosure, a non-transitory computer-readable storage medium storing computer instructions is provided, wherein the computer instructions are used to cause the computer to execute the above method.
[0024] According to another aspect of the present disclosure, a computer program product is provided, comprising a computer program, wherein the computer program implements the above method when executed by a processor.
[0025] It should be understood that the content described in this section is not intended to identify the key or important features of the embodiments of the present disclosure, nor is it intended to limit the scope of the present disclosure. Other features of the present disclosure will become easily understood through the following description. BRIEF DESCRIPTION OF THE DRAWINGS
[0026] The accompanying drawings are used to better understand the present solution and do not constitute a limitation of the present disclosure.
[0027] Figure 1 It is a flowchart of a metadata storage method provided by the first embodiment of the present disclosure;
[0028] Figure 2 It is an exemplary schematic diagram of a key-value organization method of metadata in the related art;
[0029] Figure 3 It is an exemplary schematic diagram of a tree-shaped organization method of metadata in the related art;
[0030] Figure 4 It is an exemplary schematic diagram of a flat organization method of metadata in the related art;
[0031] Figure 5 is a schematic diagram of the organization form of metadata in the method provided by the embodiment of the present disclosure;
[0032] Figure 6 is an exemplary flow chart of S103;
[0033] Figure 7 is an exemplary flow chart of S105;
[0034] Figure 8 It is a flowchart of a method for operating metadata of a target object provided by the second embodiment of the present disclosure;
[0035] Fig. 9 is a flowchart of another method for operating metadata of a target object provided by the second embodiment of the present disclosure;
[0036] Fig.10 is a schematic diagram of the structure of a metadata storage device provided by the third embodiment of the present disclosure;
[0037] Fig.11 is a schematic diagram of the structure of a device for operating metadata of a target object provided by a fourth embodiment of the present disclosure;
[0038] Fig.12 The block diagram is a block diagram of an electronic device for implementing the method of the embodiment of the present disclosure. DETAILED DESCRIPTION
[0039] The following is a description of exemplary embodiments of the present disclosure in conjunction with the accompanying drawings, including various details of the embodiments of the present disclosure to facilitate understanding, which should be considered as merely exemplary. Therefore, it should be recognized by those of ordinary skill in the art that various changes and modifications may be made to the embodiments described herein without departing from the scope and spirit of the present disclosure. Similarly, for the sake of clarity and conciseness, descriptions of well-known functions and structures are omitted in the following description.
[0040] In the absence of conflict, the various embodiments of the present disclosure and the various features therein may be combined with each other.
[0041] As used herein, the term "and / or" includes any and all combinations of one or more of the associated listed items.
[0042] The terminology used herein is for describing particular embodiments only and is not intended to limit the present disclosure.As used herein, the singular forms "a", "an" and "the" are intended to include the plural forms as well, unless the context clearly indicates otherwise.
[0043] Unless otherwise defined, all terms (including technical and scientific terms) used herein have the same meaning as commonly understood by those of ordinary skill in the art. It will also be understood that terms such as those defined in commonly used dictionaries should be interpreted as having a meaning consistent with their meaning in the context of the relevant art and the present disclosure, and will not be interpreted as having an idealized or overly formal meaning unless explicitly defined as such herein.
[0044] The metadata storage method according to the present disclosure can be executed by an electronic device such as a terminal device or a server, and the terminal device can be a vehicle-mounted device, a user equipment (User Equipment, UE), a mobile device, a user terminal, a terminal, a cellular phone, a cordless phone, a personal digital assistant (Personal Digital Assistant, PDA), a handheld device, a computing device, a vehicle-mounted device, a wearable device, etc. The method can be implemented by a processor calling a computer-readable program instruction stored in a memory. Alternatively, the metadata storage method provided by the present disclosure can be executed by a server.
[0045] It should be noted that the metadata storage method provided in the embodiments of the present disclosure can be applied in a distributed file system or in a local file system, and is not limited here.
[0046] In the first embodiment disclosed, see Figure 1 , Figure 1 A schematic diagram of a metadata storage method provided by the first embodiment of the present disclosure is shown. The method includes:
[0047] S101. Determine the object type of any target object according to metadata of the target object.
[0048] S102: When the target object is a folder object, assign a folder identifier to the folder object.
[0049] S103: Store metadata of the folder object in a folder database table based on the folder identifier. S104: When the target object is a file object, determine the folder identifier of the folder object to which the file object belongs, and use it as the parent folder identifier of the file object itself.
[0050] S105: Store the metadata of the file object into a file database table based on the parent folder identifier.
[0051] In the file system, a file includes data and metadata. Data refers to the actual data in the file, while metadata refers to system data used to describe the characteristics of a file, such as access rights, file owners, and the distribution information of file data blocks. Metadata is information about the organization of data, data domains, and their relationships. In other words, metadata is data used to describe data, and contains descriptive information about data and information resources.
[0052] The target object is an operable storage object in the file system; the object types include at least: a file object and a folder object.
[0053] In S102, the folder identifier is a globally unique identifier of the folder object, which can be generated and assigned to the folder object in a variety of ways. In other words, S102 may include:
[0054] Serialize the folder name of the folder object to obtain a serial number, and use the serial number as the folder identifier of the folder object.
[0055] Alternatively, a random number is generated and used as the folder identifier of the folder object. No limitation is made here.
[0056] In the file system, when a user needs to operate a file, he needs to obtain its metadata first, so that he can locate the file and obtain the file content or related attributes. Therefore, it is crucial to manage and store metadata in an efficient way.
[0057] In the related art, the metadata of a folder and the metadata of a file are usually stored in the same database table, and the metadata of the file and the metadata of the folder are both stored with their corresponding paths, and the path of the file's metadata records the information of the parent folder to which the file belongs. Therefore, when an update operation is to be performed on the folder, wherein the update operation includes, for example, a move operation or a rename operation, it is necessary to modify the path of the folder, and to change the paths in the metadata of all its associated child files and subfolders. Therefore, when the amount of file data is huge, the update efficiency is seriously affected, and the field information of the parent folder is stored in the file's metadata, and the field information of the parent folder occupies a huge storage space, resulting in a waste of storage resources.
[0058] Through the method provided by the embodiment of the present disclosure, the metadata of the folder and the metadata of the file are stored separately in two tables, and the field information of the folder to which the file belongs is not recorded in the metadata of the file. Only the folder identifier of the folder to which the file belongs is used as its own parent folder identifier to associate the metadata of the folder to which the file belongs in the folder database table. In this way, the efficiency of metadata update can be improved, that is, when updating the metadata of the folder, only the field of the metadata of the folder needs to be modified in the folder database table, and the metadata of the file does not need to be modified as long as the folder identifier remains unchanged; and when updating the metadata of the file, only the file database table needs to be changed, and the metadata of the folder does not need to be updated in the folder database table. In addition, since the field information of the folder to which the file belongs is no longer recorded in the metadata of the file, and only a parent folder identifier is recorded, redundant storage resources are effectively reduced.
[0059] In order to facilitate understanding of this solution, the relevant technologies are introduced here. In the relevant technologies, the organization forms of metadata of files or folders generally include the following, where the target objects include files and folders:
[0060] Method 1: Key-value (KV) organization: Generate a globally unique hash key for each target object, serialize the metadata of the target object as the corresponding value, and then store this KV tuple in a KV system. In this organization form, the metadata of any two different target objects are completely unrelated. See Figure 2 , Figure 2 An example diagram showing a KV organization method, where the target object side is a file or folder, and the metadata side is a KV tuple expression of the file or folder.
[0061] Method 2: Tree-shaped organization: Organize file metadata according to the structure of the user file directory tree. The metadata of each target object is associated with an object identifier, and the metadata of the sub-target object stores the folder identifier of the parent folder. Figure 3 , Figure 3 An example diagram showing a tree organization method, where the target object side is a file or folder, and the metadata side is a tree organization expression of the file or folder, wherein: Figure 3 The "fid" in the . Figure 3 The "pid" in the pid indicates the folder ID of the parent folder.
[0062] Method 3: Flat organization: The metadata of each target object stores an absolute path, which consists of a folder name and a file name. Figure 4 , Figure 4 An example diagram showing a flat organization method, where the target object side is a file or folder, and the metadata side is a flat organization expression of the file or folder, wherein: Figure 4 The "dir" in the command indicates the folder name. Figure 4 The "name" in the command indicates the file name.
[0063] It should be noted that for the file system, the main operation instructions for the metadata of the target object are:
[0064] Single file query operation command: query a file by full file path or file ID;
[0065] Folder list operation command: query all sub-target objects in the next layer of a folder;
[0066] Folder recursive query operation instruction: query all sub-target objects under a folder;
[0067] Target object copy operation instruction: copy all sub-target objects under a file or folder to other locations;
[0068] Target object deletion operation instruction: Delete the target object, generally by modifying the value of the status field to mark the target object as deleted;
[0069] Target object moving operation instruction: move the target object to another location;
[0070] Target object rename operation instruction: Modify the name of the target object.
[0071] However, the above-mentioned organizational methods all have some defects for these operation instructions.
[0072] For the above operation instructions, the KV organization method only supports operations on a single file and can hardly meet the requirements of other operation instructions.
[0073] The tree organization method can support all the above operation instructions, but if the queried file has multiple directories, it is necessary to recursively query by level, that is, multiple database queries, which seriously affects the query performance.
[0074] The flat organization method can support all the above operations, but there are a large number of string comparisons during query. At the same time, the update operation of a folder requires not only updating the metadata of the folder, but also modifying the metadata of all sub-files and sub-folders, which seriously limits the update performance. In addition, the metadata of the file needs to store the field information of the folder level, which takes up a large amount of storage resources.
[0075] In order to solve the problems existing in the above-mentioned organization methods, the method provided by the present disclosure firstly stores the metadata of the file object and the metadata of the folder object separately in two tables, and different organization forms can be adopted for the metadata of the file object and the metadata of the folder object, so as to combine the advantages of different organization forms and avoid the limitations of different organization forms. See below for details.
[0076] For some examples, see Figure 5 , Figure 5 A schematic diagram showing the organization form of metadata in the method provided by an embodiment of the present disclosure, wherein: Figure 5 In the table, "Table_dir" indicates the folder database table, "Table_file" indicates the file database table, "id" indicates the folder ID, "pid" indicates the parent folder ID, "fid" indicates the file ID, "name" indicates the file name, and "root_dir", "1st_dir", "2nd_dir" and so on indicate different folder level subfields. The target object side is an example of a file object or a folder object. The target object side is an expression of the path information of the folder object, that is, Figure 5 The part in the brackets of "Table_dir:()" or the expression representing the information of the file object is Figure 5 The part within the brackets of "Table_file:()".
[0077] For example, in combination Figure 5 and Figure 6 ,in, Figure 6 An exemplary flow chart of S103 is shown, where S103 includes:
[0078] S1031. Adopt a flat organization method, construct path information of the folder object based on the folder identifier of the folder object, and store the path information in metadata of the folder object.
[0079] S1032. Store the metadata of the folder object into the folder database table.
[0080] Since folder objects usually include multiple layers of hierarchical relationships, which will form multiple layers of nested folders, a flat organization method is adopted. Each folder object has its own corresponding path information, where the path information is also called the absolute path. Therefore, to find a folder object, you only need to use the path information to perform a query once to find the folder object, which greatly improves the query efficiency; and the path information includes the globally unique folder identifier of the folder object. Therefore, when querying, you only need to use the folder identifier as the query condition in the folder database table for matching, so that the matching calculation is simplified, and the query performance is significantly improved.
[0081] For some examples, see Figure 5 and Figure 6 , S1031 includes:
[0082] S10311. Determine the folder level field of the folder object, and determine the layer name corresponding to the folder level field.
[0083] S10312. Generate path information according to the folder level field, the layer name corresponding to the folder level field, and the folder identifier, and store the path information in the metadata of the folder object.
[0084] In the present disclosure, the path information of the folder object is constructed in a flat organization mode. The path information of the flat organization mode includes at least: a folder level field and its level name, wherein the level name is also the folder name. Specifically, the expression of the path information of the folder object can be:
[0085] Folder level fields: layer name, folder ID: ID value.
[0086] See also Figure 5 , taking the expression of the path information of folder a as an example, the expression of folder a in the target object layer is "a / ", "root_dir" represents the folder level field, the layer name is a, id represents the folder identifier, and 10 is the value of the folder identifier. Therefore, the expression of the path information of folder a is: root_dir:a,id:10. Of course, the expression of the path information can also be in other forms, which are not limited here.
[0087] For some examples, see Figure 5 The folder level field includes multiple folder level subfields sorted according to the subordinate relationship of the folders.
[0088] S10311 specifically includes:
[0089] Sub-step 1: Determine each folder-level sub-field contained in the folder-level field of the folder object.
[0090] Sub-step 2: Determine the layer name of each folder-level sub-field contained in the folder-level field.
[0091] Each folder level subfield includes: a plurality of folder level subfields corresponding to the parent folder to which the folder object belongs, which are sorted according to the subordinate relationship of the folders, and a folder level subfield corresponding to the folder object itself.
[0092] Exemplarily, the folder level field may include 8 folder level subfields, which are sorted according to the subordinate relationship of the folders: root_dir, 1st_dir, 2nd_dir, 3rd_dir, 4th_dir, 5th_dir, 6th_dir, and tail_dir, wherein root_dir is the outermost folder level subfield, and tail_dir is the folder level subfield nested in the innermost layer. When constructing the path information of the folder object, the folder level subfield of the folder object itself is first determined, and then the folder level subfields of all parent folders of the folder object are determined, and these folder level subfields are sorted from the outer layer to the inner layer according to the subordinate relationship of the folders, and then the layer name of each folder level subfield is filled in, and finally the folder identifier is added to form the path information of the folder object.
[0093] See also Figure 5 , taking the expression of the path information of the inner folder c as an example, the expression of folder a in the target object layer is " / a / c", and its own folder level subfield is determined to be 1st_dir, and the layer name is c, and its own parent folder is determined to be folder a, and the folder level subfield of folder a is root_dir, and the layer name is a, and the folder ID of folder c is 12, so the expression of the path information of folder c is: root_dir:a,1st_dir:c,id:12. Of course, the expression of the path information can also be in other forms, which are not limited here.
[0094] By managing the hierarchical relationship of folder objects in this way, when recursively querying sub-files or sub-folders of folder objects, when the queried folder object is a nested folder object, string fuzzy matching can be fully reduced. The metadata corresponding to the folder object can be queried only through the folder hierarchy sub-field of the parent folder of the queried folder object and the folder hierarchy sub-field of the folder object itself. For detailed explanation, see the following description of the operation instructions. In this way, the query efficiency can be effectively improved, and a clearer metadata organization structure including the folder hierarchy relationship can be reflected in the folder database table.
[0095] For some examples, see Figure 7 , Figure 7 An exemplary flow chart of S105 is shown, where S105 includes:
[0096] S1051. Using a tree-like organization method, construct representation information of the file object based on the parent folder identifier, and store the representation information in the metadata of the file object.
[0097] S1052: Store the metadata of the file object into the file database table.
[0098] In the tree-like organization, the metadata of the file object is represented by the file name and the parent folder identifier, rather than the absolute path. This representation is referred to as representation information in the present disclosure. Therefore, for a file object, if the metadata of its parent folder is modified, as long as the folder identifier of the parent folder does not change, the metadata of the file object does not need to be modified in the file database table, which greatly increases the update performance of the file system. Moreover, in the present disclosure, the metadata of the file object does not need to record the metadata of the parent folder to which it belongs. The metadata of the parent folder, i.e., the folder level field in the path information of the above-mentioned folder object, only needs to record a parent folder identifier, thus effectively reducing the storage resources occupied by the folder level field.
[0099] For some examples, see Figure 7 , S1051 includes:
[0100] S10511. Allocate a file identifier for the file object.
[0101] S10512. Determine the file name of the file object.
[0102] S10513. Generate representation information according to the file identifier, file name and parent folder identifier of the file object, and store the representation information in the metadata of the file object.
[0103] In the present disclosure, the representation information of the file object is constructed in a tree-like organization manner, and the representation information at least includes: the file representation of the file object, the file name and the representation of the parent folder to which the file object belongs, and the parent folder is only the upper-level folder of the location of the file object, wherein a file identifier can be assigned to the file object first, and then the file identifier, the file name and the parent folder identifier are used to construct the representation information of the file object. Specifically, the representation information of the file object is in the form of:
[0104] File name field: file name, file identifier: identifier value, parent file identifier: identifier value.
[0105] See also Figure 5 , taking the representation information of file b1 as an example, the expression of file b1 on the target object side is “ / a / b / b1”, Figure 5 "name" indicates the field of the file name. Figure 5 "pid" represents the parent folder ID of the file object. The parent folder ID is the folder ID in the metadata of the folder object to which the file object belongs stored in the folder database table, that is, Figure 5 The "id" in the path information of the folder object is the "pid" in the expression information of the child file object of the folder object. Figure 5 In the expression, "fid" indicates a file identifier, so the expression of file b1 is: name:b1,fid:211,pid:11. Of course, the expression for expressing information can also be in other forms, which are not limited here.
[0106] Among them, the file identifier of the file object can be generated in a variety of ways, for example: serializing the file name of the file object to obtain a serial number, and using the serial number as the file identifier of the file object; or generating a random number and using the random number as the file identifier of the file object, which is not limited here.
[0107] Through the above method, the metadata corresponding to the folder and the metadata corresponding to the file are stored separately. The metadata corresponding to the folder uses a flat organization method, and the metadata of the file object uses a tree organization method, giving full play to the advantages of the two metadata organization methods, thereby taking into account the optimization of query performance, update performance, and storage capacity at the same time. The metadata corresponding to the folder uses a flat organization method, which can avoid the problem of recursive query by level in the tree organization method in the case of multi-level directories, which requires multiple queries and has low query performance; the metadata of the file object uses a tree organization method, which can effectively reduce the redundant storage capacity of the folder level field, and for the update of the folder object, there is no need to modify the metadata of the file object in the file database table, thereby improving the update performance.
[0108] In some examples, the data type of the folder identifier is an integer, and / or the data type of the parent folder identifier is an integer.
[0109] In the related art, the condition for querying files is usually a string equivalence judgment, and the condition for querying folders is usually a string prefix match. In the method provided in the present invention, matching is performed through an integer folder identifier or a parent folder identifier. Therefore, in the matching calculation process, the calculation for querying folder objects is a string equivalence judgment calculation, and the calculation for querying files is an integer equivalence judgment calculation, which significantly improves the calculation efficiency and thus improves the overall query performance.
[0110] In the first embodiment disclosed, see Figure 8 , Figure 8 A schematic flow chart of a method for operating metadata of a target object provided by the second embodiment of the present disclosure is shown. In the method, the metadata of the target object is stored according to the above-mentioned metadata storage method.
[0111] Among them, the method includes:
[0112] S201. In response to receiving an operation instruction for a target object, determining a folder query condition corresponding to the operation instruction, and determining metadata of the folder object in a folder database table.
[0113] S202: Execute an operation instruction according to metadata of the folder object.
[0114] Among them, S201 and S202 are operations on metadata of the folder database table.
[0115] Since the method provided in the first public embodiment is adopted, the metadata of the file object and the metadata of the folder object are stored separately. Therefore, when some folder update operation instructions are executed on the folder, such as folder rename operation instructions, the operation can be performed only on the metadata of the folder object in the folder database table, thereby eliminating the operation on the metadata of the file object, simplifying the operation and improving the update efficiency.
[0116] For some examples, see Fig. 9 , Fig. 9 A flowchart showing another method for operating metadata of a target object provided by the second embodiment of the present disclosure is shown, the method comprising:
[0117] S301. In response to receiving an operation instruction for a target object, determining a folder query condition corresponding to the operation instruction, and determining metadata of the folder object in a folder database table.
[0118] S302: Determine a corresponding target folder identifier based on metadata of the folder object.
[0119] S303: Execute an operation instruction according to the metadata of the folder object.
[0120] S304: Based on the target folder identifier as a file query condition, determine the metadata of the file object in the file database table.
[0121] S305: Execute the operation instruction according to the metadata of the file object.
[0122] Among them, S304 and S305 are operations on the metadata of the file database table.
[0123] It should be noted that, in some examples, S302, S304 and S305 may be omitted.
[0124] When operating on the metadata of a file object or a folder object, the operation can be performed in combination with the folder database table and the file database table. In some examples, only the folder database table can be operated, so that the operations on the metadata of the file object and the metadata of the folder object are isolated from each other, thereby increasing the data security of the operation.
[0125] There are many types of operation instructions for the target object. Take the following as an example, combined with Figure 5 Provide explanation.
[0126] Example 1: The operation instruction is a folder rename operation instruction. The target object is a folder object.
[0127] In this embodiment, S301 includes: in response to receiving a folder rename operation instruction for a folder object, determining a folder query condition corresponding to the folder rename operation instruction, and determining the metadata of the folder object in a folder database table; wherein the folder query condition includes the layer name of the folder hierarchy field of the folder object.
[0128] S303 includes: executing a folder renaming operation instruction for the layer name of the folder hierarchy field in the metadata of the folder object.
[0129] Specifically, the value of the layer name of the folder object itself and the folder level field corresponding to the subfolder is directly modified in the folder database, and all sub-file metadata do not need to be changed, that is, the metadata of the file object in the file database table does not need to be modified, thereby improving the update efficiency. In this example, S302, S304, and S305 can be omitted.
[0130] Example 2: The operation instruction is a single file query operation instruction: the target object is a file object.
[0131] In this embodiment, S301 includes: in response to receiving a single file query operation instruction for a file object, determining a folder query condition corresponding to the single file query operation instruction, and determining metadata of a parent folder object to which the file object belongs in a folder database table.
[0132] The folder query condition includes the layer name of the folder level field of the metadata of the parent folder object.
[0133] S302 includes: determining a corresponding folder identifier based on metadata of a parent folder object.
[0134] The operation instruction of S303 is empty.
[0135] S304 includes: using the folder identifier corresponding to the metadata of the parent folder object and the file name of the file object as file query conditions, and determining the metadata of the file object in the file database table.
[0136] The operation instruction of S305 is empty.
[0137] For the sake of explanation, Figure 5 , take a specific operation instance as an example to illustrate Example 2. Take the query file object b1 as an example, Figure 5 The file object b1 is represented by " / a / b / b1", including:
[0138] S301. In response to receiving a single file query operation instruction for file object b1, determining that the folder query condition corresponding to the single file query operation instruction is root_dir='a'and1st_dir='b', determining metadata of the parent folder object b to which the file object belongs in the folder database table.
[0139] S302: Determine the corresponding folder identifier as 11 based on the metadata of the parent folder object b.
[0140] The operation instruction of S303 is empty.
[0141] S304: Use the folder identifier 11 corresponding to the metadata of the parent folder object b and the file name b1 of the file object as file query conditions, expressed as pid=11and name='b1', and determine the metadata of the file object in the file database table.
[0142] The operation instruction of S305 is empty.
[0143] In some examples, a joint query (join) method may be used to jointly query information in a folder database table and a file database table to improve query efficiency.
[0144] Example 3: The operation instruction is a folder list operation instruction; the target object is a folder object.
[0145] In this embodiment, S301 includes: in response to receiving an operation instruction for a folder object which is a folder list operation instruction, determining a folder query condition corresponding to the folder list operation instruction, determining the metadata of the folder object in the folder database table, and determining the metadata of all subfolders of the folder object by matching the path information in the metadata of the folder object with the path information of other folder objects.
[0146] The folder query condition includes the layer name of the folder level field of the metadata of the folder object, and in some examples, includes the layer names of multiple folder level subfields.
[0147] S302 includes: determining a corresponding folder identifier based on metadata of the folder object.
[0148] The operation instruction of S303 is empty.
[0149] S304 includes: using the folder identifier corresponding to the metadata of the folder object as a file query condition, and determining the metadata of all sub-file objects of the folder object in the file database table.
[0150] The operation instruction of S305 is empty.
[0151] For the sake of explanation, Figure 5 , Example 3 is explained with a specific operation example. Taking the query of the list of folder object c as an example, Figure 5 The folder object c is represented by " / a / c", including:
[0152] S301 includes: in response to receiving an operation instruction for a folder object c which is a folder list operation instruction, determining a folder query condition corresponding to the folder list operation instruction, expressed as root_dir='a'and1st_dir='c', determining the metadata of the folder object in the folder database table, and determining the metadata of all subfolders of the folder object according to the path information in the metadata of the folder object and the path information of other folder objects by matching. In other words, the folder containing root_dir='a'and1st_dir='c' in the path information is a subfolder of the folder object c, and the subfolder c2 is queried.
[0153] S302 includes: determining that the corresponding folder identifier is 12 based on the metadata of the folder object c.
[0154] The operation instruction of S303 is empty.
[0155] S304 includes: using the folder identifier 12 corresponding to the metadata of the folder object c as a file query condition, expressed as pid=12, and determining the metadata of all sub-file objects of the folder object c in the file database table, that is, querying the sub-file object c1.
[0156] The operation instruction of S305 is empty.
[0157] In this way, the condition for querying sub-files and / or sub-folders in a folder is changed from string equality judgment to integer equality judgment, so that the overall query performance can be improved.
[0158] Example 4: The operation instruction is a folder recursive query operation instruction; the target object is a folder object.
[0159] In this embodiment, S301 includes:
[0160] In response to receiving that an operation instruction for a folder object is a folder recursive query operation instruction, a folder query condition corresponding to the folder recursive query operation instruction is determined, metadata of the folder object is determined in a folder database table, and metadata of all subfolders of the folder object is determined based on path information in the metadata of the folder object and path information of other folder objects.
[0161] The folder query condition includes the layer name of the folder level field of the metadata of the folder object, and in some examples, includes the layer names of multiple folder level subfields.
[0162] S302 includes: determining a corresponding folder identifier based on metadata of the folder object, and determining a folder identifier of a subfolder based on metadata of all subfolders.
[0163] The operation instruction of S303 is empty.
[0164] S304 includes: using the folder identifier corresponding to the metadata of the folder object and the folder identifier of the sub-folder as file query conditions, and determining the metadata of all sub-file objects of the folder object in the file database table.
[0165] The operation instruction of S305 is empty.
[0166] For the sake of explanation, Figure 5 , Example 4 is explained with a specific operation example. Taking the recursive query of folder object a as an example, Figure 5 The folder object a is represented by " / a", including:
[0167] S301 includes:
[0168] In response to receiving that the operation instruction for folder object a is a folder recursive query operation instruction, the folder query condition corresponding to the folder recursive query operation instruction is determined, expressed as root_dir='a', the metadata of the folder object is determined in the folder database table, and the metadata of all subfolders of the folder object are determined based on the path information in the metadata of the folder object and the path information of other folder objects. In other words, the folder whose path information contains root_dir='a' is a subfolder of folder object a, that is, subfolder b, subfolder c and subfolder c2 are queried.
[0169] S302 includes: determining the corresponding folder identifier as 10 based on the metadata of the folder object a, and determining the folder identifiers of the subfolders b, c, and c2 as 11, 12, and 13 respectively based on the metadata of all subfolders.
[0170] The operation instruction of S303 is empty.
[0171] S304 includes: using the folder identifier 10 corresponding to the metadata of folder object a and the folder identifiers 11, 12, 13 of the subfolders as file query conditions, expressed as pidin(10,11,12,13), and determining the metadata of all sub-file objects of folder object a in the file database table.
[0172] The operation instruction of S305 is empty.
[0173] In the related technology, only string prefix matching can be used for querying, while this solution uses string equality judgment for querying subfolders and integer equality judgment for querying subfiles, thus effectively improving database query performance. In particular, when there are multiple subfolders and a large number of subfiles in a subfolder, query performance is significantly improved.
[0174] Example 5: The operation instruction is a folder copy operation instruction; the target object is a folder object.
[0175] In this embodiment, S301 includes: in response to receiving an operation instruction for a folder object that is a folder copy operation instruction, determining a source folder query condition corresponding to the folder copy operation instruction, and determining metadata of the source folder object in the folder database table based on the source folder query condition.
[0176] The source folder query condition includes the layer name of the folder level field of the metadata of the source folder object, and in some examples, includes the layer names of multiple folder level subfields.
[0177] S302 includes: determining a corresponding folder identifier based on metadata of a source folder object.
[0178] S303 includes: determining metadata of the folder to be copied corresponding to the folder copy operation instruction, inserting the metadata of the folder to be copied into the folder database table, and determining a folder identifier corresponding to the metadata of the folder to be copied.
[0179] S304 includes: using the folder identifier corresponding to the metadata of the source folder object as a file query condition, and determining the metadata of all sub-file objects of the source folder object in the file database table.
[0180] S305 includes: inserting metadata of all sub-file objects found in the query into the file database table based on the folder identifier corresponding to the metadata of the folder to be copied.
[0181] For the sake of explanation, Figure 5 Example 5 is described by taking a specific operation example. Taking the example of copying the source folder object b to the to-be-copied folder object f, Figure 5 The source folder object b is represented by " / a / b". Figure 5 The folder object f to be copied is represented by " / a / f", including:
[0182] S301 includes: in response to receiving an operation instruction for folder object b which is a folder copy operation instruction, determining the source folder query condition corresponding to the folder copy operation instruction, expressed as root_dir='a'and1st_dir='b', and determining the metadata of the source folder object b in the folder database table based on the source folder query condition.
[0183] S302 includes: determining a corresponding folder identifier 11 based on metadata of the source folder object b.
[0184] S303 includes: determining the metadata of the folder to be copied f corresponding to the folder copy operation instruction, inserting the metadata of the folder to be copied f into the folder database table, expressed as {root_dir:a,1st_dir:f,id:14,…}, and determining the folder identifier 14 corresponding to the metadata of the folder to be copied f.
[0185] S304 includes: using the folder identifier 11 corresponding to the metadata of the source folder object b as a file query condition, expressed as pid=11, determining the metadata of all sub-file objects of the source folder object b in the file database table, and querying the sub-file objects b1 and b2.
[0186] S305 includes: in the file database table, based on the folder identifier 14 corresponding to the metadata of the folder f to be copied, inserting the metadata of all the queried sub-file objects, that is, adding the metadata of the sub-file object b1 and the sub-file object b2 to the file database table, and modifying the parent file identifier of the sub-file object b1 and the sub-file object b2 to 14.
[0187] Example 6: The operation instruction is a folder deletion operation instruction; the target object is a folder object.
[0188] In this embodiment, S301 includes: in response to receiving an operation instruction for a folder object which is a folder deletion operation instruction, determining a folder query condition corresponding to the folder deletion operation instruction, determining the metadata of the folder object in a folder database table, and determining the metadata of all subfolders of the folder object by matching the path information in the metadata of the folder object with the path information of other folder objects.
[0189] The folder query condition includes the layer name of the folder level field of the metadata of the folder object, and in some examples, includes the layer names of multiple folder level subfields.
[0190] S302 includes: determining a corresponding folder identifier based on metadata of the folder object, and determining a folder identifier of a subfolder based on metadata of all subfolders.
[0191] S303 includes: in the folder database table, based on the folder identifier of the metadata of the folder object, setting the status field of the metadata of the folder object to marked for deletion, and, the folder identifier of the metadata of all subfolders sets the folder status field of the metadata of all subfolders to marked for deletion.
[0192] S304 includes: using the folder identifier corresponding to the metadata of the folder object and the folder identifier of the sub-folder as file query conditions, and determining the metadata of all sub-file objects of the folder object in the file database table.
[0193] S305 includes: initiating an asynchronous task, setting the file status field of the metadata of all sub-file objects to marked for deletion based on the folder identifier corresponding to the metadata of the folder object and the folder identifier of the sub-folder in the file database table.
[0194] For the sake of explanation, Figure 5 , Example 6 is explained with a specific operation example. Take deleting folder object c as an example. Figure 5 The folder object c is represented by " / a / c", including:
[0195] S301 includes: in response to receiving an operation instruction for a folder object c which is a folder deletion operation instruction, determining a folder query condition corresponding to the folder deletion operation instruction, expressed as root_dir='a'and1st_dir='c', determining the metadata of the folder object in the folder database table, and determining the metadata of all subfolders of the folder object based on the path information in the metadata of the folder object and the path information of other folder objects by matching. In other words, the folder whose path information contains root_dir='a'and1st_dir='c' is a subfolder of the folder object c, and the subfolder c2 is queried.
[0196] S302 includes: determining a corresponding folder identifier 12 based on metadata of the folder object c, and determining a folder identifier 13 of a subfolder based on metadata of all subfolders c2.
[0197] S303 includes: in the folder database table, based on the folder identifier 12 of the metadata of the folder object c, the status field of the metadata of the folder object c is set to marked for deletion, and, the folder identifier 13 of the metadata of all subfolders c2 sets the folder status field of the metadata of all subfolders c2 to marked for deletion.
[0198] S304 includes: using the folder identifier 12 corresponding to the metadata of the folder object c and the folder identifier 13 of the subfolder c2 as file query conditions, and determining the metadata of all sub-file objects of the folder object c in the file database table.
[0199] S305 includes: initiating an asynchronous task, setting the file status field of the metadata of all sub-file objects to marked for deletion based on the folder identifier 12 corresponding to the metadata of the folder object c and the folder identifier 13 of the sub-folder c2 in the file database table.
[0200] Example 7: The operation instruction is a folder move operation instruction; the target object is a folder object.
[0201] In this embodiment, S301 includes:
[0202] In response to receiving that the operation instruction for the folder object is a folder move operation instruction, determining a folder level subfield of a target folder object corresponding to the folder move operation instruction;
[0203] Determine the folder query conditions of the folder move operation instruction, determine the metadata of the folder object in the folder database table, and determine the metadata of all subfolders of the folder object by matching the path information in the metadata of the folder object with the path information of other folder objects.
[0204] The folder query condition includes the layer name of the folder level field of the metadata of the folder object, and in some examples, includes the layer names of multiple folder level subfields.
[0205] S302 includes: determining a corresponding folder identifier based on metadata of the folder object, and determining a folder identifier of a subfolder based on metadata of all subfolders.
[0206] S303 includes, in the folder database table, based on the folder identifier corresponding to the metadata of the folder object and the folder identifier based on all subfolders, modifying the folder level subfield of the metadata of the corresponding folder object and the folder level subfield of the metadata of all subfolders to the folder level subfield of the target folder object.
[0207] In this example, S304 and S305 may be omitted.
[0208] For the sake of explanation, Figure 5 , Example 7 is explained by taking a specific operation example. Taking the example of moving the to-be-moved folder object c as a whole to the target folder object b to become the moved folder object c, in Figure 5 The folder object c to be moved is represented by " / a / c", the folder object b is represented by " / a / b", and the folder object c after being moved is represented by " / a / b / c", including:
[0209] S301 includes:
[0210] In response to receiving that the operation instruction for the folder object c to be moved is a folder move operation instruction, it is determined that the folder move operation instruction corresponds to the folder level subfield of the target folder object b, and it is queried that the folder level subfield of the target folder object b includes root_dir:a and 1st_dir:b.
[0211] Determine the folder query conditions for the folder move operation instruction, expressed as root_dir='a'and1st_dir='c', determine the metadata of the folder object c to be moved in the folder database table, and match the path information in the metadata of the folder object with the path information of other folder objects to determine the metadata of all subfolders of the folder object, and query the subfolder c2.
[0212] S302 includes: determining a corresponding folder identifier 12 based on metadata of the folder object c, and determining a folder identifier 13 of a subfolder based on metadata of all subfolders c2.
[0213] S303 includes: in the folder database table, based on the folder identifier 12 corresponding to the metadata of the folder object c and the folder identifier 13 based on all subfolders c2, the folder level subfield of the metadata of the corresponding folder object c and the folder level subfield of the metadata of all subfolders c2 are modified to the folder level subfield of the target folder object b.
[0214] In this way, when moving a folder, you only need to change the value of the folder level subfield corresponding to the folder object, and the metadata of all sub-file objects does not need to be changed, thereby improving update efficiency.
[0215] In the third embodiment disclosed, based on Figure 1 The same principle, Fig.10 A metadata storage device 100 provided in the third embodiment of the present disclosure is shown, and the device includes:
[0216] A determination module 1001 is used to determine the object type of any target object based on metadata of the target object;
[0217] The first allocation module 1002 is used to allocate a folder identifier to the folder object when the target object is a folder object;
[0218] The first storage module 1003 is used to store metadata of the folder object into a folder database table based on the folder identifier;
[0219] The second determination module 1004 is used to determine the folder identifier of the folder object to which the file object belongs when the target object is a file object, and use the folder identifier as the parent folder identifier of the file object itself;
[0220] The second storage module 1005 is used to store the metadata of the file object into the file database table based on the parent folder identifier.
[0221] In some examples, the first storage module is specifically used to:
[0222] Adopting a flat organization method, the path information of the folder object is constructed based on the folder identifier of the folder object, and the path information is stored in the metadata of the folder object;
[0223] Stores metadata of folder objects in folder database tables.
[0224] In some examples, the path information includes at least: a folder level field and its level name;
[0225] The first storage module is specifically used to construct path information of the folder object based on the folder identifier of the folder object in a flat organization manner and store the path information in metadata of the folder object.
[0226] Determine the folder level field of the folder object, and determine the level name corresponding to the folder level field;
[0227] Path information is generated according to the folder level field, the layer name corresponding to the folder level field, and the folder identifier, and the path information is stored in the metadata of the folder object.
[0228] In some examples, the folder level field includes a plurality of folder level subfields sorted according to the subordination relationship of the folders;
[0229] The first storage module is specifically used to determine the folder level field of the folder object and determine the layer name corresponding to the folder level field:
[0230] Determine the folder level subfields contained in the folder level field of the folder object;
[0231] Determine the level name of each folder level subfield contained in the folder level field;
[0232] Each folder level subfield includes: a plurality of folder level subfields corresponding to the parent folder to which the folder object belongs, which are sorted according to the subordinate relationship of the folders, and a folder level subfield corresponding to the folder object itself.
[0233] In some examples, the second storage module is specifically used for:
[0234] A tree-like organization method is adopted to construct the representation information of the file object based on the parent folder identifier, and the representation information is stored in the metadata of the file object;
[0235] Stores metadata of file objects in file database tables.
[0236] In some examples, the second storage module adopts a tree-like organization method, constructs the representation information of the file object based on the parent folder identifier, and stores the representation information in the metadata of the file object, specifically for:
[0237] Assign a file identifier to the file object;
[0238] Determine the file name of the file object;
[0239] Representation information is generated according to the file identifier, file name, and parent folder identifier of the file object, and the representation information is stored in metadata of the file object.
[0240] In some examples, the data type of the folder identifier is an integer, and / or the data type of the parent folder identifier is an integer.
[0241] In the fourth embodiment disclosed, based on Figure 8 The same principle, Fig.11 A metadata operation device 110 for a target object provided by a fourth embodiment of the present disclosure is shown. The metadata of the target object is stored according to the metadata storage method described above.
[0242] The device comprises:
[0243] The first query module 1101 is used to determine the folder query condition corresponding to the operation instruction in response to receiving the operation instruction for the target object, and determine the metadata of the folder object in the folder database table;
[0244] The first execution module 1102 is used to execute an operation instruction according to metadata of a folder object.
[0245] In some examples, the first query module is further used to: determine a corresponding target folder identifier based on metadata of the folder object;
[0246] The device also includes:
[0247] A second query module, used to determine metadata of the file object in the file database table based on the target folder identifier as a file query condition;
[0248] The second execution module is used to execute the operation instruction according to the metadata of the file object.
[0249] In the technical solution disclosed herein, the acquisition, storage and application of user personal information involved are in compliance with the provisions of relevant laws and regulations and do not violate public order and good morals.
[0250] According to an embodiment of the present disclosure, the present disclosure also provides an electronic device, a readable storage medium and a computer program product.
[0251] Fig.12 A schematic block diagram of an example electronic device 1200 that can be used to implement an embodiment of the present disclosure is shown. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device can also represent various forms of mobile devices, such as personal digital processing, cellular phones, smart phones, wearable devices, and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely examples and are not intended to limit the implementation of the present disclosure described and / or required herein.
[0252] like Fig.12 As shown, the device 1200 includes a computing unit 1201, which can perform various appropriate actions and processes according to a computer program stored in a read-only memory (ROM) 1202 or a computer program loaded from a storage unit 1208 into a random access memory (RAM) 1203. In the RAM 1203, various programs and data required for the operation of the device 1200 can also be stored. The computing unit 1201, the ROM 1202, and the RAM 1203 are connected to each other via a bus 1204. An input / output (I / O) interface 1205 is also connected to the bus 1204.
[0253] A number of components in the device 1200 are connected to the I / O interface 1205, including: an input unit 1206, such as a keyboard, a mouse, etc.; an output unit 1207, such as various types of displays, speakers, etc.; a storage unit 1208, such as a disk, an optical disk, etc.; and a communication unit 1209, such as a network card, a modem, a wireless communication transceiver, etc. The communication unit 1209 allows the device 1200 to exchange information / data with other devices through a computer network such as the Internet and / or various telecommunication networks.
[0254] The computing unit 1201 may be a variety of general and / or special processing components with processing and computing capabilities. Some examples of the computing unit 1201 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various dedicated artificial intelligence (AI) computing chips, various computing units running machine learning model algorithms, digital signal processors (DSPs), and any appropriate processors, controllers, microcontrollers, etc. The computing unit 1201 performs the various methods and processes described above, such as the storage method of metadata. For example, in some embodiments, the network attack processing method may be implemented as a computer software program, which is tangibly included in a machine-readable medium, such as a storage unit 1208. In some embodiments, part or all of the computer program may be loaded and / or installed on the device 1200 via the ROM 1202 and / or the communication unit 1209. When the computer program is loaded into the RAM 1203 and executed by the computing unit 1201, one or more steps of the storage method of metadata described above may be performed. Alternatively, in other embodiments, the computing unit 1201 may be configured as a metadata storage method in any other appropriate manner (eg, by means of firmware).
[0255] Various implementations of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), systems on chips (SOCs), load programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various implementations can include: being implemented in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which can be a special purpose or general purpose programmable processor that can receive data and instructions from a storage system, at least one input device, and at least one output device, and transmit data and instructions to the storage system, the at least one input device, and the at least one output device.
[0256] The program code for implementing the method 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, a special-purpose computer, or other programmable data processing device, so that the program code, when executed by the processor or controller, enables the functions / operations specified in the flow chart and / or block diagram to be implemented. The program code may be executed entirely on the machine, partially on the machine, partially on the machine and partially on a remote machine as a stand-alone software package, or entirely on a remote machine or server.
[0257] In the context of the present disclosure, a machine-readable medium may be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, device, or equipment. A 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, device, or equipment, or any suitable combination of the foregoing. A more specific example of a machine-readable storage medium may include an electrical connection based on one or more lines, a portable computer disk, 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 portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
[0258] To provide interaction with a user, the systems and techniques described herein 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 pointing device (e.g., a mouse or trackball) through which the user can provide input to the computer. Other types of devices can also be used to provide interaction with the user; for example, the 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 input, voice input, or tactile input).
[0259] The systems and techniques described herein may be implemented in a computing system that includes back-end components (e.g., as a data server), or a computing system that includes middleware components (e.g., an application server), or a computing system that includes front-end components (e.g., a user computer with a graphical user interface or a web browser through which a user can interact with implementations of the systems and techniques described herein), or a computing system that includes any combination of such back-end components, middleware components, or front-end components. The components of the system may 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.
[0260] A computer system may include a client and a server. The client and the server are generally remote from each other and usually interact through a communication network. The relationship of client and server is generated by computer programs running on respective computers and having a client-server relationship with each other. The server may be a cloud server, a server of a distributed system, or a server combined with a blockchain.
[0261] It should be understood that the various forms of processes shown above can be used to reorder, add or delete steps. For example, the steps recorded in this disclosure can be executed in parallel, sequentially or in different orders, as long as the desired results of the technical solutions disclosed in this disclosure can be achieved, and this document does not limit this.
[0262] The above specific implementations do not constitute a limitation on the protection scope of the present disclosure. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions can be made according to design requirements and other factors. Any modification, equivalent substitution and improvement made within the spirit and principle of the present disclosure shall be included in the protection scope of the present disclosure.
Claims
1. A method for storing metadata, wherein: The method comprises: For metadata of any target object, determine the object type of the target object; In the case where the target object is a folder object, assigning a folder identifier to the folder object; Based on the folder identifier, storing metadata of the folder object in a folder database table; In the case where the target object is a file object, determining the folder identifier of the folder object to which the file object belongs, and using the folder identifier as the parent folder identifier of the file object itself; Based on the parent folder identifier, the metadata of the file object is stored in a file database table.
2. The method according to claim 1, wherein: In the case where the target object is a folder object, storing the metadata of the folder object in a folder database table based on the folder identifier includes: Adopting a flat organization method, constructing path information of the folder object based on the folder identifier of the folder object, and storing the path information in metadata of the folder object; The metadata of the folder object is stored in a folder database table.
3. The method according to claim 2, wherein: The path information at least includes: a folder level field and its level name; The adopting the flat organization method, constructing the path information of the folder object based on the folder identifier of the folder object, and storing the path information in the metadata of the folder object includes: Determine a folder level field of the folder object, and determine a layer name corresponding to the folder level field; The path information is generated according to the folder level field, the layer name corresponding to the folder level field and the folder identifier, and the path information is stored in the metadata of the folder object.
4. The method according to claim 3, wherein: The folder level field includes a plurality of folder level subfields sorted according to the subordinate relationship of the folders; The step of determining the folder level field of the folder object and determining the level name corresponding to the folder level field includes: Determine each folder level subfield contained in the folder level field of the folder object; Determine the layer name of each folder level subfield contained in the folder level field; The various folder level subfields include: a plurality of folder level subfields corresponding to the parent folder to which the folder object belongs, which are sorted according to the subordinate relationship of the folders, and a folder level subfield corresponding to the folder object itself.
5. The method according to any one of claims 1 to 4, wherein: In the case where the target object is a file object, storing the metadata of the file object in a file database table based on the parent folder identifier includes: Adopting a tree-like organization method, constructing the representation information of the file object based on the parent folder identifier, and storing the representation information in the metadata of the file object; The metadata of the file object is stored in a file database table.
6. The method according to any one of claim 5, wherein: The method of adopting a tree-like organization method to construct the representation information of the file object based on the parent folder identifier, and storing the representation information in the metadata of the file object includes: Assigning a file identifier to the file object; Determine the file name of the file object; The representation information is generated according to the file identifier, the file name and the parent folder identifier of the file object, and the representation information is stored in the metadata of the file object.
7. The method according to any one of claims 1 to 6, wherein: The data type of the folder identifier is an integer, and / or the data type of the parent folder identifier is an integer.
8. A method for operating metadata of a target object, wherein: The metadata of the target object is stored according to any one of the methods of claims 1-7.
9. The method according to claim 8, wherein: The method comprises: In response to receiving an operation instruction for a target object, determining a folder query condition corresponding to the operation instruction, and determining metadata of the folder object in a folder database table; The operation instruction is executed according to the metadata of the folder object.
10. The method according to claim 9, wherein: In response to receiving an operation instruction for a target object, after determining a folder query condition corresponding to the operation instruction, after determining metadata of the folder object in a folder database table, and before executing the operation instruction according to the metadata of the folder object, the method further includes: Determine a corresponding target folder identifier based on the metadata of the folder object; After executing the operation instruction according to the metadata of the folder object, the method further includes: Based on the target folder identifier as a file query condition, determining metadata of the file object in the file database table; The operation instruction is executed according to the metadata of the file object.
11. A metadata storage device, wherein: The device comprises: A first determination module, configured to determine the object type of any target object based on the metadata of the target object; A first allocation module, configured to allocate a folder identifier to the folder object when the target object is a folder object; A first storage module, configured to store metadata of the folder object into a folder database table based on the folder identifier; A second determination module is used to determine the folder identifier of the folder object to which the target object belongs when the target object is a file object, and use the folder identifier as the parent folder identifier of the file object itself; The second storage module is used to store the metadata of the file object into a file database table based on the parent folder identifier.
12. The device according to claim 11, wherein: The first storage module is specifically used for: Adopting a flat organization method, constructing path information of the folder object based on the folder identifier of the folder object, and storing the path information in metadata of the folder object; The metadata of the folder object is stored in a folder database table.
13. The device according to claim 12, wherein: The path information at least includes: a folder level field and its level name; When the first storage module adopts a flat organization mode, constructs the path information of the folder object based on the folder identifier of the folder object, and stores the path information in the metadata of the folder object, specifically used for: Determine a folder level field of the folder object, and determine a layer name corresponding to the folder level field; The path information is generated according to the folder level field, the layer name corresponding to the folder level field and the folder identifier, and the path information is stored in the metadata of the folder object.
14. The device according to claim 13, wherein: The folder level field includes a plurality of folder level subfields sorted according to the subordinate relationship of the folders; The first storage module is specifically used to: determine the folder level field of the folder object and determine the layer name corresponding to the folder level field; Determine each folder level subfield contained in the folder level field of the folder object; Determine the layer name of each folder level subfield contained in the folder level field; The various folder level subfields include: a plurality of folder level subfields corresponding to the parent folder to which the folder object belongs, which are sorted according to the subordinate relationship of the folders, and a folder level subfield corresponding to the folder object itself.
15. The device according to any one of claims 11 to 14, wherein: The second storage module is specifically used for: Adopting a tree-like organization method, constructing the representation information of the file object based on the parent folder identifier, and storing the representation information in the metadata of the file object; The metadata of the file object is stored in a file database table.
16. The device according to any one of claims 15, wherein: The second storage module adopts a tree-like organization method, constructs the representation information of the file object based on the parent folder identifier, and stores the representation information in the metadata of the file object, specifically for: Assigning a file identifier to the file object; Determine the file name of the file object; The representation information is generated according to the file identifier, the file name and the parent folder identifier of the file object, and the representation information is stored in the metadata of the file object.
17. The device according to any one of claims 11-16, wherein the data type of the folder identifier is an integer, and / or the data type of the parent folder identifier is an integer.
18. A device for operating metadata of a target object, wherein: The metadata of the target object is stored according to any one of the methods of claims 1-7.
19. The device according to claim 18, wherein: The device comprises: A first query module, configured to, in response to receiving an operation instruction for a target object, determine a folder query condition corresponding to the operation instruction, and determine metadata of the folder object in a folder database table; The first execution module is used to execute the operation instruction according to the metadata of the folder object.
20. The device according to claim 19, wherein The first query module is also used to: determine the corresponding target folder identifier based on the metadata of the folder object; The device also includes: A second query module, configured to determine metadata of a file object in the file database table based on the target folder identifier as a file query condition; The second execution module is used to execute the operation instruction according to the metadata of the file object.
21. 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 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 execute the method of any one of claims 1-7 and / or to execute the method of any one of claims 8-10.
22. A non-transitory computer-readable storage medium storing computer instructions, wherein: The computer instructions are used to cause the computer to execute the method according to any one of claims 1-7, and / or to execute the method according to any one of claims 8-10.
23. A computer program product, comprising a computer program, which, when executed by a processor, implements the method according to any one of claims 1 to 7 and / or the method according to any one of claims 8 to 10.
Citation Information
Patent Citations
Metadata structure and operation, positioning and segmentation methods based on metadata structure
CN106844584A
Decoupling distribution method for metadata of distributed file system
CN106874383A
Metadata query method and device based on distributed file system and storage medium
CN114116613A
Metadata processing method and device, equipment and medium
CN115481096A
Method and system for managing data associated with a hierarchical structure
US20170270138A1
Cited By
Commodity information processing method, commodity information query method and device
CN119557487A
