Summary of the invention
The present invention, just based on the problems referred to above, proposes a kind of new art file management technology, and the filename of the file being in different memory location can be avoided to repeat, and is conducive to realizing the management to distributed document.
In view of this, the present invention proposes a kind of file management system, comprising: text string generation unit, in the process stored file, according to pre-defined rule, the memory location of described file is generated as corresponding character string; Document handling unit, for using the filename of described character string as described file; Storage unit, for storing the file after described document handling unit process.
In this technical scheme, the memory location according to file generates corresponding filename, effectively can avoid having identical filename at the file of different memory location, thus be conducive to the management of system for distributed document.
In technique scheme, preferably, the memory location of described file comprises: the physical machine residing for described file, and the store path on described physical machine.
In technique scheme, preferably, described text string generation unit, specifically for: position process subelement, for described memory location is divided into multiple concrete positional information, and generates the character string corresponding to described positional information; Random string generates subelement, for generating one section of random string, is divided into groups successively by described random string, to correspond respectively to the character string of described positional information; First string processing subelement, for the character string of each described positional information is carried out xor operation with corresponding random string respectively, to generate character string after corresponding process respectively; Title generates subelement, for by after character string after all described process and the splicing of described random string, as the filename of described file.
In technique scheme, preferably, also comprise: ff unit, for the filename according to file to be found, determine corresponding memory location, to obtain this file to be found.
In this technical scheme, system, according to the filename of file, can separate out corresponding file storage location by Directly solution, waits operation, thus reduces the consumption for system resource, the treatment effeciency of raising system without the need to repeatedly retrieving file.
In technique scheme, preferably, described ff unit comprises: filename segmentation subelement, for according to pre-defined rule, described filename is divided into character string and random string after the segmentation corresponding to each positional information; Random string segmentation subelement, for described random string is divided into multistage, with corresponding with character string after described segmentation; Second string processing subelement, for every section of random string is carried out xor operation with character string after corresponding described segmentation, to obtain corresponding positional information; Position acquisition subelement, for being spliced into the memory location of described file to be found by all positional informations.
According to another aspect of the invention, also proposed a kind of file management method, comprising: step 202, in the process that file is stored, according to pre-defined rule, the memory location of described file is generated as corresponding character string; Step 204, using the filename of described character string as described file.
In this technical scheme, the memory location according to file generates corresponding filename, effectively can avoid having identical filename at the file of different memory location, thus be conducive to the management of system for distributed document.
In technique scheme, preferably, the memory location of described file comprises: the physical machine residing for described file, and the store path on described physical machine.
In technique scheme, preferably, described step 202 comprises: described memory location is divided into multiple concrete positional information, and generates the character string corresponding to described positional information; Generate one section of random string, described random string is divided into groups successively, to correspond respectively to the character string of described positional information; The character string of each described positional information is carried out xor operation with corresponding random string respectively, to generate character string after corresponding process respectively; After character string after all described process and the splicing of described random string, as the filename of described file.
In technique scheme, preferably, after described step 204, also comprise: step 206, according to the filename of file to be found, determine corresponding memory location, to obtain this file to be found.
In this technical scheme, system, according to the filename of file, can separate out corresponding file storage location by Directly solution, waits operation, thus reduces the consumption for system resource, the treatment effeciency of raising system without the need to repeatedly retrieving file.
In technique scheme, preferably, described step 206 comprises: according to pre-defined rule, described filename is divided into character string and random string after the segmentation corresponding to each positional information; Described random string is divided into multistage, with corresponding with character string after described segmentation; Every section of random string is carried out xor operation with character string after corresponding described segmentation, to obtain corresponding positional information, all positional informations is spliced into the memory location of described file to be found.
By above technical scheme, the filename of the file being in different memory location can be avoided to repeat, be conducive to realizing the management to distributed document.
Embodiment
In order to more clearly understand above-mentioned purpose of the present invention, feature and advantage, below in conjunction with the drawings and specific embodiments, the present invention is further described in detail.It should be noted that, when not conflicting, the feature in the embodiment of the application and embodiment can combine mutually.
Set forth a lot of detail in the following description so that fully understand the present invention; but; the present invention can also adopt other to be different from other modes described here and implement, and therefore, protection scope of the present invention is not by the restriction of following public specific embodiment.
Fig. 1 shows the block diagram of file management system according to an embodiment of the invention.
As shown in Figure 1, file management system 100 according to an embodiment of the invention, comprising: text string generation unit 102, in the process stored file, according to pre-defined rule, the memory location of described file is generated as corresponding character string; Document handling unit 104, for using the filename of described character string as described file; Storage unit 106, for storing the file after described document handling unit process.
In this technical scheme, the memory location according to file generates corresponding filename, effectively can avoid having identical filename at the file of different memory location, thus be conducive to the management of system for distributed document.
In technique scheme, preferably, the memory location of described file comprises: the physical machine residing for described file, and the store path on described physical machine.
In technique scheme, preferably, described text string generation unit 102, specifically for: position process subelement 1022, for described memory location is divided into multiple concrete positional information, and generates the character string corresponding to described positional information; Random string generates subelement 1024, for generating one section of random string, is divided into groups successively by described random string, to correspond respectively to the character string of described positional information; First string processing subelement 1026, for the character string of each described positional information is carried out xor operation with corresponding random string respectively, to generate character string after corresponding process respectively; Title generates subelement 1028, for by after character string after all described process and the splicing of described random string, as the filename of described file.
In technique scheme, preferably, also comprise: ff unit 108, for the filename according to file to be found, determine corresponding memory location, to obtain this file to be found.
In this technical scheme, system, according to the filename of file, can separate out corresponding file storage location by Directly solution, waits operation, thus reduces the consumption for system resource, the treatment effeciency of raising system without the need to repeatedly retrieving file.
In technique scheme, preferably, described ff unit 108 comprises: filename segmentation subelement 1082, for according to pre-defined rule, described filename is divided into character string and random string after the segmentation corresponding to each positional information; Random string segmentation subelement 1084, for described random string is divided into multistage, with corresponding with character string after described segmentation; Second string processing subelement 1086, for every section of random string is carried out xor operation with character string after corresponding described segmentation, to obtain corresponding positional information; Position acquisition subelement 1088, for being spliced into the memory location of described file to be found by all positional informations.
Fig. 2 shows the process flow diagram of file management method according to an embodiment of the invention.
As shown in Figure 2, file management method according to an embodiment of the invention, comprising: step 202, in the process stored file, according to pre-defined rule, the memory location of described file is generated as corresponding character string; Step 204, using the filename of described character string as described file.
In this technical scheme, the memory location according to file generates corresponding filename, effectively can avoid having identical filename at the file of different memory location, thus be conducive to the management of system for distributed document.
In technique scheme, preferably, the memory location of described file comprises: the physical machine residing for described file, and the store path on described physical machine.
In technique scheme, preferably, described step 202 comprises: described memory location is divided into multiple concrete positional information, and generates the character string corresponding to described positional information; Generate one section of random string, described random string is divided into groups successively, to correspond respectively to the character string of described positional information; The character string of each described positional information is carried out xor operation with corresponding random string respectively, to generate character string after corresponding process respectively; After character string after all described process and the splicing of described random string, as the filename of described file.
In technique scheme, preferably, after described step 204, also comprise: step 206, according to the filename of file to be found, determine corresponding memory location, to obtain this file to be found.
In this technical scheme, system, according to the filename of file, can separate out corresponding file storage location by Directly solution, waits operation, thus reduces the consumption for system resource, the treatment effeciency of raising system without the need to repeatedly retrieving file.
In technique scheme, preferably, described step 206 comprises: according to pre-defined rule, described filename is divided into character string and random string after the segmentation corresponding to each positional information; Described random string is divided into multistage, with corresponding with character string after described segmentation; Every section of random string is carried out xor operation with character string after corresponding described segmentation, to obtain corresponding positional information, all positional informations is spliced into the memory location of described file to be found.
In the inventive solutions, the management for file mainly comprises three parts, below in conjunction with Fig. 3 to Fig. 5, is described in detail respectively to each part.
One, abstract formation logical file is carried out to physical location
Fig. 3 shows according to an embodiment of the invention by abstract for the physical location of the file schematic diagram for logical file.
As shown in Figure 3, be separated by file by NameNode with DataNode two levels of abstraction with actual storage locations, NameNode represents the IP of physical machine, and what DataNode then represented that this machine has can the physical storage locations of storage file.To preserve the abstract of multiple physical machine in FileSys.xml, this file is the important evidence of filename being carried out to Code And Decode, and this file further comprises access physical machine, operating right etc. additional information in addition.
Two, the cataloged procedure of filename
Fig. 4 shows according to an embodiment of the invention to the schematic diagram that filename is encoded.
When writing a file to file management system, from FileSys.xml, an available position is selected to store this file by documentor, and the physical location encoded of this file is formed a CHAR, character string is also as the filename storing this file.
As shown in Figure 4, this cataloged procedure specifically comprises:
1. select a physical storage locations by documentor;
2. the NameNode coding in physical location is become the 16 system character strings that length is 4;
3. the DataNode coding in physical location is become the 16 system character strings that length is 4;
4. the directory name coding under DataNode is become the 16 system character strings that length is 8;
5. stochastic generation length is the 16 system character strings of 8;
6. use random code to do xor operation to section character string of 3 above;
7. 4 sections of character strings and source file suffix name are spliced and become definitive document name.
Three, the decode procedure of filename
Fig. 5 shows according to an embodiment of the invention to the schematic diagram that filename is decoded.
The decoding of filename is the reverse procedure of coding, and will obtain 3 segment tables and show the character string of file physical location after being decoded by filename by rule, documentor uses FileSys.xml to determine final physical storage locations.
As shown in Figure 5, this decode procedure specifically comprises:
1. filename is divided into 5 parts, to be length be respectively 4 NameNode, the length DataNode that is 4, the length directory name that is 8, length be 8 random code and file name suffix;
2. use random code to do xor operation with first 3 sections respectively;
3. in FileSys.xml, retrieve the physical machine representated by it according to NameNode;
4. in FileSyste.xml, retrieve the memory location representated by it according to DataNode;
5. determine the next stage catalogue of this file in memory location according to directory name;
6. physical machine, memory location, directory name, filename 4 part are spliced into concrete access path.
More than be described with reference to the accompanying drawings technical scheme of the present invention, by technical scheme of the present invention, achieved:
1, become a file management system in logic by abstract for the file storage location of distribution, the true physical location of file during user's operation file, need not be concerned about.When file management system dilatation, migration, only need the related abstractions revised in fileSys.xml to configure, the normal file operation of user can not be affected, the service ability of file management system is got a promotion.
2, eliminate the central point in traditional file management method, do not need central point preserve the index of file and provide document alignment function.Can locating file physical location accurately as long as obtain fileSys.xml and filename coding and decoding rule in the method.Central point is avoided to become performance bottleneck and the Single Point of Faliure risk of file operation.
The foregoing is only the preferred embodiments of the present invention, be not limited to the present invention, for a person skilled in the art, the present invention can have various modifications and variations.Within the spirit and principles in the present invention all, any amendment done, equivalent replacement, improvement etc., all should be included within protection scope of the present invention.