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:
CatalogStore
@Internal public class FileCatalogStore extends AbstractCatalogStore
ACatalogStore
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
Constructors Constructor Description FileCatalogStore(String catalogStorePath)
Creates a newFileCatalogStore
instance with the specified directory path.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
contains(String catalogName)
Returns whether the specified catalog exists in the catalog store.Optional<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.void
open()
Opens the catalog store and initializes the catalog file map.void
removeCatalog(String catalogName, boolean ignoreIfNotExists)
Removes the specified catalog from the catalog store.void
storeCatalog(String catalogName, CatalogDescriptor catalog)
Stores the specified catalog in the catalog store.-
Methods inherited from class org.apache.flink.table.catalog.AbstractCatalogStore
checkOpenState, close
-
-
-
-
Constructor Detail
-
FileCatalogStore
public FileCatalogStore(String catalogStorePath)
Creates a newFileCatalogStore
instance with the specified directory path.- Parameters:
catalogStorePath
- the directory path where catalog configurations will be stored
-
-
Method Detail
-
open
public void open() throws CatalogException
Opens the catalog store and initializes the catalog file map.- Specified by:
open
in interfaceCatalogStore
- Overrides:
open
in classAbstractCatalogStore
- Throws:
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, CatalogDescriptor catalog) throws CatalogException
Stores the specified catalog in the catalog store.- Parameters:
catalogName
- the name of the catalogcatalog
- the catalog descriptor to store- Throws:
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 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:
CatalogException
- if the catalog store is not open or if there is an error removing the catalog
-
getCatalog
public Optional<CatalogDescriptor> getCatalog(String catalogName) throws 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
Optional
containing the catalog descriptor, or an emptyOptional
if the catalog does not exist in the catalog store - Throws:
CatalogException
- if the catalog store is not open or if there is an error retrieving the catalog
-
listCatalogs
public Set<String> listCatalogs() throws CatalogException
Returns a set of all catalog names in the catalog store.- Returns:
- a set of all catalog names in the catalog store
- Throws:
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 CatalogException
Returns whether the specified catalog exists in the catalog store.- Parameters:
catalogName
- the name of the catalog to check- Returns:
true
if the catalog exists in the catalog store,false
otherwise- Throws:
CatalogException
- if the catalog store is not open or if there is an error checking for the catalog
-
-