Skip to content

Commit e42cb35

Browse files
committed
feat(db): mark allKeys,allValues,getTotal as Deprecated and VisibleForTesting
1 parent 246900e commit e42cb35

File tree

3 files changed

+15
-3
lines changed

3 files changed

+15
-3
lines changed

chainbase/src/main/java/org/tron/common/storage/leveldb/LevelDbDataSourceImpl.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717

1818
import static org.fusesource.leveldbjni.JniDBFactory.factory;
1919

20+
import com.google.common.annotations.VisibleForTesting;
2021
import com.google.common.collect.Sets;
2122
import com.google.common.primitives.Bytes;
2223
import java.io.File;
@@ -251,6 +252,7 @@ public void deleteData(byte[] key) {
251252
}
252253

253254
@Deprecated
255+
@VisibleForTesting
254256
@Override
255257
public Set<byte[]> allKeys() {
256258
resetDbLock.readLock().lock();
@@ -268,6 +270,7 @@ public Set<byte[]> allKeys() {
268270
}
269271

270272
@Deprecated
273+
@VisibleForTesting
271274
@Override
272275
public Set<byte[]> allValues() {
273276
resetDbLock.readLock().lock();
@@ -388,6 +391,7 @@ public Map<WrappedByteArray, byte[]> prefixQuery(byte[] key) {
388391
}
389392

390393
@Deprecated
394+
@VisibleForTesting
391395
@Override
392396
public long getTotal() throws RuntimeException {
393397
resetDbLock.readLock().lock();

chainbase/src/main/java/org/tron/common/storage/rocksdb/RocksDbDataSourceImpl.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,7 @@ private static void checkArgNotNull(Object value, String name) {
128128
}
129129

130130
@Deprecated
131+
@VisibleForTesting
131132
@Override
132133
public Set<byte[]> allKeys() throws RuntimeException {
133134
resetDbLock.readLock().lock();
@@ -143,6 +144,7 @@ public Set<byte[]> allKeys() throws RuntimeException {
143144
}
144145

145146
@Deprecated
147+
@VisibleForTesting
146148
@Override
147149
public Set<byte[]> allValues() throws RuntimeException {
148150
resetDbLock.readLock().lock();
@@ -158,6 +160,7 @@ public Set<byte[]> allValues() throws RuntimeException {
158160
}
159161

160162
@Deprecated
163+
@VisibleForTesting
161164
@Override
162165
public long getTotal() throws RuntimeException {
163166
resetDbLock.readLock().lock();

chainbase/src/main/java/org/tron/core/db/common/DbSourceInter.java

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,10 @@
1717
*/
1818
package org.tron.core.db.common;
1919

20-
import org.tron.core.db2.common.WrappedByteArray;
21-
20+
import com.google.common.annotations.VisibleForTesting;
2221
import java.util.Map;
2322
import java.util.Set;
24-
23+
import org.tron.core.db2.common.WrappedByteArray;
2524

2625
public interface DbSourceInter<V> extends BatchSourceInter<byte[], V>,
2726
Iterable<Map.Entry<byte[], V>> {
@@ -38,10 +37,16 @@ public interface DbSourceInter<V> extends BatchSourceInter<byte[], V>,
3837

3938
void resetDb();
4039

40+
@VisibleForTesting
41+
@Deprecated
4142
Set<byte[]> allKeys() throws RuntimeException;
4243

44+
@VisibleForTesting
45+
@Deprecated
4346
Set<byte[]> allValues() throws RuntimeException;
4447

48+
@VisibleForTesting
49+
@Deprecated
4550
long getTotal() throws RuntimeException;
4651

4752
void stat();

0 commit comments

Comments
 (0)