Package org.apache.gravitino.file
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 Summary
Modifier and TypeMethodDescriptionalterFileset
(NameIdentifier ident, FilesetChange... changes) Apply thechange
to a fileset in the catalog.default Fileset
createFileset
(NameIdentifier ident, String comment, Fileset.Type type, String storageLocation, Map<String, String> properties) Create a fileset metadata with a default location in the catalog.default Fileset
createMultipleLocationFileset
(NameIdentifier ident, String comment, Fileset.Type type, Map<String, String> storageLocations, Map<String, String> properties) Create a fileset metadata with multiple storage locations in the catalog.boolean
dropFileset
(NameIdentifier ident) Drop a fileset from the catalog.default boolean
filesetExists
(NameIdentifier ident) Check if a fileset exists using anNameIdentifier
from the catalog.default String
getFileLocation
(NameIdentifier ident, String subPath) Get the actual location of a file or directory based on the default storage location of Fileset and the sub path.default String
getFileLocation
(NameIdentifier ident, String subPath, String locationName) Get the actual location of a file or directory based on the storage location of Fileset and the sub path by the location name.listFilesets
(Namespace namespace) List the filesets in a schema namespace from the catalog.loadFileset
(NameIdentifier ident) Load fileset metadata byNameIdentifier
from the catalog.
-
Method Details
-
listFilesets
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
Load fileset metadata byNameIdentifier
from the catalog.- Parameters:
ident
- A fileset identifier.- Returns:
- The fileset metadata.
- Throws:
NoSuchFilesetException
- If the fileset does not exist.
-
filesetExists
Check if a fileset exists using anNameIdentifier
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, FilesetAlreadyExistsExceptionCreate 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, throws NoSuchSchemaException, FilesetAlreadyExistsExceptionString> properties) 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
Fileset alterFileset(NameIdentifier ident, FilesetChange... changes) throws NoSuchFilesetException, IllegalArgumentException Apply thechange
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
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
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.
-