Demo entry 6720844

算法1 串行降级读Sequential Reconstruction Read

   

Submitted by anonymous on Mar 19, 2018 at 03:10
Language: C++. Code size: 635 Bytes.

Input: The total number k of DataNodes involved, and the current DataNodes identifier id.  
Output: The DRFS client receives the recovered data block.  
1.	alloc one buffer buf  
2.	// 未丢失数据块的节点读数据块并发送到根节点  
3.	if (id != root) then  
4.	    read the block from the disk to buf  
5.	    send buf to root;  
6.	end if  
7.	  
8.	// 根节点接收数据并负责计算丢失数据块  
9.	if (id == root) then  
10.	    result := 0  
11.	    for i := 0 to k do  
12.	        receiver buf from other nodes     
13.	        buf := buf XOR result  
14.	    end for  
15.	    // 根节点将恢复的数据块发送回请求数据的客户端  
16.	    send buf to the DRFS client   
17.	end if  

This snippet took 0.01 seconds to highlight.

Back to the Entry List or Home.

Delete this entry (admin only).