Class DeleteOptions

java.lang.Object
org.apache.opendal.DeleteOptions

public class DeleteOptions extends Object
Options for delete operations.

All supplied conditions must hold for deletion to proceed. Unsupported options fail with OpenDALException.Code.Unsupported. Failed conditions fail with OpenDALException.Code.ConditionNotMatch.

Optional reference fields default to null.

  • Field Details

    • version

      public final String version
      Delete the given version of the file instead of the current one.

      This selects which stored version the delete removes; it is not a condition on the file.

      See Also:
    • recursive

      public final boolean recursive
      Whether to delete the target recursively.

      The default, false, deletes a single object. With true, a trailing slash (for example, "a/") scopes deletion to a directory and its descendants across services. Prefix matching for paths without a trailing slash is service-specific. On prefix-based services such as memory, "a" also matches entries under "ab/".

      See Also:
    • ifMatch

      public final String ifMatch
      Delete only when the file at the delete path has this exact ETag.

      The condition succeeds when the file exists and its ETag equals this value. A file with a different ETag, or a missing file, fails the delete with OpenDALException.Code.ConditionNotMatch. Only concrete ETag values are portable; a wildcard such as "*" has no portable meaning here.

      See Also:
    • ifNoneMatch

      public final String ifNoneMatch
      Delete only when the file at the delete path does not have this ETag.

      With a concrete ETag value, the condition succeeds when the file has a different ETag or does not exist; deleting a missing file is then a successful no-op. A file whose ETag equals this value fails the delete with OpenDALException.Code.ConditionNotMatch. Only concrete ETag values are portable; a wildcard such as "*" has no portable meaning here.

      See Also:
    • ifVersionMatch

      public final String ifVersionMatch
      Delete only when the file at the delete path has this exact version.

      The condition succeeds when the file exists and its version equals this value. A file with a different version, or a missing file, fails the delete with OpenDALException.Code.ConditionNotMatch.

      See Also:
    • ifVersionNotMatch

      public final String ifVersionNotMatch
      Delete only when the file at the delete path does not have this version.

      The condition succeeds when the file exists with a different version. A file whose version equals this value fails the delete with OpenDALException.Code.ConditionNotMatch. When no file exists at the delete path, no portable behavior is defined.

      See Also:
    • ifNotChanged

      public final Metadata ifNotChanged
      Delete only when the file at the delete path still has the identity recorded in this metadata.

      Pass metadata previously returned by OpenDAL for the same path. OpenDAL derives a version match when the service supports version conditions and the metadata contains a version. Otherwise it uses a non-weak ETag if present. A changed or missing file fails the delete with OpenDALException.Code.ConditionNotMatch, as does combining this option with a conflicting ifMatch or ifVersionMatch value.

      The operation returns OpenDALException.Code.Unsupported when the service does not support the derived primitive condition, and OpenDALException.Code.ConfigInvalid when the metadata contains neither a version nor a non-weak ETag.

  • Constructor Details

    • DeleteOptions

      public DeleteOptions()