|
25 | 25 | import lombok.Getter; |
26 | 26 | import lombok.Setter; |
27 | 27 | import lombok.extern.slf4j.Slf4j; |
28 | | -import org.apache.commons.lang3.StringUtils; |
29 | 28 | import org.iq80.leveldb.CompressionType; |
30 | 29 | import org.iq80.leveldb.Options; |
31 | 30 | import org.tron.common.cache.CacheStrategies; |
@@ -124,78 +123,6 @@ public class Storage { |
124 | 123 | // db root |
125 | 124 | private final Map<String, Sha256Hash> dbRoots = Maps.newConcurrentMap(); |
126 | 125 |
|
127 | | - /** |
128 | | - * All getXxxFromConfig methods now read from StorageConfig bean instead of |
129 | | - * manual string constants. Signatures preserved for backward compatibility. |
130 | | - */ |
131 | | - |
132 | | - public static String getDbEngineFromConfig(final Config config) { |
133 | | - return StorageConfig.fromConfig(config).getDb().getEngine(); |
134 | | - } |
135 | | - |
136 | | - public static Boolean getDbVersionSyncFromConfig(final Config config) { |
137 | | - return StorageConfig.fromConfig(config).getDb().isSync(); |
138 | | - } |
139 | | - |
140 | | - public static int getSnapshotMaxFlushCountFromConfig(final Config config) { |
141 | | - int maxFlushCountConfig = StorageConfig.fromConfig(config) |
142 | | - .getSnapshot().getMaxFlushCount(); |
143 | | - if (maxFlushCountConfig <= 0) { |
144 | | - throw new IllegalArgumentException("MaxFlushCount value can not be negative or zero!"); |
145 | | - } |
146 | | - if (maxFlushCountConfig > 500) { |
147 | | - throw new IllegalArgumentException("MaxFlushCount value must not exceed 500!"); |
148 | | - } |
149 | | - return maxFlushCountConfig; |
150 | | - } |
151 | | - |
152 | | - public static Boolean getContractParseSwitchFromConfig(final Config config) { |
153 | | - // contractParse is under event.subscribe, not storage — read from EventConfig |
154 | | - EventConfig ec = EventConfig.fromConfig(config); |
155 | | - return ec.isContractParse(); |
156 | | - } |
157 | | - |
158 | | - public static String getDbDirectoryFromConfig(final Config config) { |
159 | | - return StorageConfig.fromConfig(config).getDb().getDirectory(); |
160 | | - } |
161 | | - |
162 | | - public static String getIndexDirectoryFromConfig(final Config config) { |
163 | | - return StorageConfig.fromConfig(config).getIndex().getDirectory(); |
164 | | - } |
165 | | - |
166 | | - public static String getIndexSwitchFromConfig(final Config config) { |
167 | | - String val = StorageConfig.fromConfig(config).getIndex().getSwitch(); |
168 | | - return StringUtils.isNotEmpty(val) ? val : DEFAULT_INDEX_SWITCH; |
169 | | - } |
170 | | - |
171 | | - public static String getTransactionHistorySwitchFromConfig(final Config config) { |
172 | | - return StorageConfig.fromConfig(config).getTransHistory().getSwitch(); |
173 | | - } |
174 | | - |
175 | | - public static int getCheckpointVersionFromConfig(final Config config) { |
176 | | - return StorageConfig.fromConfig(config).getCheckpoint().getVersion(); |
177 | | - } |
178 | | - |
179 | | - public static boolean getCheckpointSyncFromConfig(final Config config) { |
180 | | - return StorageConfig.fromConfig(config).getCheckpoint().isSync(); |
181 | | - } |
182 | | - |
183 | | - public static int getEstimatedTransactionsFromConfig(final Config config) { |
184 | | - int estimatedTransactions = StorageConfig.fromConfig(config) |
185 | | - .getTxCache().getEstimatedTransactions(); |
186 | | - if (estimatedTransactions > 10000) { |
187 | | - estimatedTransactions = 10000; |
188 | | - } else if (estimatedTransactions < 100) { |
189 | | - estimatedTransactions = 100; |
190 | | - } |
191 | | - return estimatedTransactions; |
192 | | - } |
193 | | - |
194 | | - public static boolean getTxCacheInitOptimizationFromConfig(final Config config) { |
195 | | - return StorageConfig.fromConfig(config).getTxCache().isInitOptimization(); |
196 | | - } |
197 | | - |
198 | | - |
199 | 126 | /** |
200 | 127 | * Accepts raw storage Config sub-tree because cache.strategies has dynamic keys |
201 | 128 | * (CacheType enum names) that ConfigBeanFactory cannot bind to fixed bean fields. |
|
0 commit comments