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

    Constructors
    Constructor
    Description
    FileCatalogStore(String catalogStorePath)
    Creates a new FileCatalogStore instance with the specified directory path.
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    contains(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.
    Returns a set of all catalog names in the catalog store.
    void
    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, 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

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • FileCatalogStore

      public FileCatalogStore(String catalogStorePath)
      Creates a new FileCatalogStore instance 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.CatalogException
      Opens the catalog store and initializes the catalog file map.
      Specified by:
      open in interface org.apache.flink.table.catalog.CatalogStore
      Overrides:
      open in class org.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 catalog
      catalog - 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 remove
      ignoreIfNotExists - 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 Optional containing the catalog descriptor, or an empty Optional 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 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:
      true if the catalog exists in the catalog store, false otherwise
      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