Package io.debezium.relational
Class ConcurrentMapTableMappingStorage<V>
java.lang.Object
io.debezium.relational.ConcurrentMapTableMappingStorage<V>
- Type Parameters:
V- the type of values stored
- All Implemented Interfaces:
TableMappingStorage<V>,AutoCloseable
Default implementation of
TableMappingStorage using ConcurrentHashMap.
This implementation stores mappings in memory and handles case-insensitive table identifiers
by converting them to lowercase when needed.- Author:
- Debezium Authors
-
Nested Class Summary
Nested classes/interfaces inherited from interface io.debezium.relational.TableMappingStorage
TableMappingStorage.Type -
Field Summary
FieldsFields inherited from interface io.debezium.relational.TableMappingStorage
STORAGE_PREFIX, STORAGE_PREFIX_SCHEMAS, STORAGE_PREFIX_TABLES -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidclear()Removes all mappings from this storage.voidclose()Closes this storage and releases any system resources associated with it.voidconfigure(RelationalDatabaseConnectorConfig config, boolean tableIdCaseInsensitive, TableMappingStorage.Type type) Configures this storage instance with connector configuration.voidforEach(BiConsumer<? super TableId, ? super V> action) Performs the given action for each entry in this storage until all entries have been processed or the action throws an exception.Retrieves the value associated with the given table identifier.booleanisEmpty()Returns true if this storage contains no mappings.keySet()Returns a set view of the table identifiers contained in this storage.private TableIdnormalizeTableId(TableId tableId) Normalizes the table identifier based on case sensitivity settings.Associates the specified value with the specified table identifier.Removes the mapping for the specified table identifier.intsize()Returns the number of table identifier-value mappings in this storage.
-
Field Details
-
tableIdCaseInsensitive
private boolean tableIdCaseInsensitive -
storage
-
-
Constructor Details
-
ConcurrentMapTableMappingStorage
public ConcurrentMapTableMappingStorage()Creates a new storage instance. Must callbefore use.invalid reference
#configure(RelationalDatabaseConnectorConfig, boolean)
-
-
Method Details
-
configure
public void configure(RelationalDatabaseConnectorConfig config, boolean tableIdCaseInsensitive, TableMappingStorage.Type type) Description copied from interface:TableMappingStorageConfigures this storage instance with connector configuration. This method is called once after instantiation and before any other methods.- Specified by:
configurein interfaceTableMappingStorage<V>- Parameters:
config- the connector configurationtableIdCaseInsensitive- whether table identifiers should be treated case-insensitivelytype- the type of storage (schemas or tables)
-
get
Description copied from interface:TableMappingStorageRetrieves the value associated with the given table identifier.- Specified by:
getin interfaceTableMappingStorage<V>- Parameters:
tableId- the table identifier- Returns:
- the associated value, or null if not present
-
put
Description copied from interface:TableMappingStorageAssociates the specified value with the specified table identifier.- Specified by:
putin interfaceTableMappingStorage<V>- Parameters:
tableId- the table identifiervalue- the value to be associated- Returns:
- the previous value associated with the table identifier, or null if there was no mapping
-
remove
Description copied from interface:TableMappingStorageRemoves the mapping for the specified table identifier.- Specified by:
removein interfaceTableMappingStorage<V>- Parameters:
tableId- the table identifier- Returns:
- the previous value associated with the table identifier, or null if there was no mapping
-
clear
public void clear()Description copied from interface:TableMappingStorageRemoves all mappings from this storage.- Specified by:
clearin interfaceTableMappingStorage<V>
-
size
public int size()Description copied from interface:TableMappingStorageReturns the number of table identifier-value mappings in this storage.- Specified by:
sizein interfaceTableMappingStorage<V>- Returns:
- the number of mappings
-
isEmpty
public boolean isEmpty()Description copied from interface:TableMappingStorageReturns true if this storage contains no mappings.- Specified by:
isEmptyin interfaceTableMappingStorage<V>- Returns:
- true if this storage contains no mappings
-
keySet
Description copied from interface:TableMappingStorageReturns a set view of the table identifiers contained in this storage.- Specified by:
keySetin interfaceTableMappingStorage<V>- Returns:
- a set view of the table identifiers
-
forEach
Description copied from interface:TableMappingStoragePerforms the given action for each entry in this storage until all entries have been processed or the action throws an exception.- Specified by:
forEachin interfaceTableMappingStorage<V>- Parameters:
action- the action to be performed for each entry
-
close
public void close()Description copied from interface:TableMappingStorageCloses this storage and releases any system resources associated with it. If the storage is already closed then invoking this method has no effect.- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceTableMappingStorage<V>
-
normalizeTableId
Normalizes the table identifier based on case sensitivity settings.- Parameters:
tableId- the table identifier to normalize- Returns:
- the normalized table identifier
-