SafeModeThe SafeMode interface provides a way to perform safe mode actions and obtain the status after such actions performed to the FileSystem.
This is admin only interface, should be implemented accordingly when necessary to Filesystem that support safe mode, e.g. DistributedFileSystem (HDFS) and ViewDistributedFileSystem.
public interface SafeMode {
default boolean setSafeMode(SafeModeAction action) throws IOException {
return setSafeMode(action, false);
}
boolean setSafeMode(SafeModeAction action, boolean isChecked) throws IOException;
}
The goals of this interface is allow any file system implementation to share the same concept of safe mode with the following actions and states
GET, get the safe mode status of the file system.ENTER, enter the safe mode for the file system.LEAVE, exit safe mode for the file system gracefully.FORCE_EXIT, exit safe mode for the file system even if there is any ongoing data process.GET, LEAVE, FORCE_EXIT.