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.AbstractCatalogStore
A
CatalogStore that 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.-
Field Summary
Fields inherited from class org.apache.flink.table.catalog.AbstractCatalogStore
isOpen -
Constructor Summary
ConstructorsConstructorDescriptionFileCatalogStore(String catalogStorePath) Creates a newFileCatalogStoreinstance with the specified directory path. -
Method Summary
Modifier and TypeMethodDescriptionbooleanReturns 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.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.Methods inherited from class org.apache.flink.table.catalog.AbstractCatalogStore
checkOpenState, close
-
Constructor Details
-
FileCatalogStore
Creates a newFileCatalogStoreinstance with the specified directory path.- Parameters:
catalogStorePath- the directory path where catalog configurations will be stored
-
-
Method Details
-
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
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
-