Class RouteContext

java.lang.Object
org.apache.shardingsphere.infra.route.context.RouteContext

public final class RouteContext extends Object
Route context.
  • Constructor Details

    • RouteContext

      public RouteContext()
  • Method Details

    • isSingleRouting

      public boolean isSingleRouting()
      Judge is route for single database and table only or not.
      Returns:
      is route for single database and table only or not
    • getActualDataSourceNames

      public Collection<String> getActualDataSourceNames()
      Get actual data source names.
      Returns:
      actual data source names
    • getActualTableNameGroups

      public List<Set<String>> getActualTableNameGroups(String actualDataSourceName, Set<String> logicTableNames)
      Get actual tables groups.

      Actual tables in same group are belong one logic name.

      Parameters:
      actualDataSourceName - actual data source name
      logicTableNames - logic table names
      Returns:
      actual table groups
    • getDataSourceLogicTablesMap

      public Map<String,Set<String>> getDataSourceLogicTablesMap(Collection<String> actualDataSourceNames)
      Get map relationship between actual data source and logic tables.
      Parameters:
      actualDataSourceNames - actual data source names
      Returns:
      map relationship between data source and logic tables
    • findTableMapper

      public Optional<RouteMapper> findTableMapper(String logicDataSourceName, String actualTableName)
      Find table mapper.
      Parameters:
      logicDataSourceName - logic data source name
      actualTableName - actual table name
      Returns:
      table mapper
    • putRouteUnit

      public void putRouteUnit(RouteMapper dataSourceMapper, Collection<RouteMapper> tableMappers)
      Put route unit.
      Parameters:
      dataSourceMapper - database mapper
      tableMappers - table mapper collection
    • containsTableSharding

      public boolean containsTableSharding()
      Judge whether route context contains table sharding or not.
      Returns:
      whether route context contains table sharding or not