public interface FSDatasetInterface extends FSDatasetMBean
限定符和类型 | 接口和说明 |
---|---|
static class |
FSDatasetInterface.BlockInputStreams
This class contains the input streams for the data and checksum
of a block
|
static class |
FSDatasetInterface.BlockWriteStreams
This class contains the output streams for the data and checksum
of a block
|
static class |
FSDatasetInterface.MetaDataInputStream
This class provides the input stream and length of the metadata
of a block
|
限定符和类型 | 方法和说明 |
---|---|
void |
checkDataDir()
Check if all the data directories are healthy
|
void |
finalizeBlock(Block b)
Finalizes the block previously opened for writing using writeToBlock.
|
void |
finalizeBlockIfNeeded(Block b)
Finalizes the block previously opened for writing using writeToBlock
if not already finalized
|
InputStream |
getBlockInputStream(Block b)
Returns an input stream to read the contents of the specified block
|
InputStream |
getBlockInputStream(Block b,
long seekOffset)
Returns an input stream at specified offset of the specified block
|
BlockLocalPathInfo |
getBlockLocalPathInfo(Block b)
Get
BlockLocalPathInfo for the given block. |
Block[] |
getBlockReport()
Returns the block report - the full list of blocks stored
Returns only finalized blocks
|
Block[] |
getBlocksBeingWrittenReport()
Returns the blocks being written report
|
long |
getChannelPosition(Block b,
FSDatasetInterface.BlockWriteStreams stream)
Returns the current offset in the data stream.
|
long |
getLength(Block b)
Returns the specified block's on-disk length (excluding metadata)
|
FSDatasetInterface.MetaDataInputStream |
getMetaDataInputStream(Block b)
Returns metaData of block b as an input stream (and its length)
|
long |
getMetaDataLength(Block b)
Returns the length of the metadata file of the specified block
|
Block |
getStoredBlock(long blkid) |
FSDatasetInterface.BlockInputStreams |
getTmpInputStreams(Block b,
long blkoff,
long ckoff)
Returns an input stream at specified offset of the specified block
The block is still in the tmp directory and is not finalized
|
long |
getVisibleLength(Block b)
Returns the specified block's visible length (has metadata for this)
|
boolean |
hasEnoughResource()
checks how many valid storage volumes are there in the DataNode
|
void |
invalidate(Block[] invalidBlks)
Invalidates the specified blocks
|
boolean |
isAsyncBlockReportReady() |
boolean |
isValidBlock(Block b)
Is the block valid?
|
boolean |
metaFileExists(Block b)
Does the meta file exist for this block?
|
void |
requestAsyncBlockReport()
Request that a block report be prepared.
|
Block[] |
retrieveAsyncBlockReport()
Retrieve an asynchronously prepared block report.
|
void |
setChannelPosition(Block b,
FSDatasetInterface.BlockWriteStreams stream,
long dataOffset,
long ckOffset)
Sets the file pointer of the data stream and checksum stream to
the specified values.
|
void |
setVisibleLength(Block b,
long length)
update the specified blocks visible meta data.
|
void |
shutdown()
Shutdown the FSDataset
|
BlockRecoveryInfo |
startBlockRecovery(long blockId) |
String |
toString()
Stringifies the name of the storage
|
void |
unfinalizeBlock(Block b)
Unfinalizes the block previously opened for writing using writeToBlock.
|
void |
updateBlock(Block oldblock,
Block newblock)
Update the block to the new generation stamp and length.
|
void |
validateBlockMetadata(Block b)
Validate that the contents in the Block matches
the file on disk.
|
FSDatasetInterface.BlockWriteStreams |
writeToBlock(Block b,
boolean isRecovery,
boolean isReplicationRequest)
Creates the block and returns output streams to write data and CRC
|
getCapacity, getDfsUsed, getRemaining, getStorageInfo
long getMetaDataLength(Block b) throws IOException
b
- - the block for which the metadata length is desiredIOException
FSDatasetInterface.MetaDataInputStream getMetaDataInputStream(Block b) throws IOException
b
- - the blockIOException
boolean metaFileExists(Block b) throws IOException
b
- - the blockIOException
long getLength(Block b) throws IOException
b
- IOException
long getVisibleLength(Block b) throws IOException
b
- IOException
void setVisibleLength(Block b, long length) throws IOException
b
- block to update the length forlength
- value to set visible length toIOException
- if the block is not in ongoingCreatesBlock getStoredBlock(long blkid) throws IOException
IOException
InputStream getBlockInputStream(Block b) throws IOException
b
- IOException
InputStream getBlockInputStream(Block b, long seekOffset) throws IOException
b
- seekOffset
- IOException
FSDatasetInterface.BlockInputStreams getTmpInputStreams(Block b, long blkoff, long ckoff) throws IOException
b
- blkoff
- ckoff
- IOException
FSDatasetInterface.BlockWriteStreams writeToBlock(Block b, boolean isRecovery, boolean isReplicationRequest) throws IOException
b
- isRecovery
- True if this is part of error recovery, otherwise falseisReplicationRequest
- True if this is part of block replication requestIOException
void updateBlock(Block oldblock, Block newblock) throws IOException
IOException
void finalizeBlock(Block b) throws IOException
b
- IOException
void finalizeBlockIfNeeded(Block b) throws IOException
b
- IOException
void unfinalizeBlock(Block b) throws IOException
b
- IOException
Block[] getBlockReport()
void requestAsyncBlockReport()
boolean isAsyncBlockReportReady()
Block[] retrieveAsyncBlockReport()
requestAsyncBlockReport()
, and then poll
isAsyncBlockReportReady()
until it returns true.
Retrieving the asynchronous block report also resets it; a new
one must be prepared before this method may be called again.IllegalStateException
- if an async report is not readyBlock[] getBlocksBeingWrittenReport()
boolean isValidBlock(Block b)
b
- void invalidate(Block[] invalidBlks) throws IOException
invalidBlks
- - the blocks to be invalidatedIOException
void checkDataDir() throws DiskChecker.DiskErrorException
void shutdown()
long getChannelPosition(Block b, FSDatasetInterface.BlockWriteStreams stream) throws IOException
b
- stream
- The stream to the data file and checksum fileIOException
void setChannelPosition(Block b, FSDatasetInterface.BlockWriteStreams stream, long dataOffset, long ckOffset) throws IOException
b
- stream
- The stream for the data file and checksum filedataOffset
- The position to which the file pointre for the data stream
should be setckOffset
- The position to which the file pointre for the checksum stream
should be setIOException
void validateBlockMetadata(Block b) throws IOException
b
- The block to be verified.IOException
boolean hasEnoughResource()
BlockRecoveryInfo startBlockRecovery(long blockId) throws IOException
IOException
BlockLocalPathInfo getBlockLocalPathInfo(Block b) throws IOException
BlockLocalPathInfo
for the given block.IOException
Copyright © 2009 The Apache Software Foundation