Skip to content

Commit

Permalink
Remove useless StorageUnit.storageNode
Browse files Browse the repository at this point in the history
  • Loading branch information
terrymanu committed Oct 4, 2023
1 parent 14d2274 commit a0f28b8
Showing 1 changed file with 2 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -43,26 +43,23 @@ public final class StorageUnit {

private final DataSourcePoolProperties dataSourcePoolProperties;

private final StorageNode storageNode;

private final DatabaseType storageType;

private final ConnectionProperties connectionProperties;

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);
connectionProperties = createConnectionProperties(isDataSourceEnabled, storageNode);
}

private DatabaseType createStorageType(final boolean isDataSourceEnabled) {
return DatabaseTypeEngine.getStorageType(isDataSourceEnabled ? Collections.singleton(dataSource) : Collections.emptyList());
}

private ConnectionProperties createConnectionProperties(final boolean isDataSourceEnabled) {
private ConnectionProperties createConnectionProperties(final boolean isDataSourceEnabled, final StorageNode storageNode) {
if (!isDataSourceEnabled) {
return null;
}
Expand Down

0 comments on commit a0f28b8

Please sign in to comment.