Summary of the invention
At the problem that prior art exists, main purpose of the present invention is to provide a kind of redundancy low, and is applicable in uncertain peer-to-peer network of memory node number or the self-organizing network.
For achieving the above object, the invention provides a kind of distributed adaptive coding and storing method, be applied in the distributed system, this distributed adaptive coding and storing method comprises the steps:
(1) detects number of storage nodes in the distributed system;
(2) carry out self adaptation according to number of storage nodes in the system and adjust code word, the file that needs are stored carries out adaptive coding;
(3) file after will encoding carries out five equilibrium by the node number;
(4) will wait the file behind the branch to be packaged into blocks of files with unified file encapsulation format, each blocks of files all comprises encoding block, block of information and check block, comprises codeword information in the described encoding block;
(5) packaged file blocks is stored to each node in the system;
(6) whether send the file requirement request when a certain node, it is complete then to detect online memory node and decision node;
(7) if node is complete, then the block of information with all online memory nodes is sent to the file request node, and reorganization obtains original in order;
(8) if node is imperfect, then utilize still the block of information of obtaining disappearance in the blocks of files decoding of the online memory node of activity, will decipher out the block of information of disappearance and the existing block of information acquisition original of recombinating in order; After memory node recovers the block of information of losing, utilize self-adaptive encoding method to carry out secondary coding and the blocks of files of file encapsulation once more, and the blocks of files that will recover again is stored in order still on the online memory node of activity to recover again to lose.
Wherein, one of step of above-mentioned distributed adaptive coding and storing method " carry out self adaptation according to number of storage nodes in the system and adjust code word, the file that needs are stored carries out adaptive coding " specifically comprises the steps:
(1) number of storage nodes is m in the distributed system, and constructing a parameter is (n-t, n-1, t, (n-t) * t/ (n-1)) correcting and eleting codes, distance is equated, be that constructing variable is (n-t, n-1, t, (n-t) * t/ (n-1)) numerical value of each row of matrix be that 1 number equates, the numerical value of each row is 1 the also equal code word of number, saves as codeword information, wherein n 〉=m, n>t specifically comprises the steps: 1. to make n=m; 2. 1 and n between seek t, make (n-t) * t/ (n-1) divide exactly establishment, and t ≠ 1, t ≠ n; 3. if do not exist t to make (n-t) * t/ (n-1) divide exactly establishment, then allow n=n+1, and return above-mentioned steps 2., until existing t to make (n-t) * t/ (n-1) divide exactly establishment; 4. calculate and make
![Figure GSA00000103270600031](https://patentimages.storage.googleapis.com/2c/66/8a/bfd25a5e61bf51/GSA00000103270600031.png)
T when getting minimum value, promptly this moment n, t is selected parameter; 5. the 0th row with (n-t) * (n-1) matrix A are 1 to all elements assignment that t-1 is listed as, and other element assignment are 0; 6. to row t≤j<n-1, the numerical value of compute matrix A j row is 1 number, if the numerical value of j row be 1 number less than (n-t) * t/ (n-1), inevitable
a
I, j '=1 make numerical value in the j ' row be 1 quantity greater than (n-t) * t/ (n-1), wherein 0≤j '<n-1, and j ' ≠ j, then assignment a
I, j=1, a
I, j '=0; 7. repeat above-mentioned steps 6., 1 number is equal to (n-t) * t/ (n-1) in the every row of matrix A;
(2) with the some random division on the matrix A that constructs be t the set D that contained number of elements equates
0D
I-1, check block can be drawn by following formula:
I=n-t ... n-1, j=0 ... n-1, wherein, d
I-(n-t), sFor with the set D
I-(n-t)In the matrix A of element correspondence in point.
The encoding block that relates in the above-mentioned distributed adaptive coding and storing method, except that codeword information, also comprise: data block size, coded block size, block of information size, check block size, data block label, extend information and grouping information, wherein the data block size equals coded block size, data block size and check block size sum, utilizes coded block size, data block size and check block size can obtain encoding block, data block and check block in the blocks of files respectively.
One of step of above-mentioned distributed adaptive coding and storing method " if node is imperfect, is then utilized still the block of information of obtaining disappearance in the blocks of files decoding of the online memory node of activity " has multiple implementation as follows:
First kind of implementation comprises the steps:
(1) blocks of files with all online memory nodes is sent to the file request node;
(2) decipher the block of information of obtaining disappearance according to codeword information in the blocks of files encoding block and check block.
Second kind of implementation comprises the steps:
(1) detects the file request node and be connected situation with network between each online memory node;
(2) judge between the online memory node of file request node and each and to be connected situation by network whether difference is bigger;
(3) if judged result is that then the blocks of files with all online memory nodes is not sent to the file request node, decipher the block of information of obtaining disappearance according to codeword information in the blocks of files encoding block and check block;
(4) if judged result is for being, then calculate and recover the required minimum blocks of files number p of disappearance block of information, select p the online memory node that is connected optimum with the file request meshed network, the blocks of files of this p optimum online memory node is sent to the file request node, deciphers the block of information of obtaining disappearance according to codeword information in the blocks of files encoding block and check block.
The third implementation comprises the steps:
(1) calculates the required minimum blocks of files number p of recovery disappearance block of information;
(2) detect the file request node and be connected situation, and judge between the online memory node of file request node and each and to be connected situation by network whether difference is bigger with network between each online memory node;
(3) if judged result for not, is selected any p online memory node, the blocks of files of this p online memory node is sent to the file request node, obtain the block of information of disappearance according to the codeword information in the blocks of files encoding block and check block decoding;
(4) if judged result is for being, select p the online memory node that is connected optimum with the file request meshed network, the blocks of files of this p optimum online memory node is sent to the file request node, deciphers the block of information of obtaining disappearance according to codeword information in the blocks of files encoding block and check block.
In addition, after decision node is imperfect, if more than one of the quantity of documents of existence disappearance block of information, can utilize still online memory node respectively the file that has disappearance block of information to be recovered, should be responsible for the online memory node that the file to a certain existence disappearance block of information recovers this moment and be the file request node in activity.
One of step that relates in the above-mentioned distributed adaptive coding and storing method " is deciphered the block of information of obtaining disappearance according to codeword information in the blocks of files encoding block and check block ", quantity≤the t/2 that damages when memory node can recover fully to the block of information of disappearance, and this step specifically comprises the steps:
(1) the state initial markers of the check block in the All Files piece that the file request node is received is " available ";
(2) select the check block a of a state at random for " available "
I, jWhether the block of information of checking its verification is deleted, if wherein do not have block of information deleted, then the status indication with this check block is " useless ", if wherein have and only have a block of information deleted, be " useless " with the status indication of this check block equally then, and this deleted block of information is recovered by following formula:
I-(n-t) ≠ i ' wherein, s ≠ j ', i=n-t ... n-1, j=0 ... n-1;
(3) repeating step (2) is " useless " up to the status indication of all check blocks.
The present invention is with respect to prior art, and (1) realizes the higher storage effect of disaster tolerance node number owing to utilize coding method to realize the lasting availability storage of file with lower redundancy, and along with the increase of memory node, the disaster tolerance ability also can improve thereupon; (2) because the coding method of using can be carried out the self adaptation adjustment according to number of storage nodes in the distributed system, the ability and the authority that have the acquisition file that is equal between the memory node, improved the extensibility and the adaptivity of system, counted in uncertain peer-to-peer network of height or the self-organizing network applicable to memory node; (3) because memory node has the self-organizing characteristic, when damage took place memory node, system can utilize the principle of remaining online memory node according to node calculating and memory load equilibrium automatically according to demand, carry out file recovery and data migration, to realize the sustainable disaster tolerance ability of system.
Embodiment
Below in conjunction with accompanying drawing, describe the specific embodiment of the present invention in detail.
Distributed adaptive coding and storing method of the present invention is applied in the distributed system, comprises the storing process of file and the acquisition process of file.
Below in conjunction with Fig. 1-Fig. 3, describe the file storage process of distributed adaptive coding and storing method of the present invention in detail.As shown in Figure 1, this document storing process mainly comprises the steps:
Number of storage nodes in S11, the detection distributed system as shown in Figure 2, is a distributed system, exists m memory node to be connected by computer network;
S12, carry out self adaptation according to number of storage nodes in the system and adjust code word, the file of needs storage is carried out adaptive coding, specifically comprise the steps:
(1) number of storage nodes is m in the distributed system, and constructing a parameter is (n-t, n-1, t, (n-t) * t/ (n-1)) correcting and eleting codes, distance is equated, be that constructing variable is (n-t, n-1, t, (n-t) * t/ (n-1)) numerical value of each row of matrix be that 1 number equates, the numerical value of each row is 1 the also equal code word of number, saves as codeword information, wherein n 〉=m, n>t specifically comprises the steps: 1. to make n=m; 2. 1 and n between seek t, make (n-t) * t/ (n-1) divide exactly establishment, and t ≠ 1, t ≠ n; 3. if do not exist t to make (n-t) * t/ (n-1) divide exactly establishment, then allow n=n+1, and return above-mentioned steps 2., until existing t to make (n-t) * t/ (n-1) divide exactly establishment; 4. calculate and make
T when getting minimum value, promptly this moment n, t is selected parameter; 5. the 0th row with (n-t) * (n-1) matrix A are 1 to all elements assignment that t-1 is listed as, and other element assignment are 0; 6. to row t≤j<n-1, the numerical value of compute matrix A j row is 1 number, if the numerical value of j row be 1 number less than (n-t) * t/ (n-1), inevitable
a
I, j '=1 make numerical value in the j ' row be 1 quantity greater than (n-t) * t/ (n-1), wherein 0≤j '<n-1, and j ' ≠ j, then assignment a
I, j=1, a
I, j '=0; 7. repeat above-mentioned steps 6., 1 number is equal to (n-t) * t/ (n-1) in the every row of matrix A;
(2) with the some random division on the matrix A that constructs be t the set D that contained number of elements equates
0D
I-1, check block can be drawn by following formula:
I=n-t ... n-1, j=0 ... n-1, wherein, d
I-(n-t), sFor with the set D
I-(n-t)In the matrix A of element correspondence in point.
S13, the file after will encoding carry out five equilibrium by the node number;
S14, file behind the branch such as grade is packaged into blocks of files with unified file encapsulation format, as shown in Figure 3, this packaged file blocks comprises encoding block altogether, block of information and check block three parts, wherein encoding block comprises the data block size in order, coded block size, the block of information size, the check block size, the data block label, extend information, this eight part of codeword information and grouping information, the data block size equals coded block size, data block size and check block size sum, utilize coded block size, data block size and check block size can be obtained the encoding block in the blocks of files respectively, data block and check block, extend information is the space that the blocks of files later use is reserved, and codeword information is by formed correcting and eleting codes behind the above-mentioned self-adaptive encoding method; Block of information is promptly undertaken forming behind the five equilibrium by the node number to original; Check block is for utilizing codeword information and original, forms by the above-mentioned self-adaptive encoding method back of encoding.
S15, packaged file blocks is stored to each node in the system.Result after the storage is stored to memory node 1 respectively with the blocks of files that forms after a certain file encapsulation as shown in Figure 2, and memory node 2 is until memory node m.Certainly, can store a more than file in this distributed system, each file is all encoded, encapsulates, is stored by identical method, therefore, may store a more than blocks of files in each memory node, forms the blocks of files set.
Below in conjunction with Fig. 4, Fig. 7 and Fig. 8, describe file acquisition process first embodiment of distributed adaptive coding and storing method of the present invention in detail.As shown in Figure 4, the acquisition process of this document mainly comprises the steps:
S41, a certain node send the file requirement request, and this document requesting node can be a certain memory node in this distributed system, also can be the outer a certain nodes of distributed system;
S42, detect online memory node;
Whether S43, decision node be complete, if node is complete, and then to S44, otherwise, to S45;
S44, the block of information of all online memory nodes is sent to the file request node, and (wherein the transfer of data response protocol comprises: send data answering control word Req1 for obtaining encoding block to the request of response file requesting node; Sending data answering control word Req2 is to response file requesting node request acquired information piece; Send data answering control word Req3 and obtain check block to the request of response file requesting node; Send data answering control word Req4 and obtain blocks of files) to the request of response file requesting node;
S46, complete original is obtained in reorganization in order.
File obtained the visible Fig. 7 of schematic diagram when this node was complete, because in the file storage stage, original is divided into m blocks of files by number of storage nodes m, each blocks of files all comprises encoding block, block of information and check block, and block of information is promptly undertaken forming behind the five equilibrium by the memory node number to original, therefore, when memory node is complete, only need to give the file request node with the block of information part of all memory nodes by Network Transmission, all block of informations that will be received by the file request node are recombinated in order and can be obtained complete original then.
S45, the blocks of files of all online memory nodes is sent to the file request node;
S451, the block of information of disappearance is obtained in decoding according to the codeword information in the blocks of files encoding block and check block;
S46, complete original is obtained in reorganization in order.
File obtained the visible Fig. 8 of schematic diagram when this node was imperfect, when one or several memory node damages, can recover the block of information of disappearance by all the other memory nodes, the quantity k≤t/2 (t draws by the step 1 of above-mentioned self-adaptive encoding method) that only needs memory node to damage can recover fully to the block of information of disappearance.As number of storage nodes is m, each memory node all has blocks of files, comprise blocks of files 1, blocks of files 2...... blocks of files m, when memory node 4 is damaged, promptly lack blocks of files 4, this restoration methods is: the blocks of files of all online memory nodes is sent to the file request node by network, the blocks of files size of this document requesting node by storing in each blocks of files, coded block size, block of information size and check block size obtain the encoding block in each blocks of files respectively, block of information and check block, utilize codeword information and the check block stored in the encoding block to decipher again, thereby obtain the block of information of disappearance, the block of information that regains after existing block of information and the decoding is recombinated in order can obtain complete original.
In addition, utilize codeword information and the check block stored in the encoding block to decipher, thereby the block of information (exist k≤t/2 row deletion wrong in the correcting and eleting codes array, the k row deletion that then can recover all is wrong) that obtains disappearance mainly comprise the steps:
(1) status indication of the check block in the All Files piece that the file request node is received is " available ";
(2) select the check block a of a state at random for " available "
I, jWhether the block of information of checking its verification is deleted, if wherein do not have block of information deleted, then the status indication with this check block is " useless ", if wherein have and only have a block of information deleted, be " useless " with the status indication of this check block equally then, and this deleted block of information is recovered by following formula:
I-(n-t) ≠ i ' wherein, s ≠ j ', i=n-t ... n-1, j=0 ... n-1;
(3) repeating step (2) is " useless " up to the status indication of all check blocks.
Below in conjunction with Fig. 5, Fig. 7, Fig. 8 and Fig. 9, describe file acquisition process second embodiment of distributed adaptive coding and storing method of the present invention in detail.As shown in Figure 5, the acquisition process of this document mainly comprises the steps:
S51, a certain node send the file requirement request, and this document requesting node can be a certain memory node in this distributed system, also can be the outer a certain nodes of distributed system;
S52, detect online memory node;
S53, judge whether memory node is complete, if node is complete, then to S54, otherwise, to S55;
S54, then the block of information with all online memory nodes is sent to the file request node;
S56, reorganization obtains complete original in order.
The process that file obtained when this node was complete is identical with first embodiment, file obtained the visible Fig. 7 of schematic diagram when this node was complete, the block of information part that is about to all memory nodes is given the file request node by Network Transmission, and all block of informations that will be received by the file request node are recombinated in order and can be obtained complete original then.
S55, detect the file request node and be connected with network between each online memory node;
S551, judge between the online memory node of file request node and each and to be connected situation by network whether difference is bigger, if difference is bigger, then to S552, if difference is little, then to S556;
S552, calculating recover the required minimum blocks of files number p of disappearance block of information, p is drawn by following mode: after storing in the system according to distributed adaptive coding and storing method of the present invention, if the quantity of memory node is m, quantity k≤the t/2 (t draws by the step 1 of above-mentioned self-adaptive encoding method) that then only needs memory node to damage can recover fully to the block of information of disappearance, therefore if will recover all block of information, the maximum quantity that memory node damages is t/2, then recovers the number p=m-t/2 of the required minimum blocks of files of disappearance block of information;
S553, carry out network link ordering, promptly be connected situation with the network of file request node each node is sorted according to each online memory node;
S554, select the online memory node of p optimum network connection;
S555, the blocks of files of the p that chooses optimum online memory node and the block of information of all the other online memory nodes are sent the file request node;
Disappearance block of information is obtained in S557, decoding, promptly by the blocks of files of p optimum online memory node the block of information of disappearance is recovered, the pointed decode procedure of its decode procedure and file acquisition process first embodiment of distributed adaptive coding and storing method of the present invention is identical;
S56, obtain complete original, be about to the block of information of the disappearance deciphered by the blocks of files of p optimum online memory node and all the other online memory node information transmitted pieces and recombinate in order and obtain complete original.
This node is imperfect, and network is connected the situation difference when big between file request node and each online memory node, the visible Fig. 9 of the schematic diagram of file acquisition process.The blocks of files that does not need to obtain all online memory nodes because of the block of information that will recover to lack, and the blocks of files that only need obtain p online memory node can be recovered the block of information of all disappearances, therefore, for NLB, the blocks of files of online memory node of selecting p network to connect p network of situation optimum comes the block of information that lacks is recovered, and to obtain complete original, the block of information that only need obtain all the other online memory nodes is again recombinated in order and is got final product.
The blocks of files of S556, all online memory nodes sends the file request node;
Disappearance block of information is obtained in S557, decoding;
S56, obtain complete original.
This node is imperfect, and network is connected the situation difference when little between file request node and each online memory node, and the schematic diagram of its file acquisition process is seen Fig. 8, and the file acquisition process when imperfect with the node of enumerating among first embodiment is identical.The blocks of files that is about to all online memory nodes is sent to the file request node by network, this document requesting node obtains encoding block, block of information and check block in each blocks of files respectively by blocks of files size, coded block size, block of information size and the check block size of storing in each blocks of files, utilize codeword information and the check block stored in the encoding block to decipher again, thereby obtain the block of information of disappearance, the block of information that regains after existing block of information and the decoding is recombinated in order can obtain complete original.
Below in conjunction with Fig. 6, Fig. 7 and Fig. 9, describe file acquisition process the 3rd embodiment of distributed adaptive coding and storing method of the present invention in detail.As shown in Figure 9, the acquisition process of this document mainly comprises the steps:
S61, a certain node send the file requirement request, and this document requesting node can be a certain memory node in this distributed system, also can be the outer a certain nodes of distributed system;
S62, detect online memory node;
S63, judge whether memory node is complete, if node is complete, then to S64, otherwise, to S65;
S64, the block of information of all online memory nodes is sent to the file request node;
S67, reorganization obtains complete original in order.
The process that file obtained when this node was complete is identical with second embodiment with first embodiment, file obtained the visible Fig. 7 of schematic diagram when this node was complete, the block of information part that is about to all memory nodes is given the file request node by Network Transmission, and all block of informations that will be received by the file request node are recombinated in order and can be obtained complete original then.
S65, calculating recover the required minimum blocks of files number p of disappearance block of information, and p=m-t/2 is identical with the computational methods of enumerating among second embodiment;
S66, detect the file request node and be connected with network between each online memory node;
S661, judge between the online memory node of file request node and each and to be connected situation by network whether difference is bigger, if difference is bigger, then to S662, if difference is little, then to S665;
S662, carry out network link ordering, promptly be connected situation with the network of file request node each node is sorted according to each online memory node;
S663, select the online memory node of p optimum network connection;
S664, the blocks of files of the p that chooses optimum online memory node and the block of information of all the other online memory nodes are sent the file request node;
Disappearance block of information is obtained in S666, decoding, promptly by the blocks of files of p optimum online memory node the block of information of disappearance is recovered, the pointed decode procedure of its decode procedure and file acquisition process first embodiment of distributed adaptive coding and storing method of the present invention is identical;
S67, obtain complete original, be about to the block of information of the disappearance deciphered by the blocks of files of p optimum online memory node and all the other online memory node information transmitted pieces and recombinate in order and obtain complete original.
This node is imperfect, and network is connected the situation difference when big between file request node and each online memory node, the visible Fig. 9 of the schematic diagram of file acquisition process.Imperfect with the node of enumerating among second embodiment, and it is roughly the same that network is connected the file acquisition process of situation difference when big between file request node and each online memory node, the blocks of files of online memory node of selecting p network to connect p network of situation optimum comes the block of information that lacks is recovered, and the block of information of obtaining all the other online memory nodes is again recombinated in order and can be obtained complete original.
S665, will be arbitrarily the blocks of files of p online memory node and the block of information of all the other online memory nodes send the file request node;
Disappearance block of information is obtained in S666, decoding, promptly by the blocks of files of any p online memory node the block of information of disappearance is recovered, the pointed decode procedure of its decode procedure and file acquisition process first embodiment of distributed adaptive coding and storing method of the present invention is identical;
S67, obtain complete original, be about to the block of information of the disappearance deciphered by the blocks of files of any p online memory node and all the other online memory node information transmitted pieces and recombinate in order and obtain complete original.
Imperfect when node, and network is connected the situation difference when little between file request node and each online memory node, the visible Fig. 9 of the schematic diagram of file acquisition process.Can recover the block of information of all disappearances because of the blocks of files that only need obtain p online memory node, therefore, do not need to obtain the blocks of files of all online memory nodes, the blocks of files that only need obtain p online memory node gets final product, because to be connected the situation difference little for network between file request node and each online memory node, so do not need to carry out the network link ordering, only need select the blocks of files of any p online memory node to decipher out the block of information of disappearance, recombinate in order with the block of information of all the other online memory nodes then and obtain complete original.
File acquisition process first, second and the 3rd embodiment of distributed adaptive coding and storing method of the present invention have more than been enumerated.When memory node was complete, the obtain manner of these three embodiment was identical; And when memory node is imperfect, can the block of information of disappearance be recovered by different modes, fundamental method is to utilize the blocks of files of all online memory nodes to lack the recovery of block of information, so promptly can take more network latency; And in fact do not need all blocks of files, recover and only need p blocks of files to lack block of information all, therefore, judge between the online memory node of file request node and each and to be connected situation by network whether difference is bigger, if difference is bigger, then the blocks of files of p online memory node of selection optimum lacks the recovery of block of information, if difference is little, then select the blocks of files of p online memory node to lack the recovery of block of information arbitrarily, can realize NLB like this, network latency is minimized.
In addition, after decision node is imperfect, if more than one of the quantity of documents of storing in the distributed system, then exist this moment the quantity of documents of disappearance block of information more than one, for calculating and the memory load balance that respectively remains node in the realization system, can utilize remaining online memory node respectively the file that has disappearance block of information to be recovered, should be the file request node by the responsible online memory node that the file of a certain disappearance block of information is recovered this moment.Damaging preceding distributed system as node has m memory node, is respectively k
0, k
1... k
M-1, be that (l<m/4), then remain node is k to l when losing the node number
l, k
L+1... k
M-1If the number of files that stored this moment is h, be respectively f in system
0, f
1F
H-1The blocks of files of then losing is h * l, owing to need carry out in a large number with exclusive disjunction and need carry out quadratic distribution to h * l the blocks of files that recovers and store in file recovery process,, then utilize remaining k for the calculating and the memory load balance of each node in the realization system
l, k
L+1... k
M-1Individual node, order is recovered the disappearance block of information of h file successively, as k
lTo f
0The block of information of disappearance is recovered k
L+1To f
1The block of information of disappearance is recovered, and the like.During this period, during as if user or system node transmission file requirement request, then the recovering process of this missing documents block of information is forced to be placed on the front end of all the other tasks, the disappearance block of information of this document is at first recovered.
Below with k
lTo f
0The block of information of disappearance reverts to example, enumerates the process of recovering disappearance block of information:
(1) detects file request node k
lBe connected with the network between each online memory node;
(2) calculate recovery file f
0The required minimum blocks of files number p of disappearance block of information, the computational methods of p are identical with the computational methods that file acquisition process second embodiment of distributed adaptive coding and storing method of the present invention enumerates;
(3) judge file request node k
lWhether difference is bigger to be connected situation with network between each online memory node, if difference is bigger, then carry out the network link ordering, each link is sent test packet carry out the data path test and appraisal, select the online memory node that p optimum network connects, with the blocks of files transmission file request node of p optimum online memory node choosing; If difference is little, the blocks of files of then choosing any p online memory node sends file request node k
l
(4) disappearance block of information is obtained in decoding, promptly by the blocks of files of p online memory node the block of information of disappearance is recovered, the pointed decode procedure of its decode procedure and file acquisition process first embodiment of distributed adaptive coding and storing method of the present invention is identical.
More than enumerated memory node k
lTo f
0The method that the block of information of disappearance is recovered, the method that all the other memory nodes recover the block of information that file is lost is identical therewith.
After memory node recovers the file of losing, according to mark and the memory node and the blocks of files of losing, utilize self-adaptive encoding method that the file after recovering is carried out secondary coding (codeword information is identical with the codeword information of encoding first) once more, regain the check block of losing, according to unified file encapsulation format, again encapsulate according to each blocks of files size of losing, can recover the blocks of files of losing again, the blocks of files that will recover again is stored in order at present still on the memory node of activity afterwards.Memory node k for example
lAgain the file f that recovers
0L blocks of files after, equalization is stored in k in order respectively
l, k
L+1... k
2l-1On.
Utilize the above method of introducing, the l that will on this memory node, a restore blocks of files, sequential storage is on l the memory node that with this memory node is starting point.H * the l that is resumed a like this blocks of files will evenly distribute, and be stored in the system still on m-l node of activity.When the memory node of damage is resumed work, the blocks of files that temporarily is stored on all the other nodes will clip on the initiate node, thereby realize the sustainability fault-tolerant ability of file.
More than introduced distributed adaptive coding and storing method; but the present invention is not limited to above embodiment; any technical solution of the present invention that do not break away from is promptly only carried out improvement or the change that those of ordinary skills knew to it, all belongs within protection scope of the present invention.