The content of the invention
For above-mentioned technical problem, a kind of file memory method based on two dimensional surface angulation is this invention takes, passed through
File to be stored is set up to the model of plane right-angle coordinate mapping relations, Data expansion sex chromosome mosaicism is solved and is asked with Data Migration
Topic, and while solve the maintenance issues of file and memory node mapping relations data.
The present invention adopts with the following method to realize:A kind of file memory method based on two dimensional surface angulation:Including:
The unique mark of file to be stored is calculated based on hash algorithm;File to be stored and flat square are set up according to unique mark
The mapping relations of coordinate system;The deflection size that rectangular co-ordinate is fastened is calculated according to Planar Mapping relation;Set up file to be stored
Deflection and memory node mapping relations.
Further, the hash algorithm includes:MD5 hash algorithms, SHA-1 hash algorithms, SHA-256 hash algorithms.
Further, the unique mark of file to be stored is calculated based on MD5 hash algorithms;It is described to be set up according to unique mark
File to be stored is specially with the mapping relations of plane right-angle coordinate:
Using the front 16 byte representations x coordinate axle interval range of calculated MD5 values, using rear 16 byte representation y-coordinates
Axle interval range, and respectively front 16 bytes and rear 16 bytes carried out into integer, you can determine file to be stored in plane
The mapping relations of rectangular coordinate system are(FILEX,FILEY).
Further, the method for the integer is to carry out integer using function STR2HEX.
Further, the deflection of the file to be stored is psi=arctan(FILEX/FILEY)And the value model of psi
Enclose for 0 ~ 360 degree;And each deflection is unique, all deflection sums are 360 degree.
Present invention also offers a kind of document storage system based on two dimensional surface angulation, it is characterised in that include:
Mark module, for calculating the unique mark of file to be stored based on hash algorithm;
Mapping block one, for setting up the mapping relations of file to be stored and plane right-angle coordinate according to unique mark;
Computing module, for calculating the deflection size that rectangular co-ordinate is fastened according to Planar Mapping relation;
Mapping block two, for setting up the deflection and memory node mapping relations of file to be stored.
Further, the hash algorithm includes:MD5 hash algorithms, SHA-1 hash algorithms, SHA-256 hash algorithms.
Further, the unique mark of file to be stored is calculated based on MD5 hash algorithms;It is described to be set up according to unique mark
File to be stored is specially with the mapping relations of plane right-angle coordinate:Using the front 16 byte representation x of calculated MD5 values
Reference axis interval range, using rear 16 byte representations y-coordinate axle interval range, and respectively by front 16 bytes and rear 16 words
Section carries out integer, you can determine that file to be stored is in the mapping relations of plane right-angle coordinate(FILEX,FILEY).
Further, the method for the integer is to carry out integer using function STR2HEX.
Further, the deflection of the file to be stored is psi=arctan(FILEX/FILEY)And the value model of psi
Enclose for 0 ~ 360 degree;And each deflection is unique, all deflection sums are 360 degree.
Beneficial effects of the present invention are:The present invention has height autgmentability, and memory node number is more than or equal to 1, supports high expansion
Exhibition, realizes " i.e. full to expand ", and load balancing is just for single memory node, greatly reduces Data Migration magnitude, drop
The low time used by load balancing, network I/O consumption is reduced, so as to maintain the performance of storage system;In addition, the present invention is carried
Document storage system of the kind based on two dimensional surface angulation has been supplied, file index data, file and storage section has no longer been limited by
The mapping relations of point can be calculated in real time.
Specific embodiment
In order that those skilled in the art more fully understand the technical scheme in the embodiment of the present invention, and make the present invention's
Above-mentioned purpose, feature and advantage can become apparent from understandable, and technical scheme in the present invention is made further in detail below in conjunction with the accompanying drawings
Thin explanation.
Present invention firstly provides a kind of file memory method embodiment based on two dimensional surface angulation, as shown in figure 1, bag
Include:
S101 calculates the unique mark of file to be stored based on hash algorithm;
S102 sets up the mapping relations of file to be stored and plane right-angle coordinate according to unique mark;
S103 calculates the deflection size that rectangular co-ordinate is fastened according to Planar Mapping relation;
S104 sets up the deflection and memory node mapping relations of file to be stored.
Further, the hash algorithm includes:MD5 hash algorithms, SHA-1 hash algorithms, SHA-256 hash algorithms.
Further, the unique mark of file to be stored is calculated based on MD5 hash algorithms;It is described to be set up according to unique mark
File to be stored is specially with the mapping relations of plane right-angle coordinate:
Using the front 16 byte representations x coordinate axle interval range of calculated MD5 values, using rear 16 byte representation y-coordinates
Axle interval range, and respectively front 16 bytes and rear 16 bytes carried out into integer, you can determine file to be stored in plane
The mapping relations of rectangular coordinate system are(FILEX,FILEY).
Further, the method for the integer is to carry out integer using function STR2HEX.
Wherein, 16 bytes before defined variable MD5VAL_PRE16=MD5 VALUE;
16 bytes after variable MD5VAL_SUF16=MD5 VALUE;
Then, the minimum value MIN (MD5VAL_PRE16)=0000000000000000 of front 16 bytes;
Middle calculation is MID (MD5VAL_PRE16)=7FFFFFFFFFFFFFFF;
Maximum MAX (the MD5VAL_PRE16)=FFFFFFFFFFFFFFFF of front 16 bytes;
The minimum value MIN (MD5VAL_SUF16)=0000000000000000 of 16 bytes afterwards;
Middle calculation is MID (MD5VAL_SUF16)=7FFFFFFFFFFFFFFF;
Maximum MAX (the MD5VAL_SUF16)=FFFFFFFFFFFFFFFF of 16 bytes afterwards;
According to data above information, the positive and negative interval range of agreement XY axles
X positive axis interval ranges:[MIN(MD5VAL_PRE16),MID(MD5VAL_PRE16)]
The negative semiaxis interval ranges of x:(-MAX(MD5VAL_PRE16)+ MID(MD5VAL_PRE16) ,0]
Y positive axis interval ranges:[MIN(MD5VAL_SUF16),MID(MD5VAL_SUF16)]
The negative semiaxis interval ranges of y:(-MAX(MD5VAL_SUF16)+ MID(MD5VAL_SUF16) ,0]
And STR2HEX (MD5VAL_PRE16) is set as variable m, STR2HEX (MD5VAL_SUF16) is variable n;
Whether m is judged more than MID (MD5VAL_PRE16), if it is, value FILEX=of the file to be stored in X-coordinate axle
MIN (MD5VAL_PRE16), is otherwise m;
N is judged whether more than MID (MD5VAL_SUF16), if it is, value FILEY of the file to be stored in Y-coordinate axle=
MID (MD5VAL_PRE16)-STR2HEX (MD5VAL_PRE16), is otherwise n;
Further, the deflection of the file to be stored is psi=arctan(FILEX/FILEY)And the span of psi is
0 ~ 360 degree;And each deflection is unique, all deflection sums are 360 degree.
Present invention also offers the document storage system embodiment based on two dimensional surface angulation, as shown in Fig. 2 including:
Mark module 201, for calculating the unique mark of file to be stored based on hash algorithm;
Mapping block 1, for setting up the mapping relations of file to be stored and plane right-angle coordinate according to unique mark;
Computing module 203, for calculating the deflection size that rectangular co-ordinate is fastened according to Planar Mapping relation;
Mapping block 2 204, for setting up the deflection and memory node mapping relations of file to be stored.
Further, the hash algorithm includes:MD5 hash algorithms, SHA-1 hash algorithms, SHA-256 hash algorithms.
Further, the unique mark of file to be stored is calculated based on MD5 hash algorithms;It is described to be set up according to unique mark
File to be stored is specially with the mapping relations of plane right-angle coordinate:Using the front 16 byte representation x of calculated MD5 values
Reference axis interval range, using rear 16 byte representations y-coordinate axle interval range, and respectively by front 16 bytes and rear 16 words
Section carries out integer, you can determine that file to be stored is in the mapping relations of plane right-angle coordinate(FILEX,FILEY).
Further, the method for the integer is to carry out integer using function STR2HEX.
Wherein, 16 bytes before defined variable MD5VAL_PRE16=MD5 VALUE;
16 bytes after variable MD5VAL_SUF16=MD5 VALUE;
Then, the minimum value MIN (MD5VAL_PRE16)=0000000000000000 of front 16 bytes;
Middle calculation is MID (MD5VAL_PRE16)=7FFFFFFFFFFFFFFF;
Maximum MAX (the MD5VAL_PRE16)=FFFFFFFFFFFFFFFF of front 16 bytes;
The minimum value MIN (MD5VAL_SUF16)=0000000000000000 of 16 bytes afterwards;
Middle calculation is MID (MD5VAL_SUF16)=7FFFFFFFFFFFFFFF;
Maximum MAX (the MD5VAL_SUF16)=FFFFFFFFFFFFFFFF of 16 bytes afterwards;
According to data above information, the positive and negative interval range of agreement XY axles
X positive axis interval ranges:[MIN(MD5VAL_PRE16),MID(MD5VAL_PRE16)]
The negative semiaxis interval ranges of x:(-MAX(MD5VAL_PRE16)+ MID(MD5VAL_PRE16) ,0]
Y positive axis interval ranges:[MIN(MD5VAL_SUF16),MID(MD5VAL_SUF16)]
The negative semiaxis interval ranges of y:(-MAX(MD5VAL_SUF16)+ MID(MD5VAL_SUF16) ,0]
And STR2HEX (MD5VAL_PRE16) is set as variable m, STR2HEX (MD5VAL_SUF16) is variable n;
Whether m is judged more than MID (MD5VAL_PRE16), if it is, value FILEX=of the file to be stored in X-coordinate axle
MIN (MD5VAL_PRE16), is otherwise m;
N is judged whether more than MID (MD5VAL_SUF16), if it is, value FILEY of the file to be stored in Y-coordinate axle=
MID (MD5VAL_PRE16)-STR2HEX (MD5VAL_PRE16), is otherwise n;
Further, the deflection of the file to be stored is psi=arctan(FILEX/FILEY)And the span of psi is
0 ~ 360 degree;And each deflection is unique, all deflection sums are 360 degree.
File memory method based on two dimensional surface angulation proposed by the present invention has the advantage that:
1. there is height autgmentability, memory node number is more than or equal to N(N>1), high extension is supported, realize " i.e. full to expand ";
2. load balancing greatly reduces Data Migration magnitude just for single memory node, reduces used by load balancing
Time, network I/O consumption is reduced, so as to maintain the performance of storage system;
3. storage system is no longer limited by file index data, because this storage system no longer needs file index data, waits to deposit
What the mapping relations of storage file and memory node were calculated in real time.
As seen through the above description of the embodiments, those skilled in the art can be understood that the present invention can
Realize by the mode of software plus required general hardware platform.Based on such understanding, technical scheme essence
On prior art is contributed part in other words can be embodied in the form of software product, the computer software product
Can be stored in storage medium, such as ROM/RAM, magnetic disc, CD, including some instructions are used so that a computer equipment
(Can be personal computer, server, or network equipment etc.)Some of execution each embodiment of the invention or embodiment
Method described in part.
Each embodiment in this specification is described by the way of progressive, identical similar portion between each embodiment
Divide mutually referring to what each embodiment was stressed is the difference with other embodiment.Especially for system reality
For applying example, because it is substantially similar to embodiment of the method, so description is fairly simple, related part is referring to embodiment of the method
Part explanation.
The present invention can be used in numerous general or special purpose computing system environments or configuration.For example:Personal computer, service
Device computer, handheld device or portable set, laptop device, multicomputer system, based on the system of microprocessor, top set
Box, programmable consumer-elcetronics devices, network PC, minicom, mainframe computer, including any of the above system or equipment
DCE etc..
The present invention can be described in the general context of computer executable instructions, such as program
Module.Usually, program module includes execution particular task or realizes routine, program, object, the group of particular abstract data type
Part, data structure etc..The present invention can also be in a distributed computing environment put into practice, in these DCEs, by
The remote processing devices connected by communication network are performing task.In a distributed computing environment, program module can be with
In local and remote computer-readable storage medium including including storage device.
Although depicting the present invention by embodiment, it will be appreciated by the skilled addressee that the present invention have it is many deformation and
Change the spirit without deviating from the present invention, it is desirable to which appended claim includes these deformations and changes without deviating from the present invention's
Spirit.