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 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

      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