Interface FilesetCatalog


@Evolving public interface FilesetCatalog
The FilesetCatalog interface defines the public API for managing fileset objects in a schema. If the catalog implementation supports fileset objects, it should implement this interface.
  • Method Details

    • listFilesets

      NameIdentifier[] listFilesets(Namespace namespace) throws NoSuchSchemaException
      List the filesets in a schema namespace from the catalog.
      Parameters:
      namespace - A schema namespace.
      Returns:
      An array of fileset identifiers in the namespace.
      Throws:
      NoSuchSchemaException - If the schema does not exist.
    • loadFileset

      Fileset loadFileset(NameIdentifier ident) throws NoSuchFilesetException
      Load fileset metadata by NameIdentifier from the catalog.
      Parameters:
      ident - A fileset identifier.
      Returns:
      The fileset metadata.
      Throws:
      NoSuchFilesetException - If the fileset does not exist.
    • filesetExists

      default boolean filesetExists(NameIdentifier ident)
      Check if a fileset exists using an NameIdentifier from the catalog.
      Parameters:
      ident - A fileset identifier.
      Returns:
      true If the fileset exists, false otherwise.
    • createFileset

      default Fileset createFileset(NameIdentifier ident, String comment, Fileset.Type type, String storageLocation, Map<String,String> properties) throws NoSuchSchemaException, FilesetAlreadyExistsException
      Create a fileset metadata with a default location in the catalog.

      If the type of the fileset object is "MANAGED", the underlying storageLocation can be null, and Gravitino will manage the storage location based on the location of the schema.

      If the type of the fileset object is "EXTERNAL", the underlying storageLocation must be set.

      Parameters:
      ident - A fileset identifier.
      comment - The comment of the fileset.
      type - The type of the fileset.
      storageLocation - The storage location of the fileset.
      properties - The properties of the fileset.
      Returns:
      The created fileset metadata
      Throws:
      NoSuchSchemaException - If the schema does not exist.
      FilesetAlreadyExistsException - If the fileset already exists.
    • createMultipleLocationFileset

      default Fileset createMultipleLocationFileset(NameIdentifier ident, String comment, Fileset.Type type, Map<String,String> storageLocations, Map<String,String> properties) throws NoSuchSchemaException, FilesetAlreadyExistsException
      Create a fileset metadata with multiple storage locations in the catalog.
      Parameters:
      ident - A fileset identifier.
      comment - The comment of the fileset.
      type - The type of the fileset.
      storageLocations - The location names and storage locations of the fileset.
      properties - The properties of the fileset.
      Returns:
      The created fileset metadata
      Throws:
      NoSuchSchemaException - If the schema does not exist.
      FilesetAlreadyExistsException - If the fileset already exists.
    • alterFileset

      Apply the change to a fileset in the catalog.

      Implementation may reject the change. If any change is rejected, no changes should be applied to the fileset.

      The FilesetChange.RenameFileset change will only update the fileset name, the underlying storage location for managed fileset will not be renamed.

      Parameters:
      ident - A fileset identifier.
      changes - The changes to apply to the fileset.
      Returns:
      The altered fileset metadata.
      Throws:
      NoSuchFilesetException - If the fileset does not exist.
      IllegalArgumentException - If the change is rejected by the implementation.
    • dropFileset

      boolean dropFileset(NameIdentifier ident)
      Drop a fileset from the catalog.

      The underlying files will be deleted if this fileset type is managed, otherwise, only the metadata will be dropped.

      Parameters:
      ident - A fileset identifier.
      Returns:
      true If the fileset is dropped, false the fileset did not exist.
    • getFileLocation

      default String getFileLocation(NameIdentifier ident, String subPath) throws NoSuchFilesetException
      Get the actual location of a file or directory based on the default storage location of Fileset and the sub path.
      Parameters:
      ident - A fileset identifier.
      subPath - The sub path to the file or directory.
      Returns:
      The actual location of the file or directory.
      Throws:
      NoSuchFilesetException - If the fileset does not exist.
    • getFileLocation

      default String getFileLocation(NameIdentifier ident, String subPath, String locationName) throws NoSuchFilesetException, NoSuchLocationNameException
      Get the actual location of a file or directory based on the storage location of Fileset and the sub path by the location name.
      Parameters:
      ident - A fileset identifier.
      subPath - The sub path to the file or directory.
      locationName - The location name. If null, the default location will be used.
      Returns:
      The actual location of the file or directory.
      Throws:
      NoSuchFilesetException - If the fileset does not exist.
      NoSuchLocationNameException - If the location name does not exist.