Package org.apache.hadoop.fs
Class Trash
java.lang.Object
org.apache.hadoop.conf.Configured
org.apache.hadoop.fs.Trash
- All Implemented Interfaces:
Configurable
Provides a trash facility which supports pluggable Trash policies.
See the implementation of the configured TrashPolicy for more
details.
-
Constructor Summary
ConstructorsConstructorDescriptionTrash(Configuration conf) Construct a trash can accessor.Trash(FileSystem fs, Configuration conf) Construct a trash can accessor for the FileSystem provided. -
Method Summary
Modifier and TypeMethodDescriptionvoidCreate a trash checkpoint.voidexpunge()Delete old checkpoint(s).voidDelete all trash immediately.getCurrentTrashDir(Path path) Return aRunnablethat periodically empties the trash of all users, intended to be run by the superuser.booleanReturns whether the trash is enabled for this filesystem.static booleanmoveToAppropriateTrash(FileSystem fs, Path p, Configuration conf) In case of the symlinks or mount points, one has to move the appropriate trashbin in the actual volume of the path p being deleted.booleanmoveToTrash(Path path) Move a file or directory to the current trash directory.Methods inherited from class org.apache.hadoop.conf.Configured
getConf, setConf
-
Constructor Details
-
Trash
Construct a trash can accessor.- Parameters:
conf- a Configuration- Throws:
IOException- raised on errors performing I/O.
-
Trash
Construct a trash can accessor for the FileSystem provided.- Parameters:
fs- the FileSystemconf- a Configuration- Throws:
IOException- raised on errors performing I/O.
-
-
Method Details
-
moveToAppropriateTrash
public static boolean moveToAppropriateTrash(FileSystem fs, Path p, Configuration conf) throws IOException In case of the symlinks or mount points, one has to move the appropriate trashbin in the actual volume of the path p being deleted. Hence we get the file system of the fully-qualified resolved-path and then move the path p to the trashbin in that volume,- Parameters:
fs- - the filesystem of path pp- - the path being deleted - to be moved to trashconf- - configuration- Returns:
- false if the item is already in the trash or trash is disabled
- Throws:
IOException- on error
-
isEnabled
public boolean isEnabled()Returns whether the trash is enabled for this filesystem.- Returns:
- return if isEnabled true,not false.
-
moveToTrash
Move a file or directory to the current trash directory.- Parameters:
path- the path.- Returns:
- false if the item is already in the trash or trash is disabled
- Throws:
IOException- raised on errors performing I/O.
-
checkpoint
Create a trash checkpoint.- Throws:
IOException- raised on errors performing I/O.
-
expunge
Delete old checkpoint(s).- Throws:
IOException- raised on errors performing I/O.
-
expungeImmediately
Delete all trash immediately.- Throws:
IOException- raised on errors performing I/O.
-
getEmptier
Return aRunnablethat periodically empties the trash of all users, intended to be run by the superuser.- Returns:
- Runnable.
- Throws:
IOException- on raised on errors performing I/O.
-
getCurrentTrashDir
- Throws:
IOException
-