Configurable@Private @Evolving public class TrashPolicyDefault extends TrashPolicy
| Modifier and Type | Class | Description |
|---|---|---|
protected class |
TrashPolicyDefault.Emptier |
deletionInterval, fs, trash| Constructor | Description |
|---|---|
TrashPolicyDefault() |
| Modifier and Type | Method | Description |
|---|---|---|
void |
createCheckpoint() |
Create a trash checkpoint.
|
void |
createCheckpoint(java.util.Date date) |
|
void |
deleteCheckpoint() |
Delete old trash checkpoint(s).
|
void |
deleteCheckpointsImmediately() |
Delete all checkpoints immediately, ie empty trash.
|
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
|
java.lang.Runnable |
getEmptier() |
Return a
Runnable that periodically empties the trash of all
users, intended to be run by the superuser. |
void |
initialize(Configuration conf,
FileSystem fs) |
Used to setup the trash policy.
|
void |
initialize(Configuration conf,
FileSystem fs,
Path home) |
Deprecated.
Use
initialize(Configuration, FileSystem) instead. |
boolean |
isEnabled() |
Returns whether the Trash Policy is enabled for this filesystem.
|
boolean |
moveToTrash(Path path) |
Move a file or directory to the current trash directory.
|
getInstance, getInstancegetConf, setConf@Deprecated public void initialize(Configuration conf, FileSystem fs, Path home)
initialize(Configuration, FileSystem) instead.TrashPolicyinitialize in class TrashPolicyconf - the configuration to be usedfs - the filesystem to be usedhome - the home directorypublic void initialize(Configuration conf, FileSystem fs)
TrashPolicyinitialize in class TrashPolicyconf - the configuration to be usedfs - the filesystem to be usedpublic boolean isEnabled()
TrashPolicyisEnabled in class TrashPolicypublic boolean moveToTrash(Path path) throws java.io.IOException
TrashPolicymoveToTrash in class TrashPolicypath - the path.java.io.IOException - raised on errors performing I/O.public void createCheckpoint()
throws java.io.IOException
TrashPolicycreateCheckpoint in class TrashPolicyjava.io.IOException - raised on errors performing I/O.public void createCheckpoint(java.util.Date date)
throws java.io.IOException
java.io.IOExceptionpublic void deleteCheckpoint()
throws java.io.IOException
TrashPolicydeleteCheckpoint in class TrashPolicyjava.io.IOException - raised on errors performing I/O.public void deleteCheckpointsImmediately()
throws java.io.IOException
TrashPolicydeleteCheckpointsImmediately in class TrashPolicyjava.io.IOException - raised on errors performing I/O.public Path getCurrentTrashDir()
TrashPolicygetCurrentTrashDir in class TrashPolicypublic Path getCurrentTrashDir(Path path) throws java.io.IOException
TrashPolicygetCurrentTrashDir in class TrashPolicypath - path to be deletedjava.io.IOException - raised on errors performing I/O.public java.lang.Runnable getEmptier()
throws java.io.IOException
TrashPolicyRunnable that periodically empties the trash of all
users, intended to be run by the superuser.getEmptier in class TrashPolicyjava.io.IOException - raised on errors performing I/O.Copyright © 2008–2025 Apache Software Foundation. All rights reserved.