Options.CreateFileOptionKeys (Apache Hadoop Common 3.5.0 API)
Description: declaration: package: org.apache.hadoop.fs, class: Options, interface: CreateFileOptionKeys

Package org.apache.hadoop.fs

# Interface Options.CreateFileOptionKeys

Enclosing class:
  Options

@Public @Evolving public static interface Options.CreateFileOptionKeys
The standard `createFile()` options.

If an option is not supported during file creation and it is considered part of a commit protocol, then, when supplied in a must() option, it MUST be rejected.

- ## Field Summary

  Fields
  Modifier and Type
  Field
  Description
  `static final String`
  `FS_OPTION_CREATE_CONDITIONAL_OVERWRITE`
  `createFile()` option to write a file in the close() operation iff there is nothing at the destination.
  `static final String`
  `FS_OPTION_CREATE_CONDITIONAL_OVERWRITE_ETAG`
  Overwrite a file only if there is an Etag match.
  `static final String`
  `FS_OPTION_CREATE_CONTENT_TYPE`
  String to define the content filetype.
  `static final String`
  `FS_OPTION_CREATE_IN_CLOSE`
  A flag which requires the filesystem to create files/objects in close(), rather than create/createFile.

- ## Field Details

  - ### FS_OPTION_CREATE_CONDITIONAL_OVERWRITE

    static final String FS_OPTION_CREATE_CONDITIONAL_OVERWRITE
    `createFile()` option to write a file in the close() operation iff there is nothing at the destination. this is the equivalent of `create(path, overwrite=true)` except that the existence check is postponed to the end of the write.

    Value "fs.option.create.conditional.overwrite".

    This can be set in the builder.

    1. It is for object stores stores which only upload/manifest files at the end of the stream write.
    2. Streams which support it SHALL not manifest any object to the destination path until close()
    3. It MUST be declared as a stream capability in streams for which this overwrite is enabled.
    4. It MUST be exported as a path capability for all stores where the feature is available and enabled
    5. If passed to a filesystem as a `must()` parameter where the option value is `true`, and it is supported/enabled, the FS SHALL omit all overwrite checks in `create`, including for the existence of an object or a directory underneath. Instead, during `close()` the object will only be manifest at the target path if there is no object at the destination.
    6. The existence check and object creation SHALL be atomic.
    7. If passed to a filesystem as a `must()` parameter where the option value is `true`, and the FS does not recognise the feature, or it is recognized but disabled on this FS instance, the filesystem SHALL reject the request.
    8. If passed to a filesystem as a `opt()` parameter where the option value is `true`, the filesystem MAY ignore the request, or it MAY enable the feature. Any filesystem which does not support the feature, including from older releases, SHALL ignore it.
    See Also:
      - Constant Field Values

  - ### FS_OPTION_CREATE_CONDITIONAL_OVERWRITE_ETAG

    static final String FS_OPTION_CREATE_CONDITIONAL_OVERWRITE_ETAG
    Overwrite a file only if there is an Etag match. This option takes a string, Value "fs.option.create.conditional.overwrite.etag".

    This is similar to `FS_OPTION_CREATE_CONDITIONAL_OVERWRITE`.

    1. If supported and enabled, it SHALL be declared as a capability of the filesystem
    2. If supported and enabled, it SHALL be declared as a capability of the stream
    3. The string passed as the value SHALL be the etag value as returned by `EtagSource.getEtag()`
    4. This value MUST NOT be empty
    5. If passed to a filesystem which supports it, then when the file is created, the store SHALL check for the existence of a file/object at the destination path.
    6. If there is no object there, the operation SHALL be rejected by raising either a `org.apache.hadoop.fs.FileAlreadyExistsException` exception, or a`java.nio.file.FileAlreadyExistsException`
    7. If there is an object there, its Etag SHALL be compared to the value passed here.
    8. If there is no match, the operation SHALL be rejected by raising either a `org.apache.hadoop.fs.FileAlreadyExistsException` exception, or a`java.nio.file.FileAlreadyExistsException`
    9. If the etag does match, the file SHALL be created.
    10. The check and create SHALL be atomic
    11. The check and create MAY be at the end of the write, in `close()`, or it MAY be in the `create()` operation. That is: some stores MAY perform the check early
    12. If supported and enabled, stores MAY check for the existence of subdirectories; this behavior is implementation-specific.
    See Also:
      - Constant Field Values

  - ### FS_OPTION_CREATE_IN_CLOSE

    static final String FS_OPTION_CREATE_IN_CLOSE
    A flag which requires the filesystem to create files/objects in close(), rather than create/createFile.

    Object stores with this behavior should also export it as a path capability. Value "fs.option.create.in.close".

    See Also:
      - Constant Field Values

  - ### FS_OPTION_CREATE_CONTENT_TYPE

    static final String FS_OPTION_CREATE_CONTENT_TYPE
    String to define the content filetype. Value "fs.option.create.content.type".
    See Also:
      - Constant Field Values