@InterfaceAudience.Public @InterfaceStability.Evolving public abstract class TrashPolicy extends Configured
Modifier and Type | Field and Description |
---|---|
protected long |
deletionInterval |
protected FileSystem |
fs |
protected Path |
trash |
Constructor and Description |
---|
TrashPolicy() |
Modifier and Type | Method and Description |
---|---|
abstract void |
createCheckpoint()
Create a trash checkpoint.
|
abstract void |
deleteCheckpoint()
Delete old trash checkpoint(s).
|
abstract void |
deleteCheckpointsImmediately()
Delete all checkpoints immediately, ie empty trash.
|
abstract Path |
getCurrentTrashDir()
Get the current working directory of the Trash Policy
This API does not work with files deleted from encryption zone when HDFS
data encryption at rest feature is enabled as rename file between
encryption zones or encryption zone and non-encryption zone is not allowed.
|
Path |
getCurrentTrashDir(Path path)
Get the current trash directory for path specified based on the Trash
Policy
|
abstract Runnable |
getEmptier()
Return a
Runnable that periodically empties the trash of all
users, intended to be run by the superuser. |
static TrashPolicy |
getInstance(Configuration conf,
FileSystem fs)
Get an instance of the configured TrashPolicy based on the value
of the configuration parameter fs.trash.classname.
|
static TrashPolicy |
getInstance(Configuration conf,
FileSystem fs,
Path home)
Deprecated.
Use
getInstance(Configuration, FileSystem) instead. |
void |
initialize(Configuration conf,
FileSystem fs)
Used to setup the trash policy.
|
abstract void |
initialize(Configuration conf,
FileSystem fs,
Path home)
Deprecated.
Use
initialize(Configuration, FileSystem) instead. |
abstract boolean |
isEnabled()
Returns whether the Trash Policy is enabled for this filesystem.
|
abstract boolean |
moveToTrash(Path path)
Move a file or directory to the current trash directory.
|
getConf, setConf
protected FileSystem fs
protected Path trash
protected long deletionInterval
@Deprecated public abstract void initialize(Configuration conf, FileSystem fs, Path home)
initialize(Configuration, FileSystem)
instead.conf
- the configuration to be usedfs
- the filesystem to be usedhome
- the home directorypublic void initialize(Configuration conf, FileSystem fs)
conf
- the configuration to be usedfs
- the filesystem to be usedpublic abstract boolean isEnabled()
public abstract boolean moveToTrash(Path path) throws IOException
IOException
public abstract void createCheckpoint() throws IOException
IOException
public abstract void deleteCheckpoint() throws IOException
IOException
public abstract void deleteCheckpointsImmediately() throws IOException
IOException
public abstract Path getCurrentTrashDir()
public Path getCurrentTrashDir(Path path) throws IOException
path
- path to be deletedIOException
public abstract Runnable getEmptier() throws IOException
Runnable
that periodically empties the trash of all
users, intended to be run by the superuser.IOException
@Deprecated public static TrashPolicy getInstance(Configuration conf, FileSystem fs, Path home)
getInstance(Configuration, FileSystem)
instead.conf
- the configuration to be usedfs
- the file system to be usedhome
- the home directorypublic static TrashPolicy getInstance(Configuration conf, FileSystem fs)
conf
- the configuration to be usedfs
- the file system to be usedCopyright © 2022 Apache Software Foundation. All rights reserved.