Revert "HDFS-8712. Remove 'public' and 'abstract' modifiers in FsVolumeSpi and FsDatasetSpi (Contributed by Lei (Eddy) Xu)"

This reverts commit 38ee9247cd.
This commit is contained in:
Vinayakumar B 2015-07-08 16:59:22 +05:30
parent 38ee9247cd
commit 01e12b7d69
3 changed files with 97 additions and 100 deletions

View File

@ -368,9 +368,6 @@ Release 2.8.0 - UNRELEASED
HDFS-8620. Clean up the checkstyle warinings about ClientProtocol. HDFS-8620. Clean up the checkstyle warinings about ClientProtocol.
(Takanobu Asanuma via wheat9) (Takanobu Asanuma via wheat9)
HDFS-8712. Remove 'public' and 'abstracta modifiers in FsVolumeSpi and
FsDatasetSpi (Lei (Eddy) Xu via vinayakumarb)
OPTIMIZATIONS OPTIMIZATIONS
HDFS-8026. Trace FSOutputSummer#writeChecksumChunks rather than HDFS-8026. Trace FSOutputSummer#writeChecksumChunks rather than

View File

@ -72,7 +72,7 @@ public interface FsDatasetSpi<V extends FsVolumeSpi> extends FSDatasetMBean {
/** /**
* A factory for creating {@link FsDatasetSpi} objects. * A factory for creating {@link FsDatasetSpi} objects.
*/ */
abstract class Factory<D extends FsDatasetSpi<?>> { public static abstract class Factory<D extends FsDatasetSpi<?>> {
/** @return the configured factory. */ /** @return the configured factory. */
public static Factory<?> getFactory(Configuration conf) { public static Factory<?> getFactory(Configuration conf) {
@SuppressWarnings("rawtypes") @SuppressWarnings("rawtypes")
@ -182,7 +182,7 @@ public interface FsDatasetSpi<V extends FsVolumeSpi> extends FSDatasetMBean {
* The caller must release the reference of each volume by calling * The caller must release the reference of each volume by calling
* {@link FsVolumeReferences#close()}. * {@link FsVolumeReferences#close()}.
*/ */
FsVolumeReferences getFsVolumeReferences(); public FsVolumeReferences getFsVolumeReferences();
/** /**
* Add a new volume to the FsDataset.<p/> * Add a new volume to the FsDataset.<p/>
@ -193,7 +193,7 @@ public interface FsDatasetSpi<V extends FsVolumeSpi> extends FSDatasetMBean {
* @param location The storage location for the new volume. * @param location The storage location for the new volume.
* @param nsInfos Namespace information for the new volume. * @param nsInfos Namespace information for the new volume.
*/ */
void addVolume( public void addVolume(
final StorageLocation location, final StorageLocation location,
final List<NamespaceInfo> nsInfos) throws IOException; final List<NamespaceInfo> nsInfos) throws IOException;
@ -207,20 +207,20 @@ public interface FsDatasetSpi<V extends FsVolumeSpi> extends FSDatasetMBean {
* @param clearFailure set true to clear the failure information about the * @param clearFailure set true to clear the failure information about the
* volumes. * volumes.
*/ */
void removeVolumes(Set<File> volumes, boolean clearFailure); public void removeVolumes(Set<File> volumes, boolean clearFailure);
/** @return a storage with the given storage ID */ /** @return a storage with the given storage ID */
DatanodeStorage getStorage(final String storageUuid); public DatanodeStorage getStorage(final String storageUuid);
/** @return one or more storage reports for attached volumes. */ /** @return one or more storage reports for attached volumes. */
StorageReport[] getStorageReports(String bpid) public StorageReport[] getStorageReports(String bpid)
throws IOException; throws IOException;
/** @return the volume that contains a replica of the block. */ /** @return the volume that contains a replica of the block. */
V getVolume(ExtendedBlock b); public V getVolume(ExtendedBlock b);
/** @return a volume information map (name => info). */ /** @return a volume information map (name => info). */
Map<String, Object> getVolumeInfoMap(); public Map<String, Object> getVolumeInfoMap();
/** /**
* Returns info about volume failures. * Returns info about volume failures.
@ -230,17 +230,17 @@ public interface FsDatasetSpi<V extends FsVolumeSpi> extends FSDatasetMBean {
VolumeFailureSummary getVolumeFailureSummary(); VolumeFailureSummary getVolumeFailureSummary();
/** @return a list of finalized blocks for the given block pool. */ /** @return a list of finalized blocks for the given block pool. */
List<FinalizedReplica> getFinalizedBlocks(String bpid); public List<FinalizedReplica> getFinalizedBlocks(String bpid);
/** @return a list of finalized blocks for the given block pool. */ /** @return a list of finalized blocks for the given block pool. */
List<FinalizedReplica> getFinalizedBlocksOnPersistentStorage(String bpid); public List<FinalizedReplica> getFinalizedBlocksOnPersistentStorage(String bpid);
/** /**
* Check whether the in-memory block record matches the block on the disk, * Check whether the in-memory block record matches the block on the disk,
* and, in case that they are not matched, update the record or mark it * and, in case that they are not matched, update the record or mark it
* as corrupted. * as corrupted.
*/ */
void checkAndUpdate(String bpid, long blockId, File diskFile, public void checkAndUpdate(String bpid, long blockId, File diskFile,
File diskMetaFile, FsVolumeSpi vol) throws IOException; File diskMetaFile, FsVolumeSpi vol) throws IOException;
/** /**
@ -249,15 +249,15 @@ public interface FsDatasetSpi<V extends FsVolumeSpi> extends FSDatasetMBean {
* otherwise, return null. * otherwise, return null.
* @throws IOException * @throws IOException
*/ */
LengthInputStream getMetaDataInputStream(ExtendedBlock b public LengthInputStream getMetaDataInputStream(ExtendedBlock b
) throws IOException; ) throws IOException;
/** /**
* Returns the specified block's on-disk length (excluding metadata). * Returns the specified block's on-disk length (excluding metadata)
* @return the specified block's on-disk length (excluding metadta) * @return the specified block's on-disk length (excluding metadta)
* @throws IOException on error * @throws IOException on error
*/ */
long getLength(ExtendedBlock b) throws IOException; public long getLength(ExtendedBlock b) throws IOException;
/** /**
* Get reference to the replica meta info in the replicasMap. * Get reference to the replica meta info in the replicasMap.
@ -265,48 +265,47 @@ public interface FsDatasetSpi<V extends FsVolumeSpi> extends FSDatasetMBean {
* @return replica from the replicas map * @return replica from the replicas map
*/ */
@Deprecated @Deprecated
Replica getReplica(String bpid, long blockId); public Replica getReplica(String bpid, long blockId);
/** /**
* @return replica meta information * @return replica meta information
*/ */
String getReplicaString(String bpid, long blockId); public String getReplicaString(String bpid, long blockId);
/** /**
* @return the generation stamp stored with the block. * @return the generation stamp stored with the block.
*/ */
Block getStoredBlock(String bpid, long blkid) throws IOException; public Block getStoredBlock(String bpid, long blkid) throws IOException;
/** /**
* Returns an input stream at specified offset of the specified block. * Returns an input stream at specified offset of the specified block
* @param b block * @param b block
* @param seekOffset offset with in the block to seek to * @param seekOffset offset with in the block to seek to
* @return an input stream to read the contents of the specified block, * @return an input stream to read the contents of the specified block,
* starting at the offset * starting at the offset
* @throws IOException * @throws IOException
*/ */
InputStream getBlockInputStream(ExtendedBlock b, long seekOffset) public InputStream getBlockInputStream(ExtendedBlock b, long seekOffset)
throws IOException; throws IOException;
/** /**
* Returns an input stream at specified offset of the specified block. * Returns an input stream at specified offset of the specified block
* The block is still in the tmp directory and is not finalized * The block is still in the tmp directory and is not finalized
* @return an input stream to read the contents of the specified block, * @return an input stream to read the contents of the specified block,
* starting at the offset * starting at the offset
* @throws IOException * @throws IOException
*/ */
ReplicaInputStreams getTmpInputStreams(ExtendedBlock b, long blkoff, public ReplicaInputStreams getTmpInputStreams(ExtendedBlock b, long blkoff,
long ckoff) throws IOException; long ckoff) throws IOException;
/** /**
* Creates a temporary replica and returns the meta information of the replica * Creates a temporary replica and returns the meta information of the replica
* .
* *
* @param b block * @param b block
* @return the meta info of the replica which is being written to * @return the meta info of the replica which is being written to
* @throws IOException if an error occurs * @throws IOException if an error occurs
*/ */
ReplicaHandler createTemporary(StorageType storageType, public ReplicaHandler createTemporary(StorageType storageType,
ExtendedBlock b) throws IOException; ExtendedBlock b) throws IOException;
/** /**
@ -316,11 +315,11 @@ public interface FsDatasetSpi<V extends FsVolumeSpi> extends FSDatasetMBean {
* @return the meta info of the replica which is being written to * @return the meta info of the replica which is being written to
* @throws IOException if an error occurs * @throws IOException if an error occurs
*/ */
ReplicaHandler createRbw(StorageType storageType, public ReplicaHandler createRbw(StorageType storageType,
ExtendedBlock b, boolean allowLazyPersist) throws IOException; ExtendedBlock b, boolean allowLazyPersist) throws IOException;
/** /**
* Recovers a RBW replica and returns the meta info of the replica. * Recovers a RBW replica and returns the meta info of the replica
* *
* @param b block * @param b block
* @param newGS the new generation stamp for the replica * @param newGS the new generation stamp for the replica
@ -329,7 +328,7 @@ public interface FsDatasetSpi<V extends FsVolumeSpi> extends FSDatasetMBean {
* @return the meta info of the replica which is being written to * @return the meta info of the replica which is being written to
* @throws IOException if an error occurs * @throws IOException if an error occurs
*/ */
ReplicaHandler recoverRbw(ExtendedBlock b, public ReplicaHandler recoverRbw(ExtendedBlock b,
long newGS, long minBytesRcvd, long maxBytesRcvd) throws IOException; long newGS, long minBytesRcvd, long maxBytesRcvd) throws IOException;
/** /**
@ -337,11 +336,11 @@ public interface FsDatasetSpi<V extends FsVolumeSpi> extends FSDatasetMBean {
* @param temporary the temporary replica being converted * @param temporary the temporary replica being converted
* @return the result RBW * @return the result RBW
*/ */
ReplicaInPipelineInterface convertTemporaryToRbw( public ReplicaInPipelineInterface convertTemporaryToRbw(
ExtendedBlock temporary) throws IOException; ExtendedBlock temporary) throws IOException;
/** /**
* Append to a finalized replica and returns the meta info of the replica. * Append to a finalized replica and returns the meta info of the replica
* *
* @param b block * @param b block
* @param newGS the new generation stamp for the replica * @param newGS the new generation stamp for the replica
@ -349,12 +348,12 @@ public interface FsDatasetSpi<V extends FsVolumeSpi> extends FSDatasetMBean {
* @return the meata info of the replica which is being written to * @return the meata info of the replica which is being written to
* @throws IOException * @throws IOException
*/ */
ReplicaHandler append(ExtendedBlock b, long newGS, public ReplicaHandler append(ExtendedBlock b, long newGS,
long expectedBlockLen) throws IOException; long expectedBlockLen) throws IOException;
/** /**
* Recover a failed append to a finalized replica and returns the meta * Recover a failed append to a finalized replica
* info of the replica. * and returns the meta info of the replica
* *
* @param b block * @param b block
* @param newGS the new generation stamp for the replica * @param newGS the new generation stamp for the replica
@ -362,11 +361,11 @@ public interface FsDatasetSpi<V extends FsVolumeSpi> extends FSDatasetMBean {
* @return the meta info of the replica which is being written to * @return the meta info of the replica which is being written to
* @throws IOException * @throws IOException
*/ */
ReplicaHandler recoverAppend( public ReplicaHandler recoverAppend(
ExtendedBlock b, long newGS, long expectedBlockLen) throws IOException; ExtendedBlock b, long newGS, long expectedBlockLen) throws IOException;
/** /**
* Recover a failed pipeline close. * Recover a failed pipeline close
* It bumps the replica's generation stamp and finalize it if RBW replica * It bumps the replica's generation stamp and finalize it if RBW replica
* *
* @param b block * @param b block
@ -375,7 +374,7 @@ public interface FsDatasetSpi<V extends FsVolumeSpi> extends FSDatasetMBean {
* @return the storage uuid of the replica. * @return the storage uuid of the replica.
* @throws IOException * @throws IOException
*/ */
String recoverClose(ExtendedBlock b, long newGS, long expectedBlockLen public String recoverClose(ExtendedBlock b, long newGS, long expectedBlockLen
) throws IOException; ) throws IOException;
/** /**
@ -387,21 +386,21 @@ public interface FsDatasetSpi<V extends FsVolumeSpi> extends FSDatasetMBean {
* block is been finalized. For instance, the block resides on an HDFS volume * block is been finalized. For instance, the block resides on an HDFS volume
* that has been removed. * that has been removed.
*/ */
void finalizeBlock(ExtendedBlock b) throws IOException; public void finalizeBlock(ExtendedBlock b) throws IOException;
/** /**
* Unfinalizes the block previously opened for writing using writeToBlock. * Unfinalizes the block previously opened for writing using writeToBlock.
* The temporary file associated with this block is deleted. * The temporary file associated with this block is deleted.
* @throws IOException * @throws IOException
*/ */
void unfinalizeBlock(ExtendedBlock b) throws IOException; public void unfinalizeBlock(ExtendedBlock b) throws IOException;
/** /**
* Returns one block report per volume. * Returns one block report per volume.
* @param bpid Block Pool Id * @param bpid Block Pool Id
* @return - a map of DatanodeStorage to block report for the volume. * @return - a map of DatanodeStorage to block report for the volume.
*/ */
Map<DatanodeStorage, BlockListAsLongs> getBlockReports(String bpid); public Map<DatanodeStorage, BlockListAsLongs> getBlockReports(String bpid);
/** /**
* Returns the cache report - the full list of cached block IDs of a * Returns the cache report - the full list of cached block IDs of a
@ -409,10 +408,10 @@ public interface FsDatasetSpi<V extends FsVolumeSpi> extends FSDatasetMBean {
* @param bpid Block Pool Id * @param bpid Block Pool Id
* @return the cache report - the full list of cached block IDs. * @return the cache report - the full list of cached block IDs.
*/ */
List<Long> getCacheReport(String bpid); public List<Long> getCacheReport(String bpid);
/** Does the dataset contain the block? */ /** Does the dataset contain the block? */
boolean contains(ExtendedBlock block); public boolean contains(ExtendedBlock block);
/** /**
* Check if a block is valid. * Check if a block is valid.
@ -432,7 +431,7 @@ public interface FsDatasetSpi<V extends FsVolumeSpi> extends FSDatasetMBean {
* *
* @throws IOException May be thrown from the methods called. * @throws IOException May be thrown from the methods called.
*/ */
void checkBlock(ExtendedBlock b, long minLength, ReplicaState state) public void checkBlock(ExtendedBlock b, long minLength, ReplicaState state)
throws ReplicaNotFoundException, UnexpectedReplicaStateException, throws ReplicaNotFoundException, UnexpectedReplicaStateException,
FileNotFoundException, EOFException, IOException; FileNotFoundException, EOFException, IOException;
@ -441,13 +440,13 @@ public interface FsDatasetSpi<V extends FsVolumeSpi> extends FSDatasetMBean {
* Is the block valid? * Is the block valid?
* @return - true if the specified block is valid * @return - true if the specified block is valid
*/ */
boolean isValidBlock(ExtendedBlock b); public boolean isValidBlock(ExtendedBlock b);
/** /**
* Is the block a valid RBW? * Is the block a valid RBW?
* @return - true if the specified block is a valid RBW * @return - true if the specified block is a valid RBW
*/ */
boolean isValidRbw(ExtendedBlock b); public boolean isValidRbw(ExtendedBlock b);
/** /**
* Invalidates the specified blocks * Invalidates the specified blocks
@ -455,21 +454,21 @@ public interface FsDatasetSpi<V extends FsVolumeSpi> extends FSDatasetMBean {
* @param invalidBlks - the blocks to be invalidated * @param invalidBlks - the blocks to be invalidated
* @throws IOException * @throws IOException
*/ */
void invalidate(String bpid, Block invalidBlks[]) throws IOException; public void invalidate(String bpid, Block invalidBlks[]) throws IOException;
/** /**
* Caches the specified blocks * Caches the specified blocks
* @param bpid Block pool id * @param bpid Block pool id
* @param blockIds - block ids to cache * @param blockIds - block ids to cache
*/ */
void cache(String bpid, long[] blockIds); public void cache(String bpid, long[] blockIds);
/** /**
* Uncaches the specified blocks * Uncaches the specified blocks
* @param bpid Block pool id * @param bpid Block pool id
* @param blockIds - blocks ids to uncache * @param blockIds - blocks ids to uncache
*/ */
void uncache(String bpid, long[] blockIds); public void uncache(String bpid, long[] blockIds);
/** /**
* Determine if the specified block is cached. * Determine if the specified block is cached.
@ -477,18 +476,18 @@ public interface FsDatasetSpi<V extends FsVolumeSpi> extends FSDatasetMBean {
* @param blockIds - block id * @param blockIds - block id
* @return true if the block is cached * @return true if the block is cached
*/ */
boolean isCached(String bpid, long blockId); public boolean isCached(String bpid, long blockId);
/** /**
* Check if all the data directories are healthy * Check if all the data directories are healthy
* @return A set of unhealthy data directories. * @return A set of unhealthy data directories.
*/ */
Set<File> checkDataDir(); public Set<File> checkDataDir();
/** /**
* Shutdown the FSDataset * Shutdown the FSDataset
*/ */
void shutdown(); public void shutdown();
/** /**
* Sets the file pointer of the checksum stream so that the last checksum * Sets the file pointer of the checksum stream so that the last checksum
@ -498,7 +497,7 @@ public interface FsDatasetSpi<V extends FsVolumeSpi> extends FSDatasetMBean {
* @param checksumSize number of bytes each checksum has * @param checksumSize number of bytes each checksum has
* @throws IOException * @throws IOException
*/ */
void adjustCrcChannelPosition(ExtendedBlock b, public void adjustCrcChannelPosition(ExtendedBlock b,
ReplicaOutputStreams outs, int checksumSize) throws IOException; ReplicaOutputStreams outs, int checksumSize) throws IOException;
/** /**
@ -506,7 +505,7 @@ public interface FsDatasetSpi<V extends FsVolumeSpi> extends FSDatasetMBean {
* @return true if more than the minimum number of valid volumes are left * @return true if more than the minimum number of valid volumes are left
* in the FSDataSet. * in the FSDataSet.
*/ */
boolean hasEnoughResource(); public boolean hasEnoughResource();
/** /**
* Get visible length of the specified replica. * Get visible length of the specified replica.
@ -518,14 +517,14 @@ public interface FsDatasetSpi<V extends FsVolumeSpi> extends FSDatasetMBean {
* @return actual state of the replica on this data-node or * @return actual state of the replica on this data-node or
* null if data-node does not have the replica. * null if data-node does not have the replica.
*/ */
ReplicaRecoveryInfo initReplicaRecovery(RecoveringBlock rBlock public ReplicaRecoveryInfo initReplicaRecovery(RecoveringBlock rBlock
) throws IOException; ) throws IOException;
/** /**
* Update replica's generation stamp and length and finalize it. * Update replica's generation stamp and length and finalize it.
* @return the ID of storage that stores the block * @return the ID of storage that stores the block
*/ */
String updateReplicaUnderRecovery(ExtendedBlock oldBlock, public String updateReplicaUnderRecovery(ExtendedBlock oldBlock,
long recoveryId, long newBlockId, long newLength) throws IOException; long recoveryId, long newBlockId, long newLength) throws IOException;
/** /**
@ -533,13 +532,13 @@ public interface FsDatasetSpi<V extends FsVolumeSpi> extends FSDatasetMBean {
* @param bpid Block pool Id * @param bpid Block pool Id
* @param conf Configuration * @param conf Configuration
*/ */
void addBlockPool(String bpid, Configuration conf) throws IOException; public void addBlockPool(String bpid, Configuration conf) throws IOException;
/** /**
* Shutdown and remove the block pool from underlying storage. * Shutdown and remove the block pool from underlying storage.
* @param bpid Block pool Id to be removed * @param bpid Block pool Id to be removed
*/ */
void shutdownBlockPool(String bpid) ; public void shutdownBlockPool(String bpid) ;
/** /**
* Deletes the block pool directories. If force is false, directories are * Deletes the block pool directories. If force is false, directories are
@ -552,12 +551,12 @@ public interface FsDatasetSpi<V extends FsVolumeSpi> extends FSDatasetMBean {
* directory for the blockpool is deleted along with its contents. * directory for the blockpool is deleted along with its contents.
* @throws IOException * @throws IOException
*/ */
void deleteBlockPool(String bpid, boolean force) throws IOException; public void deleteBlockPool(String bpid, boolean force) throws IOException;
/** /**
* Get {@link BlockLocalPathInfo} for the given block. * Get {@link BlockLocalPathInfo} for the given block.
*/ */
BlockLocalPathInfo getBlockLocalPathInfo(ExtendedBlock b public BlockLocalPathInfo getBlockLocalPathInfo(ExtendedBlock b
) throws IOException; ) throws IOException;
/** /**
@ -569,7 +568,7 @@ public interface FsDatasetSpi<V extends FsVolumeSpi> extends FSDatasetMBean {
* @return metadata Metadata for the list of blocks * @return metadata Metadata for the list of blocks
* @throws IOException * @throws IOException
*/ */
HdfsBlocksMetadata getHdfsBlocksMetadata(String bpid, public HdfsBlocksMetadata getHdfsBlocksMetadata(String bpid,
long[] blockIds) throws IOException; long[] blockIds) throws IOException;
/** /**
@ -577,51 +576,51 @@ public interface FsDatasetSpi<V extends FsVolumeSpi> extends FSDatasetMBean {
* moved to a separate trash directory instead of being deleted immediately. * moved to a separate trash directory instead of being deleted immediately.
* This can be useful for example during rolling upgrades. * This can be useful for example during rolling upgrades.
*/ */
void enableTrash(String bpid); public void enableTrash(String bpid);
/** /**
* Clear trash * Clear trash
*/ */
void clearTrash(String bpid); public void clearTrash(String bpid);
/** /**
* @return true when trash is enabled * @return true when trash is enabled
*/ */
boolean trashEnabled(String bpid); public boolean trashEnabled(String bpid);
/** /**
* Create a marker file indicating that a rolling upgrade is in progress. * Create a marker file indicating that a rolling upgrade is in progress.
*/ */
void setRollingUpgradeMarker(String bpid) throws IOException; public void setRollingUpgradeMarker(String bpid) throws IOException;
/** /**
* Delete the rolling upgrade marker file if it exists. * Delete the rolling upgrade marker file if it exists.
* @param bpid * @param bpid
*/ */
void clearRollingUpgradeMarker(String bpid) throws IOException; public void clearRollingUpgradeMarker(String bpid) throws IOException;
/** /**
* submit a sync_file_range request to AsyncDiskService. * submit a sync_file_range request to AsyncDiskService
*/ */
void submitBackgroundSyncFileRangeRequest(final ExtendedBlock block, public void submitBackgroundSyncFileRangeRequest(final ExtendedBlock block,
final FileDescriptor fd, final long offset, final long nbytes, final FileDescriptor fd, final long offset, final long nbytes,
final int flags); final int flags);
/** /**
* Callback from RamDiskAsyncLazyPersistService upon async lazy persist task end * Callback from RamDiskAsyncLazyPersistService upon async lazy persist task end
*/ */
void onCompleteLazyPersist(String bpId, long blockId, public void onCompleteLazyPersist(String bpId, long blockId,
long creationTime, File[] savedFiles, V targetVolume); long creationTime, File[] savedFiles, V targetVolume);
/** /**
* Callback from RamDiskAsyncLazyPersistService upon async lazy persist task fail * Callback from RamDiskAsyncLazyPersistService upon async lazy persist task fail
*/ */
void onFailLazyPersist(String bpId, long blockId); public void onFailLazyPersist(String bpId, long blockId);
/** /**
* Move block from one storage to another storage * Move block from one storage to another storage
*/ */
ReplicaInfo moveBlockAcrossStorage(final ExtendedBlock block, public ReplicaInfo moveBlockAcrossStorage(final ExtendedBlock block,
StorageType targetStorageType) throws IOException; StorageType targetStorageType) throws IOException;
/** /**
@ -630,15 +629,15 @@ public interface FsDatasetSpi<V extends FsVolumeSpi> extends FSDatasetMBean {
* *
* It is a no-op when dfs.datanode.block-pinning.enabled is set to false. * It is a no-op when dfs.datanode.block-pinning.enabled is set to false.
*/ */
void setPinning(ExtendedBlock block) throws IOException; public void setPinning(ExtendedBlock block) throws IOException;
/** /**
* Check whether the block was pinned * Check whether the block was pinned
*/ */
boolean getPinning(ExtendedBlock block) throws IOException; public boolean getPinning(ExtendedBlock block) throws IOException;
/** /**
* Confirm whether the block is deleting * Confirm whether the block is deleting
*/ */
boolean isDeletingBlock(String bpid, long blockId); public boolean isDeletingBlock(String bpid, long blockId);
} }

View File

@ -39,35 +39,35 @@ public interface FsVolumeSpi {
FsVolumeReference obtainReference() throws ClosedChannelException; FsVolumeReference obtainReference() throws ClosedChannelException;
/** @return the StorageUuid of the volume */ /** @return the StorageUuid of the volume */
String getStorageID(); public String getStorageID();
/** @return a list of block pools. */ /** @return a list of block pools. */
String[] getBlockPoolList(); public String[] getBlockPoolList();
/** @return the available storage space in bytes. */ /** @return the available storage space in bytes. */
long getAvailable() throws IOException; public long getAvailable() throws IOException;
/** @return the base path to the volume */ /** @return the base path to the volume */
String getBasePath(); public String getBasePath();
/** @return the path to the volume */ /** @return the path to the volume */
String getPath(String bpid) throws IOException; public String getPath(String bpid) throws IOException;
/** @return the directory for the finalized blocks in the block pool. */ /** @return the directory for the finalized blocks in the block pool. */
File getFinalizedDir(String bpid) throws IOException; public File getFinalizedDir(String bpid) throws IOException;
StorageType getStorageType(); public StorageType getStorageType();
/** /**
* Reserve disk space for an RBW block so a writer does not run out of * Reserve disk space for an RBW block so a writer does not run out of
* space before the block is full. * space before the block is full.
*/ */
void reserveSpaceForRbw(long bytesToReserve); public void reserveSpaceForRbw(long bytesToReserve);
/** /**
* Release disk space previously reserved for RBW block. * Release disk space previously reserved for RBW block.
*/ */
void releaseReservedSpace(long bytesToRelease); public void releaseReservedSpace(long bytesToRelease);
/** Returns true if the volume is NOT backed by persistent storage. */ /** Returns true if the volume is NOT backed by persistent storage. */
public boolean isTransientStorage(); public boolean isTransientStorage();
@ -78,7 +78,7 @@ public interface FsVolumeSpi {
* bytesToRelease will be rounded down to the OS page size since locked * bytesToRelease will be rounded down to the OS page size since locked
* memory reservation must always be a multiple of the page size. * memory reservation must always be a multiple of the page size.
*/ */
void releaseLockedMemory(long bytesToRelease); public void releaseLockedMemory(long bytesToRelease);
/** /**
* BlockIterator will return ExtendedBlock entries from a block pool in * BlockIterator will return ExtendedBlock entries from a block pool in
@ -90,7 +90,7 @@ public interface FsVolumeSpi {
* *
* Closing the iterator does not save it. You must call save to save it. * Closing the iterator does not save it. You must call save to save it.
*/ */
interface BlockIterator extends Closeable { public interface BlockIterator extends Closeable {
/** /**
* Get the next block.<p/> * Get the next block.<p/>
* *
@ -107,17 +107,17 @@ public interface FsVolumeSpi {
* this volume. In this case, EOF will be set on * this volume. In this case, EOF will be set on
* the iterator. * the iterator.
*/ */
ExtendedBlock nextBlock() throws IOException; public ExtendedBlock nextBlock() throws IOException;
/** /**
* Returns true if we got to the end of the block pool. * Returns true if we got to the end of the block pool.
*/ */
boolean atEnd(); public boolean atEnd();
/** /**
* Repositions the iterator at the beginning of the block pool. * Repositions the iterator at the beginning of the block pool.
*/ */
void rewind(); public void rewind();
/** /**
* Save this block iterator to the underlying volume. * Save this block iterator to the underlying volume.
@ -127,7 +127,7 @@ public interface FsVolumeSpi {
* @throws IOException If there was an error when saving the block * @throws IOException If there was an error when saving the block
* iterator. * iterator.
*/ */
void save() throws IOException; public void save() throws IOException;
/** /**
* Set the maximum staleness of entries that we will return.<p/> * Set the maximum staleness of entries that we will return.<p/>
@ -138,25 +138,25 @@ public interface FsVolumeSpi {
* to 0, consumers of this API must handle race conditions where block * to 0, consumers of this API must handle race conditions where block
* disappear before they can be processed. * disappear before they can be processed.
*/ */
void setMaxStalenessMs(long maxStalenessMs); public void setMaxStalenessMs(long maxStalenessMs);
/** /**
* Get the wall-clock time, measured in milliseconds since the Epoch, * Get the wall-clock time, measured in milliseconds since the Epoch,
* when this iterator was created. * when this iterator was created.
*/ */
long getIterStartMs(); public long getIterStartMs();
/** /**
* Get the wall-clock time, measured in milliseconds since the Epoch, * Get the wall-clock time, measured in milliseconds since the Epoch,
* when this iterator was last saved. Returns iterStartMs if the * when this iterator was last saved. Returns iterStartMs if the
* iterator was never saved. * iterator was never saved.
*/ */
long getLastSavedMs(); public long getLastSavedMs();
/** /**
* Get the id of the block pool which this iterator traverses. * Get the id of the block pool which this iterator traverses.
*/ */
String getBlockPoolId(); public String getBlockPoolId();
} }
/** /**
@ -168,7 +168,7 @@ public interface FsVolumeSpi {
* *
* @return The new block iterator. * @return The new block iterator.
*/ */
BlockIterator newBlockIterator(String bpid, String name); public BlockIterator newBlockIterator(String bpid, String name);
/** /**
* Load a saved block iterator. * Load a saved block iterator.
@ -180,10 +180,11 @@ public interface FsVolumeSpi {
* @throws IOException If there was an IO error loading the saved * @throws IOException If there was an IO error loading the saved
* block iterator. * block iterator.
*/ */
BlockIterator loadBlockIterator(String bpid, String name) throws IOException; public BlockIterator loadBlockIterator(String bpid, String name)
throws IOException;
/** /**
* Get the FSDatasetSpi which this volume is a part of. * Get the FSDatasetSpi which this volume is a part of.
*/ */
FsDatasetSpi getDataset(); public FsDatasetSpi getDataset();
} }