...
Code Block |
---|
/** * Different events will be fired when a catalog/database/table is modified. The customized listener can get and * report specific information from the event according to the event type. */ @PublicEvolving public interface CatalogModificationListener { /** The event will be fired when the database/table is modified. */ void onEvent(CatalogModificationEvent event); } /* Basic interface for catalog modification. */ @PublicEvolving public interface class CatalogModificationEvent { /* Context for the event. */ CatalogContext context(); } /* Context for catalog modification and job lineage events. */ @PublicEvolving public interface CatalogContext { /* The name of catalog. */ String getCatalogName(); /* Class of the catalog. */ Class<? extends Catalog> getClass(); /* Identifier for the catalog from catalog factory, such as jdbc/iceberg/paimon. */ Optional<String> getFactoryIdentifier(); /* Config for catalog. */ Configuration getConfiguration(); } /* The basic class for database related event. */ public interface DatabaseModificationEvent extends CatalogModificationEvent { CatalogDatabase database(); } /* Event for creating database. */ @PublicEvolving public interface CreateDatabaseEvent extends DatabaseModificationEvent { boolean ignoreIfExists(); } /* Event for altering database. */ @PublicEvolving public interface AlterDatabaseEvent extends DatabaseModificationEvent { CatalogDatabase newDatabase(); boolean ignoreIfNotExists(); } /* Event for dropping database. */ @PublicEvolving public interface DropDatabaseEvent extends DatabaseModificationEvent { boolean ignoreIfExists(); } /** * Base table event, provides column list, primary keys, partition keys, watermarks and properties in * CatalogBaseTable. The table can be source or sink. */ public interface TableModificationEvent extends CatalogModificationEvent { ObjectIdentifier identifier(); CatalogBaseTable table(); } /* Event for creating table. */ @PublicEvolving public interface CreateTableEvent extends CatalogModificationEvent { boolean ignoreIfExists(); } /* Event for altering table, provides all changes for old table. */ @PublicEvolving public interface AlterTableEvent extends CatalogModificationEvent { List<TableChange> tableChanges(); boolean ignoreIfExists(); } /* Event for dropping table. */ @PublicEvolving public interface DropTableEvent extends CatalogModificationEvent { boolean ignoreIfExists(); } /* Factory for catalog modification listener. */ @PublicEvolving public interface CatalogModificationListenerFactory { CatalogModificationListener createListener(Context context); @PublicEvolving public interface Context { Configuration getConfiguration(); ClassLoader getUserClassLoader(); /* * Get an Executor pool for the listener to run async operations that can potentially be IO-heavy. */ Executor getIOExecutor(); } } |
...