CN101315640B - Directory management method and apparatus - Google Patents

Directory management method and apparatus Download PDF

Info

Publication number
CN101315640B
CN101315640B CN2008101268591A CN200810126859A CN101315640B CN 101315640 B CN101315640 B CN 101315640B CN 2008101268591 A CN2008101268591 A CN 2008101268591A CN 200810126859 A CN200810126859 A CN 200810126859A CN 101315640 B CN101315640 B CN 101315640B
Authority
CN
China
Prior art keywords
file
catalogue
binary tree
balanced binary
node
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.)
Expired - Fee Related
Application number
CN2008101268591A
Other languages
Chinese (zh)
Other versions
CN101315640A (en
Inventor
王瑞丰
朱红军
杜守富
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
ZTE Corp
Original Assignee
ZTE Corp
Priority date (The priority date 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 date listed.)
Filing date
Publication date
Application filed by ZTE Corp filed Critical ZTE Corp
Priority to CN2008101268591A priority Critical patent/CN101315640B/en
Publication of CN101315640A publication Critical patent/CN101315640A/en
Application granted granted Critical
Publication of CN101315640B publication Critical patent/CN101315640B/en
Expired - Fee Related legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Abstract

The invention discloses a catalog management method which establishes a catalog or a file on a client and inputs the full path name of the catalog or the file. The method comprises the steps that: analysis to the full path name is carried out, the short name of the catalog or the file represented by the full path name is obtained; an idle node is distributed to the catalog or the file represented by the short name according to the short name; whether the catalog or the file in the same level with the catalog or the file represented by the short name exists or not is judged; if not, the idle node generates a balanced binary tree independently; if so, the idle node is inserted into the balanced binary tree generated by the catalog or the file in the same level; balance operation is carried out to all the balanced binary trees according to a balance rule to generate a multilevel balanced binary tree; and management to the catalog is carried out according to the generated multilevel balanced binary tree. The invention also discloses a catalog management device, and on the basis of the method and the device, the memory space of a system can be saved and searching efficiency of the catalog or the file can be improved.

Description

A kind of catalog management method and device
Technical field
The present invention relates to the directory management technology, be meant a kind of method and apparatus of the directory management in distributed file system especially.
Background technology
Along with the rapid increase of fast development of computer technology and communication information amount, distributed file system is applied to the storage of field of data storage, particularly mass data more and more.Distributed file system generally is made up of a meta data server, a plurality of storage server and a plurality of client, and wherein, storage server provides the throughput of the data storage and the magnanimity of magnanimity; Meta data server provides the storage space of All Files title in the system to the user, each file and catalogue all have a unification and unique title in distributed file system, on all servers, the user can use identical title to visit corresponding catalogue or file by client, and does not need to be concerned about the actual storage locations of catalogue or file and the position of storing the meta data server of respective directories or file.
The directory stores of whole distributed file system at present, has following several for the management method of catalogue in meta data server:
1, the complete trails title of storage directory, file, Hash (Hash) algorithm is adopted in retrieval to file name.This method is because the essence of filename is a character string, and the complete trails title of file is removed outside the unique identification title of this document, first half represents that the title of its store path probability identical with the title of the first half of alternative document is very big, cause hash algorithm realization difficulty very like this, particularly be difficult to avoid the Hash conflict, after producing a large amount of conflicts, can cause access efficiency seriously to reduce.And, because storage is the complete trails title of file, so, can cause the serious waste of memory headroom, and make catalogue, file name have redundant situation.
2, the complete trails title of storage directory, file adopts single balanced binary tree management to file name.The speed of this method retrieving files is very fast, and still, the storage of complete trails title causes the waste of storage space very serious; And along with increasing of file, this binary tree can be more and more huger, so, will cause the balance work expense behind each increase, the deleted file to increase, thereby reduce the access efficiency of file system.
Summary of the invention
In view of this, fundamental purpose of the present invention is to provide a kind of catalog management method and device, can improve the recall precision to catalogue, file, avoids because the waste of the storage space that the complete trails title of storage directory, file is caused.
For achieving the above object, technical scheme of the present invention is achieved in that
The invention discloses a kind of catalog management method, create directory or file in client, and the complete trails title of input directory or file, described complete trails title is sent to meta data server, this method comprises:
Described complete trails title is analyzed, obtained the catalogue that described complete trails title represents or the short name of file;
According to described short name, catalogue or the file allocation idle node represented for described short name;
Whether the catalogue that judgement and described short name are represented or the catalogue at the same level or the file of file exist, and if there is no, then described idle node generates balanced binary tree separately; If exist, then described idle node is inserted in the balanced binary tree that the node of described catalogue at the same level or file generates;
According to the balance rule all balanced binary trees are carried out balancing run, generate multistage balanced binary tree; And the multistage balanced binary tree of the described generation of foundation manages catalogue.
Described short name is called the unique identification title of described catalogue or file.
Described idle node is made up of filename FileName, subtree pSubTree, left subtree pLeftTree and right subtree pRighftTree, and wherein, the thresholding of FileName is according to described short name value;
When described idle node was represented catalogue, pSubTree pointed to the root node of balanced binary tree at the next stage catalogue place of described catalogue, and the subtree of the balanced binary tree at described catalogue place is the balanced binary tree at described next stage catalogue place;
When described idle node was represented file, pSubTree was empty NULL.
Described balance rule is: according to the size of FileName, pLeftTreep in the described balanced binary tree and RighftTree thresholding, to FileName, pLeftTreep and RighftTree assignment again.
The multistage balanced binary tree of described foundation manages the catalogue of whole file system, comprising: any one in traversal catalogue, locating file, increase file, deleted file, revised file title, the move or multiple combination arbitrarily.
The invention also discloses a kind of directory management device, this device comprises:
Analysis module is used for the complete trails title is analyzed, and obtains the catalogue that described complete trails title represents or the short name of file;
The node distribution module is used for according to described short name, catalogue or the file allocation idle node represented for described short name;
Judge module is used to judge whether the catalogue represented with described short name or the catalogue or the file of file peer exist, and obtain judged result;
The balanced binary tree generation module is used for generating balanced binary tree according to judged result separately by described idle node, is perhaps inserted in the balanced binary tree that the node of the catalogue of described peer or file generates by described idle node;
Multistage balanced binary tree constructing module is used for according to the balance rule all balanced binary trees being carried out balancing run, generates multistage balanced binary tree.
This device also comprises administration module, be used for the catalogue of whole file system being carried out operational administrative according to described multistage balanced binary tree, described operational administrative is any one or multiple combination arbitrarily in traversal catalogue, locating file, increase file, deleted file, revised file title, the move.
Described idle node is made up of FileName, pSubTree, pLeftTree and pRighftTree, and wherein, the thresholding of FileName is according to described short name value.
Described balance rule is: according to the size of FileName, pLeftTreep in the described balanced binary tree and RighftTree thresholding, to FileName, pLeftTreep and RighftTree assignment again.
Catalog management method of the present invention and device have adopted multistage balanced binary tree technology, and according to the foundation of file on the client, the multistage balanced binary tree of the bibliographic structure of expression file system is set up thereupon in meta data server.Because what the catalogue that the present invention stores in multistage balanced binary tree or the title of file were used is short name, it is the unique identification title of catalogue or file, like this, save the memory headroom of meta data server greatly, helped storing more catalogue or file name.
The use of multistage balanced binary tree among the present invention, the catalogue at the same level or the node of file are present in the subtree of multistage balanced binary tree, so when carrying out balancing run, only need the subtree of balance correspondence, can simplify balancing run like this, and shorten the time of balancing run.
In addition, the present invention adopts multistage balanced binary tree administrative directory, and each catalogue or file only preserve short name, can improve the search efficiency of whole catalogue like this, and can be easily to the various bookkeepings of catalogue.
Description of drawings
Fig. 1 is the idiographic flow synoptic diagram of catalog management method of the present invention;
Fig. 2 is the exemplary plot of the balanced binary tree that is generated by node of catalog management method of the present invention;
Fig. 3 creates the example of multistage balanced binary tree for the present invention;
Fig. 4 is the structural relation synoptic diagram of directory management device of the present invention.
Embodiment
The technical solution of the present invention is further elaborated below in conjunction with the drawings and specific embodiments.
In distributed file system, the present invention is according to the short name of catalogue or file, create the multistage balanced binary tree of the bibliographic structure of the whole file system of expression, in multistage balanced binary tree, catalogue at the same level or file generate a balanced binary tree, the balanced binary tree that is generated is the subtree of balanced binary tree at the parent directory place of described catalogue at the same level or file, and the subtree pSubTree of the root node of parent directory place balanced binary tree points to the root node of the subtree of the balanced binary tree that generates, according to the TOC level membership, utilize the pSubTree territory of node that each balanced binary tree is associated, thereby generate multistage balanced binary tree.
In the whole distributed file system, file that all are at the same level and catalogue can generate a balanced binary tree, in distributed file system, there is the rank of what catalogues or file to divide, in meta data server, just include what corresponding balanced binary trees, these balanced binary trees have formed a multistage balanced binary tree, and this multistage balanced binary tree is just represented the bibliographic structure of whole distributed file system.
Figure 1 shows that the idiographic flow synoptic diagram of catalog management method of the present invention.
Step 101 is analyzed the complete trails title of client input, obtains the catalogue that this complete trails title represents or the short name of file.
In distributed file system, the user is by the complete trails title of client input directory or file, meta data server is in the process of creating multistage balanced binary tree, the complete trails title is analyzed, from the complete trails title, extract the short name of catalogue or file, this short name is the unique identification title of catalogue or file, when creating this catalogue or file, only needs the short name of in the node of correspondence storage directory or file to get final product.
Step 102 according to the short name of catalogue or file, is given catalogue or idle node of file allocation.
In multistage balanced binary tree, create directory or during file, at first give this catalogue or idle node of file allocation, the filename of current directory or file is inserted its corresponding position in multistage balanced binary tree by this node.
Among the present invention, an idle node is made up of filename FileName, subtree pSubTree, left subtree pLeftTree and right subtree pRighftTree, and the embodiment that is formed in the back of concrete idle node describes.
Step 103, whether the catalogue that judgement and short name are represented or the catalogue or the file of file peer exist, if there is no, execution in step 104; If there is execution in step 105.
In the present invention, the implementation feature of multistage balanced binary tree is: all at the same level catalogues or file generate a balanced binary tree, and the root node of this balanced binary tree is all pointed in the pSubTree territory of root node that generates the parent directory of the catalogue of this balanced binary tree or file.
Creating a directory or during file, to judge earlier whether catalogue or file with this catalogue or file peer exist, from needs create directory or the complete trails title of file can know the parent directory of this catalogue or file, whether the thresholding of pSubTree of root node of searching the balanced binary tree at parent directory place is sky NULL, if be empty, then explanation catalogue or file at the same level do not exist; If be not empty, then explanation catalogue or file at the same level exists.
Step 104, the idle node of this catalogue or file generate a new balanced binary tree separately;
Here, the root node of this balanced binary tree is pointed in the pSubTree territory of the root node of the balanced binary tree at the parent directory place of this catalogue or file; If this catalogue is the root directory of multistage balanced binary tree, for a balanced binary tree, there is and has only a root directory, then root directory generates a balanced binary tree separately, this balanced binary tree becomes the name inlet of whole file system, and this balanced binary tree becomes the inlet subtree of multistage balanced binary tree.
Step 105 is with idle node and catalogue at the same level or balanced binary tree of node generation of file of catalogue or file.
According to the implementation feature of above-mentioned multistage balanced binary tree, the idle node of the catalogue newly created or file is inserted in catalogue at the same level with it or the balanced binary tree that file generated.
Step 106 is carried out balancing run according to the balance rule to all balanced binary trees, generates multistage balanced binary tree.
When creating a new catalogue or file, all to carry out balancing run to the most basic balanced binary tree at its place.The structure of an idle node is exactly a balanced binary tree the most basic, so-called balancing run is carried out according to the balance rule, specifically: the size of the thresholding of FileName, the pLeftTree of a balanced binary tree the most basic and pRighftTree is compared, then, again FileName, pLeftTree and pRighftTree are carried out assignment according to the size of these three thresholdings.After carrying out balancing run, a balanced binary tree the most basic is just created and has been finished.
Along with the establishment of file on client finishes, a plurality of balanced binary trees that in meta data server, just exist a plurality of other catalogues of level or file to generate, these binary trees constitute a multistage balanced binary tree.
Step 107 is carried out operational administrative according to multistage balanced binary tree to the catalogue of whole file system.
Here, described operational administrative can be any one or several combination arbitrarily in traversal catalogue, locating file, increase file, deleted file, revised file title, the move operation.
For catalog management method, step 107 is optional.
Multistage balanced binary tree according to creating can manage the catalogue of whole file system.
To illustrate by specific embodiment below, create the process of multistage balanced binary tree according to catalog management method of the present invention.
Create a directory or will distribute in multistage balanced binary tree and this catalogue or the corresponding node of file during file, this node can become a balanced binary tree individually.Fig. 2 is the exemplary plot of the balanced binary tree of a node generation, as shown in Figure 2, the data structure member of this node comprises: FileName 01, pSubTree02, pLeftTree 03 and pRighftTree 04, table 1 understand node data structure member's implication specifically.
Data structure member The member describes
FileName File name, such as: log.txt, exam.txt, movie.mpg ,/etc.
Data structure member The member describes
pSubTree If this node is a catalogue, if represent that then this node of root node of the balanced binary tree that the next stage catalogue of this catalogue is generated is a file, then be empty, NULL
pLeftTree Left subtree
pRightTree Right subtree
Table 1
Among the present invention, catalogue that left subtree pSubTree and right subtree pRightTree represent or file are the catalogue represented with file name FileName or file peer, and catalogue that subtree pSubTree is represented or file are the represented catalogue of FileName, pSubTree and pRightTree or the next stage of file.
In multistage balanced binary tree, at the same level all catalogues or file can generate a balanced binary tree, and the root node of this balanced binary tree is pointed in the pSubTree territory of root node that generates the parent directory of the catalogue of this balanced binary tree or file.
Below in conjunction with Fig. 2 and Fig. 3,, the specific implementation of technical solution of the present invention is described to create file "/home/movie.mpg " step by step and file "/exam.txt " is an example.
Figure 3 shows that the present invention creates the example of multistage balanced binary tree.At the beginning of system's operation, the node of all balanced binary trees all is idle.Along with the establishment of file on client, the multistage balanced binary tree in the meta data server begins to create thereupon.
At the beginning of beginning to create file, to create a root directory "/" earlier, root directory has and has only one in multistage balanced binary tree, so root directory independently generates a balanced binary tree, this balanced binary tree just becomes the NameSpace inlet of total system file, is called as the inlet subtree of multistage balanced binary tree.Particularly, create root directory "/", this moment, all nodes of balanced binary tree were the free time, distribute an idle node 10 from section start, its content is FileName="/", pSubTree=NULL, pLeftTree=NULL, pRightTree=NULL, then the balanced binary tree at node 10 places is exactly the inlet subtree of multistage balanced binary tree.
Create the subprime directory "/home " of root directory, distribute an idle node 11, its content is FileName=" home " so, pSubTree=NULL, pLeftTree=NULL, pRightTree=NULL.Can obtain by the title of catalogue "/home ", the parent directory of this catalogue is a root directory "/", at this moment, because also there is not subtree in the balanced binary tree at root directory place, so there be not the file at the same level with " home ", so, the temporary transient independent balanced binary tree that generates of catalogue "/home ", then the balanced binary tree at node 11 places is subtrees of the balanced binary tree at node 10 places.Because that node 11 expression is catalogue "/home ", so, the pSubTree of node 11 need be pointed to the root node of the balanced binary tree that the next stage catalogue of catalogue "/home " generated this moment, as shown in Figure 3, this node is 12.
Create file "/exam.txt ", filename by this document can be learnt, the parent directory of file " exam.txt " is a root directory "/", and the pSubTree of the root node 10 of the balanced binary tree of root directory has pointed to node 11, this explanation exists catalogue or the file at the same level with file "/exam.txt ", i.e. catalogue "/home ".So, find the balanced binary tree at node 11 places, it is the balanced binary tree at catalogue "/home " place, distribute the node of a free time to be used for representing file "/exam.txt ", content is FileName=" exam.txt ", pSubTree=NULL, pLeftTree=NULL, pRightTree=NULL is inserted into this node in the balanced binary tree at catalogue "/home " place, still is in the right subtree for the left subtree that this node is inserted into balanced binary tree, not special regulation, so for present embodiment, this node both can be 14 can be 15 also, be that node 14 is an example with "/exam.txt " in the present embodiment.
Then, according to the balance rule, balanced binary tree to file "/exam.txt " and catalogue "/home " place carries out balancing run, particularly, can formulate the balance rule like this: for a balanced binary tree the simplest, the thresholding of the FileName that it is current, pLeftTree and pRightTree compares, relatively assignment is carried out again to FileName, pLeftTree and pRightTree in the back, three's thresholding magnitude relationship is after the assignment, pLeftTree<FileName<pRightTree.Compare FileName, the method of the thresholding of pLeftTree and pRightTree is: the essence of its thresholding is made of a character string, each character all has a correspondence and unique ASCII character in computing machine, as: the ASCII character of A is 65, the ASCII character of B is 66, the ASCII character of a is 97, the ASCII character of b is 98, the size order of these four characters is so: b<a<B<A, order according to the character that thresholding comprised compares, the ASCII character that compares first character earlier, if the ASCII character of first character equates, so relatively the ASCII character of second character is till comparing size, and the rule of balancing run is not limited only to this certainly.
In the present embodiment, suppose earlier the node of file "/exam.txt " to be inserted the right subtree of catalogue "/home " place balanced binary tree, promptly, give pRightTree15 with " exam.txt " assignment, next, the size of the thresholding " home " of comparison FileName 11 and the thresholding " exam.txt " of pRightTree 15, the ASCII character of h is 104, and the ASCII character of e is 101, i.e. e<h, exam.txt<home then, according to after the assignment again, the principle of pLeftTree<FileName<pRightTree is because the thresholding of FileName 11 is " home ", pLeftTree14 is NULL, and " exam.txt " should assignment give pLeftTree 14 so.
Create file "/log.txt ", the same file of the process of its establishment "/exam.txt " repeats no more herein.Distribute idle node 15 to be used for representing file "/log.txt ", content is FileName=" log.txt ", pSubTree=NULL, pLeftTree=NULL, pRightTree=NULL is inserted in the balanced binary tree of catalogue "/home " and file "/exam.txt " generation.According to the balance rule, this balanced binary tree is carried out balancing run, because through comparing exam.txt<home<log.txt, " log.txt " should assignment gives the pRightTree 15 of this balanced binary tree so, " home " should assignment gives the pRightTree11 of this balanced binary tree, and " exam.txt " should assignment gives the pRightTree 14 of this balanced binary tree.Because node 14 "/exam.txt " and node 15 " log.txt " are file, so both pSubTree 16 and 17 are empty NULL, promptly do not exist.
Suppose, replace the file "/log.txt " of current establishment with file "/a.exe ", distribute an idle node 15 for so "/a.exe ", after being inserted in the balanced binary tree that catalogue "/home " and file "/exam.txt " generate, through comparing, obtain a.exe<exam.txt<home, the thresholding of this balanced binary tree pLeftTree14, FileName 11 and pRightTree 15 is again after the assignment so, be pLeftTree=a.exe, FileName=exam.txt, pRightTree=home.
Create file "/home/movie.mpg ", filename by this document can be learnt, the parent directory of this document is "/home ", because the pSubTree territory of the root node 11 of the balanced binary tree at "/home " place does not also exist, so need to distribute idle node 12, newly set up a balanced binary tree, then this balanced binary tree is the subtree of the balanced binary tree at node 11 places.Node 12 is the root node of this balanced binary tree, the content of this node is FileName=" movie.mpg ", pSubTree=NULL, pLeftTree=NULL, pRightTree=NULL, because "/home/movie.mpg " is a file, so the pSubTree 13 of node 12 is NULL.
From present embodiment as can be seen, node 11,14,15 represented catalogue or files all are the next stage of root directory "/", be that this three is at the same level, so the catalogue of these three peers or file constitute a balanced binary tree, and the catalogue that node 11,14,15 is represented or the parent directory of file, the pSubTree of root node 10 that is the binary tree at root directory "/" place is the root nodes 11 that point to balanced binary tree that node 11,14,15 generates, and promptly the balanced binary tree at node 11 places is subtrees of the balanced binary tree at node 10 places.
To illustrate by several embodiment below, the catalogue of whole file system be managed the specific implementation process of operation based on the multistage balanced binary tree of the present invention.
Operation one: ff operation.
The ff operation may further comprise the steps:
Step 11, analysis user reads out first title by the file complete trails title of client input from the complete trails title.As: in "/A/b/123.exe " first "/";
Step 12~13, the pairing node of title that obtains from the inlet subtree search step 11 of multistage balanced binary tree is if step 12 is searched less than node corresponding, then make mistakes, finish current treatment scheme, if step 12 finds node corresponding, then execution in step 14;
Step 14 continues to read next title from the complete trails title, as " A " in "/A/b/123.exe ";
Step 15, the node of the title correspondence of continuation finding step 14 from the subtree of the node place balanced binary tree correspondence that step 12 obtains;
Step 16 if step 15 can not find respective nodes, is then made mistakes; If do not make mistakes, then continue to analyze the complete trails title, finish up to analysis;
Step 17 is returned the node that obtains at last.
Operation two: increase file operation.
Increasing file operation may further comprise the steps:
Step 21 utilizes the ff operation to search the node of the file correspondence that needs increase;
Step 22 if can find, is then made mistakes, and finishes current processing procedure; If do not find, then execution in step 23;
Step 23, analysis user obtain the parent directory of the file of need increase by the complete trails title of the file of the needs increase of client input;
Step 24 is utilized the node of the parent directory correspondence that ff operation finding step 23 obtains;
Step 25 if step 24 can not find node corresponding, is then made mistakes, and finishes current processing procedure;
If what the node that step 24 finds was represented is not catalogue, then make mistakes, finish current processing procedure;
If the pSubTree of the node that step 24 finds is for empty, then set up a new node, insert the information that needs to increase file, as " 123.exe " in the filename "/A/b/123.exe ", the node of parent directory correspondence and the corresponding relation of new node are set, and the pSubTree that is about to the parent directory node points to new node;
If the pSubTree of the node correspondence that step 24 finds not for empty, then increases a new node in the balanced binary tree at this node place, insert the relevant information of the file that needs increase.
Operation three: delete file operation.
Delete file operation may further comprise the steps:
Step 31 utilizes the ff operation to search the node of the file correspondence that needs deletion;
Step 32 if can not find node, is then made mistakes, and finishes current processing procedure; If find node, analyze the complete trails title of the file that needs deletion, obtain the parent directory of this document;
Step 33 is searched the balanced binary tree at parent directory corresponding node place;
Step 34, if step 33 obtains the balanced binary tree of parent directory corresponding node, then the node of deletion specified file correspondence from this balanced binary tree is about to this node and is set to NULL.
Operation four: file name retouching operation.
The file name retouching operation may further comprise the steps:
Step 41 utilizes the ff operation to search the node of the file correspondence that needs the modification title;
Step 42 if can not find, is then made mistakes, and finishes current processing procedure; If can find, then utilize ff operation to search the node of this document being revised the file correspondence after the title;
Step 43 if can find, is then made mistakes, and finishes current processing procedure; Otherwise, the title of file in the node that modify steps 41 is found;
Step 44 is carried out balancing run to the balanced binary tree at this node place.
Operation five: file movement operation
The file movement operation may further comprise the steps:
Step 51 utilizes the ff operation to search the node that needs mobile file correspondence;
Step 52 if can not find, is then made mistakes, and finishes current processing procedure; If can find, then utilize ff operation locating file to move the node of back this document correspondence;
Step 53 if can find, is then made mistakes, and finishes current processing procedure; If can find, then analyze the complete trails title that needs mobile file, obtain the parent directory of this document;
Step 54 is utilized the node of the parent directory correspondence that ff operation finding step 53 obtains;
Step 55, the file movement that current need are moved arrives destination address;
Step 56, Study document move the complete trails title of back file, obtain the parent directory of this document after the file movement;
Step 57 is utilized the node of the parent directory correspondence that ff operation finding step 56 obtains;
Step 58 if step 57 can not find corresponding node, is then returned mistake, finishes current processing procedure; If step 57 finds corresponding node, the node that obtains of backup-step 51 then;
Step 59, the node that deletion step 51 obtains;
Step 60 adds step 58 with the node of step 58 backup and obtains among the subtree of balanced binary tree correspondence at node place.
Operation six: traversal directory operation.
The traversal directory operation may further comprise the steps:
Step 61 utilizes the ff operation to search the node of the directory name correspondence of input, as catalogue "/A ";
Step 62, if the node that finds in the step 61 is sky, then Returning catalogue does not exist, and finishes current processing procedure; If the node that step 61 finds takes out the subtree that step 61 finds the balanced binary tree at node place for empty, as the subtree of the balanced binary tree at catalogue "/A " node place;
Step 63 is if the subtree that step 62 obtains is then directly returned for empty; If the subtree that step 62 obtains for empty, does not then travel through this subtree, return traversing result.
For realizing above-mentioned catalog management method, the present invention also provides a kind of directory management device, Figure 4 shows that the structural relation synoptic diagram of directory management device of the present invention, and directory management apparatus structure of the present invention comprises:
Analysis module 41 is used for the complete trails title is analyzed, and obtains the catalogue that described complete trails title represents or the short name of file.Here, the short name of a storage directory or file in multistage balanced binary tree, short name are the unique identification titles of catalogue or file.
Node distribution module 42 is used for according to described short name, catalogue or idle node of file allocation of representing for described short name.
Wherein, idle node is made up of FileName, pSubTree, pLeftTree and pRighftTree, and wherein, the thresholding of FileName is by the described short name value of foundation.When described idle node was represented catalogue, pSubTree pointed to the root node of balanced binary tree at the next stage catalogue place of described catalogue, the subtree of the balanced binary tree at described catalogue place be shown in the balanced binary tree at next stage catalogue place; When described idle node was represented file, pSubTree was empty NULL, does not promptly exist.
Judge module 43 is used to judge whether the catalogue represented with described short name or the catalogue or the file of file peer exist, and obtains judged result.
Generally, judged result has two kinds: the catalogue that existence and short name are represented or the catalogue or the file of file peer; There are not the catalogue represented with short name or the catalogue or the file of file peer.
Balanced binary tree generation module 44 is used for generating separately a balanced binary tree according to judged result by described idle node, is perhaps inserted in the balanced binary tree that the node of the catalogue of described peer or file generates by described idle node.
Multistage balanced binary tree constructing module 45 is used for according to the balance rule all balanced binary trees being carried out balancing run, generates multistage balanced binary tree.Here, the multistage balanced binary tree of described generation is specially: according to the TOC level membership, utilize the pSubTree territory of node that each balanced binary tree is associated, thereby generate multistage balanced binary tree.
Device of the present invention can further include an administration module, is used for according to described multistage balanced binary tree the catalogue of whole file system being traveled through catalogue, locating file, increase file, deleted file, revised file title, move operational administrative.When described administration module manages catalogue, be based on multistage balanced binary tree, can information interaction be arranged with multistage balanced binary tree constructing module 45; When catalogue is carried out above-mentioned several operational administrative, all need earlier the complete trails title of catalogue or file to be analyzed, thus also can and analysis module 41 between carry out information interaction; In the time of need be when catalogue is increased file, also need to carry out information interaction with node distribution module 42 to the new idle node of file allocation.
The above is preferred embodiment of the present invention only, is not to be used to limit protection scope of the present invention.

Claims (7)

1. a catalog management method creaties directory or file in client, and the complete trails title of input directory or file, and described complete trails title is sent to meta data server, it is characterized in that this method comprises:
Described complete trails title is analyzed, obtained the catalogue that described complete trails title represents or the short name of file;
According to described short name, meta data server is catalogue or the file allocation idle node that described short name is represented;
Whether the catalogue that meta data server is judged and described short name is represented or the catalogue at the same level or the file of file exist, and if there is no, then described idle node generates balanced binary tree separately; If exist, then described idle node is inserted in the balanced binary tree that the node of described catalogue at the same level or file generates;
According to the balance rule all balanced binary trees are carried out balancing run, generate multistage balanced binary tree; And the multistage balanced binary tree of the described generation of foundation manages catalogue;
Wherein, described idle node is made up of filename FileName, subtree pSubTree, left subtree pLeftTree and right subtree pRighftTree, and the thresholding of FileName is according to described short name value; When described idle node was represented catalogue, pSubTree pointed to the root node of balanced binary tree at the next stage catalogue place of described catalogue, and the subtree of the balanced binary tree at described catalogue place is the balanced binary tree at described next stage catalogue place; When described idle node was represented file, pSubTree was empty NULL.
2. according to the described catalog management method of claim 1, it is characterized in that described short name is called the unique identification title of described catalogue or file.
3. according to the described catalog management method of claim 1, it is characterized in that, described balance rule is: according to the size of FileName, pLeftTreep in the described balanced binary tree and RighftTree thresholding, to FileName, pLeftTreep and RighftTree assignment again.
4. according to the described catalog management method of claim 1, it is characterized in that, the multistage balanced binary tree of described foundation manages the catalogue of whole file system, comprising: any one in traversal catalogue, locating file, increase file, deleted file, revised file title, the move or multiple combination arbitrarily.
5. a directory management device is characterized in that, this device comprises:
Analysis module is used for the complete trails title is analyzed, and obtains the catalogue that described complete trails title represents or the short name of file;
The node distribution module is used for according to described short name, catalogue or the file allocation idle node represented for described short name;
Judge module is used to judge whether the catalogue represented with described short name or the catalogue or the file of file peer exist, and obtain judged result;
The balanced binary tree generation module, be used for when the catalogue of judging the catalogue represented with described short name or file peer or file do not exist, not generating balanced binary tree separately, and when judgement exists, insert in the balanced binary tree that the node of the catalogue of described peer or file generates by described idle node by described idle node;
Multistage balanced binary tree constructing module is used for according to the balance rule all balanced binary trees being carried out balancing run, generates multistage balanced binary tree;
Wherein, described idle node is made up of filename FileName, subtree pSubTree, left subtree pLeftTree and right subtree pRighftTree, and the thresholding of FileName is according to described short name value; When described idle node was represented catalogue, pSubTree pointed to the root node of balanced binary tree at the next stage catalogue place of described catalogue, and the subtree of the balanced binary tree at described catalogue place is the balanced binary tree at described next stage catalogue place; When described idle node was represented file, pSubTree was empty NULL.
6. according to the described directory management device of claim 5, it is characterized in that, this device also comprises administration module, be used for the catalogue of whole file system being carried out operational administrative according to described multistage balanced binary tree, described operational administrative is any one or multiple combination arbitrarily in traversal catalogue, locating file, increase file, deleted file, revised file title, the move.
7. according to claim 5 or 6 described directory management devices, it is characterized in that, described balance rule is: according to the size of FileName, pLeftTreep in the described balanced binary tree and RighftTree thresholding, to FileName, pLeftTreep and RighftTree assignment again.
CN2008101268591A 2008-07-01 2008-07-01 Directory management method and apparatus Expired - Fee Related CN101315640B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN2008101268591A CN101315640B (en) 2008-07-01 2008-07-01 Directory management method and apparatus

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN2008101268591A CN101315640B (en) 2008-07-01 2008-07-01 Directory management method and apparatus

Publications (2)

Publication Number Publication Date
CN101315640A CN101315640A (en) 2008-12-03
CN101315640B true CN101315640B (en) 2010-09-01

Family

ID=40106648

Family Applications (1)

Application Number Title Priority Date Filing Date
CN2008101268591A Expired - Fee Related CN101315640B (en) 2008-07-01 2008-07-01 Directory management method and apparatus

Country Status (1)

Country Link
CN (1) CN101315640B (en)

Families Citing this family (18)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101521627B (en) * 2009-04-13 2011-10-05 华为技术有限公司 Method and device for inserting nodes
CN101719141B (en) * 2009-12-24 2011-09-07 成都市华为赛门铁克科技有限公司 File processing method and system based on directory object
CN102024019B (en) * 2010-11-04 2013-03-13 曙光信息产业(北京)有限公司 Suffix tree based catalog organizing method in distributed file system
CN102331957B (en) * 2011-09-28 2013-08-28 华为技术有限公司 File backup method and device
JP5798503B2 (en) * 2012-01-31 2015-10-21 株式会社日立ソリューションズ File list generation method and system, file list generation device, and program
CN102902734A (en) * 2012-09-12 2013-01-30 北京伸得纬科技有限公司 Method and system for catalogue storage and mapping
CN103559231B (en) * 2013-10-23 2018-03-09 华为技术有限公司 A kind of file system quota management method, apparatus and system
CN103744882B (en) * 2013-12-20 2018-05-25 浪潮(北京)电子信息产业有限公司 A kind of browse film segment table based on key-value pair shows method and device
CN105787083A (en) * 2016-03-02 2016-07-20 深圳市元征科技股份有限公司 Data processing method and device
CN108073646B (en) * 2016-11-18 2021-12-24 北大方正集团有限公司 Directory extraction method and device
CN107066506B (en) * 2017-01-11 2020-12-08 中国科学院空间应用工程与技术中心 Method and device for improving space science and application data retrieval efficiency
CN107566506B (en) * 2017-09-15 2020-03-10 华为技术有限公司 Data access method and device
CN109446166B (en) * 2018-09-03 2023-11-17 国信金宏信息咨询有限责任公司 Method for detecting file directory, computer readable storage medium and terminal device
CN109308284B (en) * 2018-09-28 2023-09-19 中国平安财产保险股份有限公司 Report menu generation method and device, computer equipment and storage medium
CN109388462A (en) * 2018-09-28 2019-02-26 中国平安财产保险股份有限公司 Report sharing method, device, computer equipment and storage medium
CN109508326B (en) * 2018-11-22 2020-03-17 北京百度网讯科技有限公司 Method, device and system for processing data
CN109729407A (en) * 2018-12-10 2019-05-07 视联动力信息技术股份有限公司 A kind of catalog indication method and device
CN109450715B (en) * 2018-12-26 2022-01-25 新华三技术有限公司 Message processing method and device

Also Published As

Publication number Publication date
CN101315640A (en) 2008-12-03

Similar Documents

Publication Publication Date Title
CN101315640B (en) Directory management method and apparatus
US6279007B1 (en) Architecture for managing query friendly hierarchical values
CN102246172A (en) System and method for distributed index searching of electronic content
CN107153647B (en) Method, apparatus, system and computer program product for data compression
US20060041560A1 (en) Distributing content indices
CN103282900B (en) Methods for indexing and searching based on language locale
CN104794123A (en) Method and device for establishing NoSQL database index for semi-structured data
CN103384256A (en) Cloud storage method and device
CN102402602A (en) B+ tree indexing method and device of real-time database
CN102915382A (en) Method and device for carrying out data query on database based on indexes
US8880553B2 (en) Redistribute native XML index key shipping
CN103678550A (en) Mass data real-time query method based on dynamic index structure
CN105335402A (en) Search method, index data generation method and device on the basis of static Cache
CN101789027A (en) Metadata management method based on DBMS and metadata server
CN112148680B (en) File system metadata management method based on distributed graph database
US20110153677A1 (en) Apparatus and method for managing index information of high-dimensional data
CN102521375A (en) Directory service data retrieval method and directory service data retrieval system
Xu et al. Enhancing HDFS with a full-text search system for massive small files
KR100999408B1 (en) Method for searching an ??? using hash tree
Rao et al. Locating XML documents in a peer-to-peer network using distributed hash tables
CN108509585A (en) A kind of isomeric data real-time, interactive optimized treatment method
Batra et al. A short survey of advantages and applications of skip graphs
Chen et al. A scalable semantic indexing framework for peer-to-peer information retrieval
KR100426995B1 (en) Method and system for indexing document
CN111782150A (en) Multi-bucket storage system and method based on object storage

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
C14 Grant of patent or utility model
GR01 Patent grant
CF01 Termination of patent right due to non-payment of annual fee

Granted publication date: 20100901

Termination date: 20190701

CF01 Termination of patent right due to non-payment of annual fee