DefaultBulkDeleteOperation (Apache Hadoop Common 3.5.0 API)
Description: declaration: package: org.apache.hadoop.fs.impl, class: DefaultBulkDeleteOperation

Package org.apache.hadoop.fs.impl

# Class DefaultBulkDeleteOperation

java.lang.Object
org.apache.hadoop.fs.impl.DefaultBulkDeleteOperation

All Implemented Interfaces:
  `Closeable`, `AutoCloseable`, `BulkDelete`, `IOStatisticsSource`

public class DefaultBulkDeleteOperation extends Object implements BulkDelete
Default implementation of the `BulkDelete` interface.

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `DefaultBulkDeleteOperation(Path basePath, FileSystem fs)`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `Path`
  `basePath()`
  Base path of a bulk delete operation.
  `List<Map.Entry<Path,String>>`
  `bulkDelete(Collection<Path> paths)`
  Delete a list of files/objects.
  `void`
  `close()`
  `int`
  `pageSize()`
  The maximum number of objects/files to delete in a single request.

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

  ### Methods inherited from interface org.apache.hadoop.fs.statistics.IOStatisticsSource

  `getIOStatistics`

- ## Constructor Details

  - ### DefaultBulkDeleteOperation

    public DefaultBulkDeleteOperation(Path basePath, FileSystem fs)

- ## Method Details

  - ### pageSize

    public int pageSize()
    Description copied from interface: `BulkDelete`
    The maximum number of objects/files to delete in a single request.
    Specified by:
      `pageSize` in interface `BulkDelete`
    Returns:
      a number greater than zero.

  - ### basePath

    public Path basePath()
    Description copied from interface: `BulkDelete`
    Base path of a bulk delete operation. All paths submitted in `BulkDelete.bulkDelete(Collection)` must be under this path.
    Specified by:
      `basePath` in interface `BulkDelete`
    Returns:
      base path of a bulk delete operation.

  - ### bulkDelete

    public List<Map.Entry<Path,String>> bulkDelete(Collection<Path> paths) throws IOException, IllegalArgumentException
    Delete a list of files/objects.
    - Files must be under the path provided in `BulkDelete.basePath()`.
    - The size of the list must be equal to or less than the page size declared in `BulkDelete.pageSize()`.
    - Directories are not supported; the outcome of attempting to delete directories is undefined (ignored; undetected, listed as failures...).
    - The operation is not atomic.
    - The operation is treated as idempotent: network failures may trigger resubmission of the request -any new objects created under a path in the list may then be deleted.
    - There is no guarantee that any parent directories exist after this call.
    . The default impl just calls `FileSystem.delete(path, false)` on the single path in the list.
    Specified by:
      `bulkDelete` in interface `BulkDelete`
    Parameters:
      `paths` - list of paths which must be absolute and under the base path. provided in `BulkDelete.basePath()`.
    Returns:
      a list of paths which failed to delete, with the exception message.
    Throws:
      `IOException` - IO problems including networking, authentication and more.
      `IllegalArgumentException` - if a path argument is invalid.

  - ### close

    public void close() throws IOException
    Specified by:
      `close` in interface `AutoCloseable`
    Specified by:
      `close` in interface `Closeable`
    Throws:
      `IOException`