Package org.apache.gravitino
Interface SupportsMetalakes
- All Known Implementing Classes:
GravitinoAdminClient
Client interface for supporting metalakes. It includes methods for listing, loading, creating,
altering and dropping metalakes.
-
Method Summary
Modifier and TypeMethodDescriptionalterMetalake
(String name, MetalakeChange... changes) Alter a metalake with specified metalake name and changes.Create a metalake with specified name, comment and properties.void
disableMetalake
(String name) Disable a metalake.default boolean
dropMetalake
(String name) Drop a metalake with specified name.boolean
dropMetalake
(String name, boolean force) Drop a metalake with specified name.void
enableMetalake
(String name) Enable a metalake.Metalake[]
List all metalakes.loadMetalake
(String name) Load a metalake by its name.default boolean
metalakeExists
(String name) Check if a metalake exists.
-
Method Details
-
listMetalakes
Metalake[] listMetalakes()List all metalakes.- Returns:
- The list of metalakes.
-
loadMetalake
Load a metalake by its name.- Parameters:
name
- the name of the metalake.- Returns:
- The metalake.
- Throws:
NoSuchMetalakeException
- If the metalake does not exist.
-
metalakeExists
Check if a metalake exists.- Parameters:
name
- The name of the metalake.- Returns:
- True if the metalake exists, false otherwise.
-
createMetalake
Metalake createMetalake(String name, String comment, Map<String, String> properties) throws MetalakeAlreadyExistsExceptionCreate a metalake with specified name, comment and properties.- Parameters:
name
- The name of the metalake.comment
- The comment of the metalake.properties
- The properties of the metalake.- Returns:
- The created metalake.
- Throws:
MetalakeAlreadyExistsException
- If the metalake already exists.
-
alterMetalake
Metalake alterMetalake(String name, MetalakeChange... changes) throws NoSuchMetalakeException, IllegalArgumentException Alter a metalake with specified metalake name and changes.- Parameters:
name
- The name of the metalake.changes
- The changes to apply.- Returns:
- The altered metalake.
- Throws:
NoSuchMetalakeException
- If the metalake does not exist.IllegalArgumentException
- If the changes cannot be applied to the metalake.
-
dropMetalake
Drop a metalake with specified name. Please make sure:- There is no catalog in the metalake. Otherwise, a
NonEmptyEntityException
will be thrown. - The method
disableMetalake(String)
has been called before dropping the metalake. Otherwise, aMetalakeInUseException
will be thrown.
dropMetalake(name, false)
.- Parameters:
name
- The name of the metalake.- Returns:
- True if the metalake was dropped, false if the metalake does not exist.
- Throws:
NonEmptyEntityException
- If the metalake is not empty.MetalakeInUseException
- If the metalake is in use.
- There is no catalog in the metalake. Otherwise, a
-
dropMetalake
boolean dropMetalake(String name, boolean force) throws NonEmptyEntityException, MetalakeInUseException Drop a metalake with specified name. If the force flag is true, it will:- Cascade drop all sub-entities (tags, catalogs, schemas, tables, etc.) of the metalake in Gravitino store.
- Drop the metalake even if it is in use.
- External resources (e.g. database, table, etc.) associated with sub-entities will not be deleted unless it is managed (such as managed fileset).
dropMetalake(String)
.- Parameters:
name
- The name of the metalake.force
- Whether to force the drop.- Returns:
- True if the metalake was dropped, false if the metalake does not exist.
- Throws:
NonEmptyEntityException
- If the metalake is not empty and force is false.MetalakeInUseException
- If the metalake is in use and force is false.
-
enableMetalake
Enable a metalake. If the metalake is already in use, this method does nothing.- Parameters:
name
- The name of the metalake.- Throws:
NoSuchMetalakeException
- If the metalake does not exist.
-
disableMetalake
Disable a metalake. If the metalake is already disabled, this method does nothing. Once a metalake is disable:- It can only be listed, loaded, dropped, or enable.
- Any other operations on the metalake will throw an
MetalakeNotInUseException
. - Any operation on the sub-entities (catalogs, schemas, tables, etc.) will throw an
MetalakeNotInUseException
.
- Parameters:
name
- The name of the metalake.- Throws:
NoSuchMetalakeException
- If the metalake does not exist.
-