Interface Context
- All Known Implementing Classes:
ExternalSPSContext
@Private
@Evolving
public interface Context
An interface for the communication between SPS and Namenode module.
-
Method Summary
Modifier and TypeMethodDescriptionorg.apache.hadoop.hdfs.protocol.HdfsFileStatusgetFileInfo(long file) Get the file info for a specific file.org.apache.hadoop.hdfs.server.protocol.DatanodeStorageReport[]Returns all the live datanodes and its storage details.org.apache.hadoop.net.NetworkTopologygetNetworkTopology(StoragePolicySatisfier.DatanodeMap datanodeMap) Gets the network topology.intGets the number of live datanodes in the cluster.org.apache.hadoop.hdfs.protocol.BlockStoragePolicygetStoragePolicy(byte policyId) Gets the storage policy details for the given policy ID.booleanisFileExist(long filePath) Returns true if the give file exists in the Namespace.booleanReturns true if the Namenode in safe mode, false otherwise.booleanReturns true if the SPS is running, false otherwise.voidnotifyMovementTriedBlocks(org.apache.hadoop.hdfs.protocol.Block[] moveAttemptFinishedBlks) This can be used to notify to the SPS about block movement attempt finished.voidremoveSPSHint(long spsPath) Remove the hint which was added to track SPS call.voidscanAndCollectFiles(long filePath) Do scan and collects the files under that directory and adds to the given BlockStorageMovementNeeded.voidsubmitMoveTask(BlockStorageMovementCommand.BlockMovingInfo blkMovingInfo) Handles the block move tasks.
-
Method Details
-
isRunning
boolean isRunning()Returns true if the SPS is running, false otherwise. -
isInSafeMode
boolean isInSafeMode()Returns true if the Namenode in safe mode, false otherwise. -
getNetworkTopology
org.apache.hadoop.net.NetworkTopology getNetworkTopology(StoragePolicySatisfier.DatanodeMap datanodeMap) Gets the network topology.- Parameters:
datanodeMap- target datanodes- Returns:
- network topology
-
isFileExist
boolean isFileExist(long filePath) Returns true if the give file exists in the Namespace.- Parameters:
filePath- - file info- Returns:
- true if the given file exists, false otherwise.
-
getStoragePolicy
org.apache.hadoop.hdfs.protocol.BlockStoragePolicy getStoragePolicy(byte policyId) Gets the storage policy details for the given policy ID.- Parameters:
policyId- - Storage policy ID- Returns:
- the detailed policy object
-
removeSPSHint
Remove the hint which was added to track SPS call.- Parameters:
spsPath- - user invoked satisfier path- Throws:
IOException
-
getNumLiveDataNodes
int getNumLiveDataNodes()Gets the number of live datanodes in the cluster.- Returns:
- number of live datanodes
-
getFileInfo
Get the file info for a specific file.- Parameters:
file- file path- Returns:
- file status metadata information
- Throws:
IOException
-
getLiveDatanodeStorageReport
org.apache.hadoop.hdfs.server.protocol.DatanodeStorageReport[] getLiveDatanodeStorageReport() throws IOExceptionReturns all the live datanodes and its storage details.- Throws:
IOException
-
getNextSPSPath
Long getNextSPSPath()- Returns:
- next SPS path info to process.
-
scanAndCollectFiles
Do scan and collects the files under that directory and adds to the given BlockStorageMovementNeeded.- Parameters:
filePath- file path- Throws:
IOExceptionInterruptedException
-
submitMoveTask
Handles the block move tasks. BlockMovingInfo must contain the required info to move the block, that source location, destination location and storage types.- Throws:
IOException
-
notifyMovementTriedBlocks
void notifyMovementTriedBlocks(org.apache.hadoop.hdfs.protocol.Block[] moveAttemptFinishedBlks) This can be used to notify to the SPS about block movement attempt finished. Then SPS will re-check whether it needs retry or not.- Parameters:
moveAttemptFinishedBlks- list of movement attempt finished blocks
-