Package org.apache.flink.table.catalog
Class FileCatalogStore
- java.lang.Object
-
- org.apache.flink.table.catalog.AbstractCatalogStore
-
- org.apache.flink.table.catalog.FileCatalogStore
-
- All Implemented Interfaces:
org.apache.flink.table.catalog.CatalogStore
@Internal public class FileCatalogStore extends org.apache.flink.table.catalog.AbstractCatalogStoreACatalogStorethat stores all catalog configuration to a directory. Configuration of every catalog will be saved into a single file. The file name will be {catalogName}.yaml by default.
-
-
Constructor Summary
Constructors Constructor Description FileCatalogStore(String catalogStorePath)Creates a newFileCatalogStoreinstance with the specified directory path.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleancontains(String catalogName)Returns whether the specified catalog exists in the catalog store.Optional<org.apache.flink.table.catalog.CatalogDescriptor>getCatalog(String catalogName)Returns the catalog descriptor for the specified catalog, if it exists in the catalog store.Set<String>listCatalogs()Returns a set of all catalog names in the catalog store.voidopen()Opens the catalog store and initializes the catalog file map.voidremoveCatalog(String catalogName, boolean ignoreIfNotExists)Removes the specified catalog from the catalog store.voidstoreCatalog(String catalogName, org.apache.flink.table.catalog.CatalogDescriptor catalog)Stores the specified catalog in the catalog store.
-
-
-
Constructor Detail
-
FileCatalogStore
public FileCatalogStore(String catalogStorePath)
Creates a newFileCatalogStoreinstance with the specified directory path.- Parameters:
catalogStorePath- the directory path where catalog configurations will be stored
-
-
Method Detail
-
open
public void open() throws org.apache.flink.table.catalog.exceptions.CatalogExceptionOpens the catalog store and initializes the catalog file map.- Specified by:
openin interfaceorg.apache.flink.table.catalog.CatalogStore- Overrides:
openin classorg.apache.flink.table.catalog.AbstractCatalogStore- Throws:
org.apache.flink.table.catalog.exceptions.CatalogException- if the catalog store directory does not exist, not a directory, or if there is an error reading the directory
-
storeCatalog
public void storeCatalog(String catalogName, org.apache.flink.table.catalog.CatalogDescriptor catalog) throws org.apache.flink.table.catalog.exceptions.CatalogException
Stores the specified catalog in the catalog store.- Parameters:
catalogName- the name of the catalogcatalog- the catalog descriptor to store- Throws:
org.apache.flink.table.catalog.exceptions.CatalogException- if the catalog store is not open or if there is an error storing the catalog
-
removeCatalog
public void removeCatalog(String catalogName, boolean ignoreIfNotExists) throws org.apache.flink.table.catalog.exceptions.CatalogException
Removes the specified catalog from the catalog store.- Parameters:
catalogName- the name of the catalog to removeignoreIfNotExists- whether to ignore if the catalog does not exist in the catalog store- Throws:
org.apache.flink.table.catalog.exceptions.CatalogException- if the catalog store is not open or if there is an error removing the catalog
-
getCatalog
public Optional<org.apache.flink.table.catalog.CatalogDescriptor> getCatalog(String catalogName) throws org.apache.flink.table.catalog.exceptions.CatalogException
Returns the catalog descriptor for the specified catalog, if it exists in the catalog store.- Parameters:
catalogName- the name of the catalog to retrieve- Returns:
- an
Optionalcontaining the catalog descriptor, or an emptyOptionalif the catalog does not exist in the catalog store - Throws:
org.apache.flink.table.catalog.exceptions.CatalogException- if the catalog store is not open or if there is an error retrieving the catalog
-
listCatalogs
public Set<String> listCatalogs() throws org.apache.flink.table.catalog.exceptions.CatalogException
Returns a set of all catalog names in the catalog store.- Returns:
- a set of all catalog names in the catalog store
- Throws:
org.apache.flink.table.catalog.exceptions.CatalogException- if the catalog store is not open or if there is an error retrieving the list of catalog names
-
contains
public boolean contains(String catalogName) throws org.apache.flink.table.catalog.exceptions.CatalogException
Returns whether the specified catalog exists in the catalog store.- Parameters:
catalogName- the name of the catalog to check- Returns:
trueif the catalog exists in the catalog store,falseotherwise- Throws:
org.apache.flink.table.catalog.exceptions.CatalogException- if the catalog store is not open or if there is an error checking for the catalog
-
-