org.apache.hadoop.hdfs.protocol
Class BlockListAsLongs

java.lang.Object
  extended by org.apache.hadoop.hdfs.protocol.BlockListAsLongs
All Implemented Interfaces:
Iterable<Block>

@InterfaceAudience.Private
@InterfaceStability.Evolving
public class BlockListAsLongs
extends Object
implements Iterable<Block>

This class provides an interface for accessing list of blocks that has been implemented as long[]. This class is useful for block report. Rather than send block reports as a Block[] we can send it as a long[]. The structure of the array is as follows: 0: the length of the finalized replica list; 1: the length of the under-construction replica list; - followed by finalized replica list where each replica is represented by 3 longs: one for the blockId, one for the block length, and one for the generation stamp; - followed by the invalid replica represented with three -1s; - followed by the under-construction replica list where each replica is represented by 4 longs: three for the block id, length, generation stamp, and the forth for the replica state.


Nested Class Summary
 class BlockListAsLongs.BlockReportIterator
          Iterates over blocks in the block report.
 
Constructor Summary
BlockListAsLongs()
           
BlockListAsLongs(List<? extends Block> finalized, List<ReplicaInfo> uc)
          Create block report from finalized and under construction lists of blocks.
BlockListAsLongs(long[] iBlockList)
          Constructor
 
Method Summary
 long getBlockGenStamp(int index)
          Deprecated. 
 long getBlockId(int index)
          Deprecated. 
 long getBlockLen(int index)
          Deprecated. 
 long[] getBlockListAsLongs()
           
 BlockListAsLongs.BlockReportIterator getBlockReportIterator()
          Returns BlockListAsLongs.BlockReportIterator.
 int getNumberOfBlocks()
          The number of blocks
 Iterator<Block> iterator()
          Returns an iterator over blocks in the block report.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BlockListAsLongs

public BlockListAsLongs(List<? extends Block> finalized,
                        List<ReplicaInfo> uc)
Create block report from finalized and under construction lists of blocks.

Parameters:
finalized - - list of finalized blocks
uc - - list of under construction blocks

BlockListAsLongs

public BlockListAsLongs()

BlockListAsLongs

public BlockListAsLongs(long[] iBlockList)
Constructor

Parameters:
iBlockList - - BlockListALongs create from this long[] parameter
Method Detail

getBlockListAsLongs

public long[] getBlockListAsLongs()

iterator

public Iterator<Block> iterator()
Returns an iterator over blocks in the block report.

Specified by:
iterator in interface Iterable<Block>

getBlockReportIterator

public BlockListAsLongs.BlockReportIterator getBlockReportIterator()
Returns BlockListAsLongs.BlockReportIterator.


getNumberOfBlocks

public int getNumberOfBlocks()
The number of blocks

Returns:
- the number of blocks

getBlockId

@Deprecated
public long getBlockId(int index)
Deprecated. 

The block-id of the indexTh block

Parameters:
index - - the block whose block-id is desired
Returns:
the block-id

getBlockLen

@Deprecated
public long getBlockLen(int index)
Deprecated. 

The block-len of the indexTh block

Parameters:
index - - the block whose block-len is desired
Returns:
- the block-len

getBlockGenStamp

@Deprecated
public long getBlockGenStamp(int index)
Deprecated. 

The generation stamp of the indexTh block

Parameters:
index - - the block whose block-len is desired
Returns:
- the generation stamp


Copyright © 2009 The Apache Software Foundation