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

public class ConcurrentMapTableMappingStorage<V> extends Object implements TableMappingStorage<V>
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
  • Field Details

    • tableIdCaseInsensitive

      private boolean tableIdCaseInsensitive
    • storage

      private final ConcurrentMap<TableId,V> storage
  • Constructor Details

    • ConcurrentMapTableMappingStorage

      public ConcurrentMapTableMappingStorage()
      Creates a new storage instance. Must call
      invalid reference
      #configure(RelationalDatabaseConnectorConfig, boolean)
      before use.
  • Method Details

    • configure

      public void configure(RelationalDatabaseConnectorConfig config, boolean tableIdCaseInsensitive, TableMappingStorage.Type type)
      Description copied from interface: TableMappingStorage
      Configures this storage instance with connector configuration. This method is called once after instantiation and before any other methods.
      Specified by:
      configure in interface TableMappingStorage<V>
      Parameters:
      config - the connector configuration
      tableIdCaseInsensitive - whether table identifiers should be treated case-insensitively
      type - the type of storage (schemas or tables)
    • get

      public V get(TableId tableId)
      Description copied from interface: TableMappingStorage
      Retrieves the value associated with the given table identifier.
      Specified by:
      get in interface TableMappingStorage<V>
      Parameters:
      tableId - the table identifier
      Returns:
      the associated value, or null if not present
    • put

      public V put(TableId tableId, V value)
      Description copied from interface: TableMappingStorage
      Associates the specified value with the specified table identifier.
      Specified by:
      put in interface TableMappingStorage<V>
      Parameters:
      tableId - the table identifier
      value - the value to be associated
      Returns:
      the previous value associated with the table identifier, or null if there was no mapping
    • remove

      public V remove(TableId tableId)
      Description copied from interface: TableMappingStorage
      Removes the mapping for the specified table identifier.
      Specified by:
      remove in interface TableMappingStorage<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: TableMappingStorage
      Removes all mappings from this storage.
      Specified by:
      clear in interface TableMappingStorage<V>
    • size

      public int size()
      Description copied from interface: TableMappingStorage
      Returns the number of table identifier-value mappings in this storage.
      Specified by:
      size in interface TableMappingStorage<V>
      Returns:
      the number of mappings
    • isEmpty

      public boolean isEmpty()
      Description copied from interface: TableMappingStorage
      Returns true if this storage contains no mappings.
      Specified by:
      isEmpty in interface TableMappingStorage<V>
      Returns:
      true if this storage contains no mappings
    • keySet

      public Set<TableId> keySet()
      Description copied from interface: TableMappingStorage
      Returns a set view of the table identifiers contained in this storage.
      Specified by:
      keySet in interface TableMappingStorage<V>
      Returns:
      a set view of the table identifiers
    • forEach

      public void forEach(BiConsumer<? super TableId,? super V> action)
      Description copied from interface: TableMappingStorage
      Performs the given action for each entry in this storage until all entries have been processed or the action throws an exception.
      Specified by:
      forEach in interface TableMappingStorage<V>
      Parameters:
      action - the action to be performed for each entry
    • close

      public void close()
      Description copied from interface: TableMappingStorage
      Closes 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:
      close in interface AutoCloseable
      Specified by:
      close in interface TableMappingStorage<V>
    • normalizeTableId

      private TableId normalizeTableId(TableId tableId)
      Normalizes the table identifier based on case sensitivity settings.
      Parameters:
      tableId - the table identifier to normalize
      Returns:
      the normalized table identifier