org.apache.hadoop.fs
Class BlockLocation

java.lang.Object
  extended by org.apache.hadoop.fs.BlockLocation
Direct Known Subclasses:
BlockStorageLocation

@InterfaceAudience.Public
@InterfaceStability.Stable
public class BlockLocation
extends Object

Represents the network location of a block, information about the hosts that contain block replicas, and other block metadata (E.g. the file offset associated with the block, length, whether it is corrupt, etc).


Constructor Summary
BlockLocation()
          Default Constructor
BlockLocation(BlockLocation that)
          Copy constructor
BlockLocation(String[] names, String[] hosts, long offset, long length)
          Constructor with host, name, offset and length
BlockLocation(String[] names, String[] hosts, long offset, long length, boolean corrupt)
          Constructor with host, name, offset, length and corrupt flag
BlockLocation(String[] names, String[] hosts, String[] topologyPaths, long offset, long length)
          Constructor with host, name, network topology, offset and length
BlockLocation(String[] names, String[] hosts, String[] topologyPaths, long offset, long length, boolean corrupt)
          Constructor with host, name, network topology, offset, length and corrupt flag
BlockLocation(String[] names, String[] hosts, String[] cachedHosts, String[] topologyPaths, long offset, long length, boolean corrupt)
           
 
Method Summary
 String[] getCachedHosts()
          Get the list of hosts (hostname) hosting a cached replica of the block
 String[] getHosts()
          Get the list of hosts (hostname) hosting this block
 long getLength()
          Get the length of the block
 String[] getNames()
          Get the list of names (IP:xferPort) hosting this block
 long getOffset()
          Get the start offset of file associated with this block
 String[] getTopologyPaths()
          Get the list of network topology paths for each of the hosts.
 boolean isCorrupt()
          Get the corrupt flag.
 void setCachedHosts(String[] cachedHosts)
          Set the hosts hosting a cached replica of this block
 void setCorrupt(boolean corrupt)
          Set the corrupt flag.
 void setHosts(String[] hosts)
          Set the hosts hosting this block
 void setLength(long length)
          Set the length of block
 void setNames(String[] names)
          Set the names (host:port) hosting this block
 void setOffset(long offset)
          Set the start offset of file associated with this block
 void setTopologyPaths(String[] topologyPaths)
          Set the network topology paths of the hosts
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

BlockLocation

public BlockLocation()
Default Constructor


BlockLocation

public BlockLocation(BlockLocation that)
Copy constructor


BlockLocation

public BlockLocation(String[] names,
                     String[] hosts,
                     long offset,
                     long length)
Constructor with host, name, offset and length


BlockLocation

public BlockLocation(String[] names,
                     String[] hosts,
                     long offset,
                     long length,
                     boolean corrupt)
Constructor with host, name, offset, length and corrupt flag


BlockLocation

public BlockLocation(String[] names,
                     String[] hosts,
                     String[] topologyPaths,
                     long offset,
                     long length)
Constructor with host, name, network topology, offset and length


BlockLocation

public BlockLocation(String[] names,
                     String[] hosts,
                     String[] topologyPaths,
                     long offset,
                     long length,
                     boolean corrupt)
Constructor with host, name, network topology, offset, length and corrupt flag


BlockLocation

public BlockLocation(String[] names,
                     String[] hosts,
                     String[] cachedHosts,
                     String[] topologyPaths,
                     long offset,
                     long length,
                     boolean corrupt)
Method Detail

getHosts

public String[] getHosts()
                  throws IOException
Get the list of hosts (hostname) hosting this block

Throws:
IOException

getCachedHosts

public String[] getCachedHosts()
Get the list of hosts (hostname) hosting a cached replica of the block


getNames

public String[] getNames()
                  throws IOException
Get the list of names (IP:xferPort) hosting this block

Throws:
IOException

getTopologyPaths

public String[] getTopologyPaths()
                          throws IOException
Get the list of network topology paths for each of the hosts. The last component of the path is the "name" (IP:xferPort).

Throws:
IOException

getOffset

public long getOffset()
Get the start offset of file associated with this block


getLength

public long getLength()
Get the length of the block


isCorrupt

public boolean isCorrupt()
Get the corrupt flag.


setOffset

public void setOffset(long offset)
Set the start offset of file associated with this block


setLength

public void setLength(long length)
Set the length of block


setCorrupt

public void setCorrupt(boolean corrupt)
Set the corrupt flag.


setHosts

public void setHosts(String[] hosts)
              throws IOException
Set the hosts hosting this block

Throws:
IOException

setCachedHosts

public void setCachedHosts(String[] cachedHosts)
Set the hosts hosting a cached replica of this block


setNames

public void setNames(String[] names)
              throws IOException
Set the names (host:port) hosting this block

Throws:
IOException

setTopologyPaths

public void setTopologyPaths(String[] topologyPaths)
                      throws IOException
Set the network topology paths of the hosts

Throws:
IOException

toString

public String toString()
Overrides:
toString in class Object


Copyright © 2014 Apache Software Foundation. All Rights Reserved.