Trash (Hadoop 1.2.1 API)
Date: 2013-07-22

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.apache.hadoop.fs
Class Trash

    java.lang.Object
      org.apache.hadoop.conf.Configured
          org.apache.hadoop.fs.Trash

All Implemented Interfaces:
  Configurable

    public class Trash

extends Configured

Provides a trash feature. Files are moved to a user's trash directory, a subdirectory of their home directory named ".Trash". Files are initially moved to a current sub-directory of the trash directory. Within that sub-directory their original path is preserved. Periodically one may checkpoint the current trash and remove older checkpoints. (This design permits trash management without enumeration of the full trash content, without date support in the filesystem, and without clock synchronization.)

Constructor Summary
`Trash(Configuration conf)` Construct a trash can accessor.
`Trash(FileSystem fs, Configuration conf)` Construct a trash can accessor for the FileSystem provided.

Method Summary
`void` | `checkpoint()` Create a trash checkpoint.
`void` | `expunge()` Delete old checkpoints.
`Runnable` | `getEmptier()` Return a `Runnable` that periodically empties the trash of all users, intended to be run by the superuser.
`static void` | `main(String[] args)` Run an emptier.
`boolean` | `moveToTrash(Path path)` Move a file or directory to the current trash directory.

Methods inherited from class org.apache.hadoop.conf.Configured
`getConf, setConf`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### Trash

    public Trash(Configuration conf)
          throws IOException

  Construct a trash can accessor.

  Parameters:
    `conf` - a Configuration
  Throws:
    `IOException`

### Trash

    public Trash(FileSystem fs,
                 Configuration conf)
          throws IOException

  Construct a trash can accessor for the FileSystem provided.

  Throws:
    `IOException`

Method Detail

### moveToTrash

    public boolean moveToTrash(Path path)
                        throws IOException

  Move a file or directory to the current trash directory.

  Returns:
    false if the item is already in the trash or trash is disabled
  Throws:
    `IOException`

### checkpoint

    public void checkpoint()
                    throws IOException

  Create a trash checkpoint.

  Throws:
    `IOException`

### expunge

    public void expunge()
                 throws IOException

  Delete old checkpoints.

  Throws:
    `IOException`

### getEmptier

    public Runnable getEmptier()
                        throws IOException

  Return a `Runnable` that periodically empties the trash of all users, intended to be run by the superuser. Only one checkpoint is kept at a time.

  Throws:
    `IOException`

### main

    public static void main(String[] args)
                     throws Exception

  Run an emptier.

  Throws:
    `Exception`

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2009 The Apache Software Foundation