org.apache.hadoop.hdfs.protocol
Class Block
java.lang.Object
org.apache.hadoop.hdfs.protocol.Block
- All Implemented Interfaces:
- Comparable<Block>, org.apache.hadoop.io.Writable
- Direct Known Subclasses:
- ReplicaInfo, ReplicaRecoveryInfo
@InterfaceAudience.Private
@InterfaceStability.Evolving
public class Block
- extends Object
- implements org.apache.hadoop.io.Writable, Comparable<Block>
A Block is a Hadoop FS primitive, identified by a
long.
Constructor Summary |
Block()
|
Block(Block blk)
|
Block(File f,
long len,
long genstamp)
Find the blockid from the given filename |
Block(long blkid)
|
Block(long blkid,
long len,
long generationStamp)
|
BLOCK_FILE_PREFIX
public static final String BLOCK_FILE_PREFIX
- See Also:
- Constant Field Values
METADATA_EXTENSION
public static final String METADATA_EXTENSION
- See Also:
- Constant Field Values
blockFilePattern
public static final Pattern blockFilePattern
metaFilePattern
public static final Pattern metaFilePattern
Block
public Block()
Block
public Block(long blkid,
long len,
long generationStamp)
Block
public Block(long blkid)
Block
public Block(Block blk)
Block
public Block(File f,
long len,
long genstamp)
- Find the blockid from the given filename
isBlockFilename
public static boolean isBlockFilename(File f)
filename2id
public static long filename2id(String name)
isMetaFilename
public static boolean isMetaFilename(String name)
getGenerationStamp
public static long getGenerationStamp(String metaFile)
- Get generation stamp from the name of the metafile name
getBlockId
public static long getBlockId(String metaFile)
- Get the blockId from the name of the metafile name
set
public void set(long blkid,
long len,
long genStamp)
getBlockId
public long getBlockId()
setBlockId
public void setBlockId(long bid)
getBlockName
public String getBlockName()
getNumBytes
public long getNumBytes()
setNumBytes
public void setNumBytes(long len)
getGenerationStamp
public long getGenerationStamp()
setGenerationStamp
public void setGenerationStamp(long stamp)
toString
public String toString()
- Overrides:
toString
in class Object
write
public void write(DataOutput out)
throws IOException
- Specified by:
write
in interface org.apache.hadoop.io.Writable
- Throws:
IOException
readFields
public void readFields(DataInput in)
throws IOException
- Specified by:
readFields
in interface org.apache.hadoop.io.Writable
- Throws:
IOException
compareTo
public int compareTo(Block b)
- Specified by:
compareTo
in interface Comparable<Block>
equals
public boolean equals(Object o)
- Overrides:
equals
in class Object
hashCode
public int hashCode()
- Overrides:
hashCode
in class Object
Copyright © 2009 The Apache Software Foundation