org.apache.hadoop.hdfs.server.protocol
Class BlockCommand

java.lang.Object
  extended by org.apache.hadoop.hdfs.server.protocol.ServerCommand
      extended by org.apache.hadoop.hdfs.server.protocol.DatanodeCommand
          extended by org.apache.hadoop.hdfs.server.protocol.BlockCommand
All Implemented Interfaces:
org.apache.hadoop.io.Writable

@InterfaceAudience.Private
@InterfaceStability.Evolving
public class BlockCommand
extends DatanodeCommand

A BlockCommand is an instruction to a datanode regarding some blocks under its control. It tells the DataNode to either invalidate a set of indicated blocks, or to copy a set of indicated blocks to another DataNode.


Field Summary
 
Fields inherited from class org.apache.hadoop.hdfs.server.protocol.DatanodeCommand
FINALIZE, REGISTER
 
Constructor Summary
BlockCommand()
           
BlockCommand(int action, Block[] blocks)
          Create BlockCommand for the given action
BlockCommand(int action, List<DatanodeDescriptor.BlockTargetPair> blocktargetlist)
          Create BlockCommand for transferring blocks to another datanode
 
Method Summary
 Block[] getBlocks()
           
 DatanodeInfo[][] getTargets()
           
 void readFields(DataInput in)
           
 void write(DataOutput out)
           
 
Methods inherited from class org.apache.hadoop.hdfs.server.protocol.ServerCommand
getAction
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BlockCommand

public BlockCommand()

BlockCommand

public BlockCommand(int action,
                    List<DatanodeDescriptor.BlockTargetPair> blocktargetlist)
Create BlockCommand for transferring blocks to another datanode

Parameters:
blocktargetlist - blocks to be transferred

BlockCommand

public BlockCommand(int action,
                    Block[] blocks)
Create BlockCommand for the given action

Parameters:
blocks - blocks related to the action
Method Detail

getBlocks

public Block[] getBlocks()

getTargets

public DatanodeInfo[][] getTargets()

write

public void write(DataOutput out)
           throws IOException
Specified by:
write in interface org.apache.hadoop.io.Writable
Overrides:
write in class ServerCommand
Throws:
IOException

readFields

public void readFields(DataInput in)
                throws IOException
Specified by:
readFields in interface org.apache.hadoop.io.Writable
Overrides:
readFields in class ServerCommand
Throws:
IOException


Copyright © 2009 The Apache Software Foundation