Skip to content

Commit

Permalink
Decouple StorageUnit and Map<StorageNodeName, DataSource>
Browse files Browse the repository at this point in the history
  • Loading branch information
terrymanu committed Sep 28, 2023
1 parent 49bcf13 commit 9bef0bf
Showing 1 changed file with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -39,20 +39,20 @@
@Getter
public final class StorageUnit {

private final DataSource dataSource;

private final DataSourcePoolProperties dataSourcePoolProperties;

private final StorageNode storageNode;

private final DataSource dataSource;

private final DatabaseType storageType;

private final ConnectionProperties connectionProperties;

public StorageUnit(final String databaseName, final DataSource dataSource, final DataSourcePoolProperties props, final StorageNode storageNode) {
this.dataSourcePoolProperties = props;
this.storageNode = storageNode;
public StorageUnit(final String databaseName, final DataSource dataSource, final DataSourcePoolProperties dataSourcePoolProperties, final StorageNode storageNode) {
this.dataSource = new CatalogSwitchableDataSource(dataSource, storageNode.getCatalog(), storageNode.getUrl());
this.dataSourcePoolProperties = dataSourcePoolProperties;
this.storageNode = storageNode;
boolean isDataSourceEnabled = !DataSourceStateManager.getInstance().getEnabledDataSources(databaseName, Collections.singletonMap(storageNode.getName().getName(), dataSource)).isEmpty();
storageType = createStorageType(isDataSourceEnabled);
connectionProperties = createConnectionProperties(isDataSourceEnabled);
Expand Down

0 comments on commit 9bef0bf

Please sign in to comment.