Package io.debezium.relational
Class Tables
java.lang.Object
io.debezium.relational.Tables
Structural definitions for a set of tables in a JDBC database.
- Author:
- Randall Hauch
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate static final classATables.TableFilterthat caches the results of another filter.static interfaceA filter for columns.static classstatic interfaceA filter for tables.private static classA set of table ids.private static classA map of tables by id. -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final Tables.TableIdsprivate final io.debezium.util.FunctionalReadWriteLockprivate final booleanprivate final Tables.TablesById -
Constructor Summary
ConstructorsModifierConstructorDescriptionTables()Create case sensitive empty set of definitions.Tables(boolean tableIdCaseInsensitive) Create an empty set of definitions.Tables(boolean tableIdCaseInsensitive, RelationalDatabaseConnectorConfig config) Create an empty set of definitions with connector configuration.protected -
Method Summary
Modifier and TypeMethodDescriptionvoidclear()clone()editOrCreateTable(TableId tableId) Obtain an editor for the table with the given ID.Obtain an editor for the table with the given ID.booleanObtain the definition of the identified table.Obtain the definition of the identified table.(package private) TableMappingStorage<Table> Get the underlying table storage for resource management.inthashCode()overwriteTable(Table table) Add or update the definition for the identified table.overwriteTable(TableId tableId, List<Column> columnDefs, List<String> primaryKeyColumnNames, String defaultCharsetName, List<Attribute> attributes) Add or update the definition for the identified table.removeTable(TableId tableId) Remove the definition of the identified table.voidremoveTablesForDatabase(String schemaName) voidremoveTablesForDatabase(String catalogName, String schemaName) renameTable(TableId existingTableId, TableId newTableId) Rename an existing table.intsize()Get the number of tables that are in this object.subset(Tables.TableFilter filter) tableIds()Get the set ofTableIds for which there is aSchema.toString()updateTable(TableId tableId, Function<Table, Table> changer) Add or update the definition for the identified table.
-
Field Details
-
lock
private final io.debezium.util.FunctionalReadWriteLock lock -
tablesByTableId
-
changes
-
tableIdCaseInsensitive
private final boolean tableIdCaseInsensitive
-
-
Constructor Details
-
Tables
public Tables(boolean tableIdCaseInsensitive) Create an empty set of definitions.- Parameters:
tableIdCaseInsensitive- - true if lookup is case insensitive (typical for MySQL on Windows)
-
Tables
Create an empty set of definitions with connector configuration.- Parameters:
tableIdCaseInsensitive- - true if lookup is case insensitive (typical for MySQL on Windows)config- - connector configuration for creating storage instances
-
Tables
public Tables()Create case sensitive empty set of definitions. -
Tables
-
-
Method Details
-
clear
public void clear() -
getStorage
TableMappingStorage<Table> getStorage()Get the underlying table storage for resource management. Package-private for use by RelationalDatabaseSchema.- Returns:
- the table storage instance
-
clone
-
size
public int size()Get the number of tables that are in this object.- Returns:
- the table count
-
drainChanges
-
overwriteTable
public Table overwriteTable(TableId tableId, List<Column> columnDefs, List<String> primaryKeyColumnNames, String defaultCharsetName, List<Attribute> attributes) Add or update the definition for the identified table.- Parameters:
tableId- the identifier of the tablecolumnDefs- the list of column definitions; may not be null or emptyprimaryKeyColumnNames- the list of the column names that make up the primary key; may be null or emptydefaultCharsetName- the name of the character set that should be used by defaultattributes- the list of attribute definitions; may not be null or empty- Returns:
- the previous table definition, or null if there was no prior table definition
-
overwriteTable
Add or update the definition for the identified table.- Parameters:
table- the definition for the table; may not be null- Returns:
- the previous table definition, or null if there was no prior table definition
-
removeTablesForDatabase
-
removeTablesForDatabase
-
renameTable
Rename an existing table.- Parameters:
existingTableId- the identifier of the existing table to be renamed; may not be nullnewTableId- the new identifier for the table; may not be null- Returns:
- the previous table definition, or null if there was no prior table definition
-
updateTable
Add or update the definition for the identified table. -
removeTable
Remove the definition of the identified table.- Parameters:
tableId- the identifier of the table- Returns:
- the existing table definition that was removed, or null if there was no prior table definition
-
forTable
Obtain the definition of the identified table.- Parameters:
tableId- the identifier of the table- Returns:
- the table definition, or null if there was no definition for the identified table
-
forTable
Obtain the definition of the identified table.- Parameters:
catalogName- the name of the database catalog that contains the table; may be null if the JDBC driver does not show a schema for this tableschemaName- the name of the database schema that contains the table; may be null if the JDBC driver does not show a schema for this tabletableName- the name of the table- Returns:
- the table definition, or null if there was no definition for the identified table
-
tableIds
Get the set ofTableIds for which there is aSchema.- Returns:
- the immutable set of table identifiers; never null
-
editTable
Obtain an editor for the table with the given ID. This method does not lock the set of table definitions, so use with caution. The resulting editor can be used to modify the table definition, but when completed the newTableneeds to be added back to this object viaoverwriteTable(Table).- Parameters:
tableId- the identifier of the table- Returns:
- the editor for the table, or null if there is no table with the specified ID
-
editOrCreateTable
Obtain an editor for the table with the given ID. This method does not lock or modify the set of table definitions, so use with caution. The resulting editor can be used to modify the table definition, but when completed the newTableneeds to be added back to this object viaoverwriteTable(Table).- Parameters:
tableId- the identifier of the table- Returns:
- the editor for the table, or null if there is no table with the specified ID
-
hashCode
public int hashCode() -
equals
-
subset
-
toString
-