Interface FileStore

All Known Implementing Classes:
SwiftFileStore

@NotThreadSafe public interface FileStore
FileStore is an abstraction layer between Athena application and object storage; it can persist an in-memory representation of a file into object storage as well as retrieving it from that storage.
  • Method Summary

    Modifier and Type
    Method
    Description
    @NotNull InputStream
    download(@NotNull String fileId)
    Retrieves a file identified by a specified file ID from object storage.
    @NotNull String
    upload(@NotNull File file)
    Persists a file into object storage database.
  • Method Details

    • upload

      @NotNull @NotNull String upload(@NotNull @NotNull File file)
      Persists a file into object storage database.

      Note that calling this method does NOT automatically update the managed metadata of this file in MetaStore. The metadata must be saved separately using MetaStore.saveMetaData(String, MetaData).

      The implementation does NOT have to be thread-safe. FileStore assumes that it is the callers' responsibilities to implement the thread safety themselves.

      Parameters:
      file - An object representing the file to be persisted
      Returns:
      the file ID that can be used later to retrieve that file in Athena
      Throws:
      NullPointerException - if file is null
    • download

      @NotNull @NotNull InputStream download(@NotNull @NotNull String fileId)
      Retrieves a file identified by a specified file ID from object storage.
      Parameters:
      fileId - The provided file ID, which is the same as the return value of upload(File)
      Returns:
      a previously uploaded file stream
      Throws:
      NullPointerException - if fileId is null