Skip to content

Commit 9d81563

Browse files
committed
fix conflict
2 parents d29d7c9 + 8ba0f58 commit 9d81563

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+3179
-44
lines changed

build.gradle

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,8 @@ dependencies {
116116

117117
compile "org.iq80.leveldb:leveldb:0.7"
118118

119+
compile group: 'org.rocksdb', name: 'rocksdbjni', version: '5.15.10'
120+
119121
compile group: leveldbGroup, name: leveldbName, version: leveldbVersion
120122

121123
compile "org.apache.commons:commons-collections4:4.0"

src/main/java/org/tron/common/application/ApplicationImpl.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ public void startup() {
6868
@Override
6969
public void shutdown() {
7070
logger.info("******** begin to shutdown ********");
71+
//p2pNode.shutDown();
7172
synchronized (dbManager.getRevokingStore()) {
7273
closeRevokingStore();
7374
closeAllStore();
@@ -124,6 +125,7 @@ private void closeConnection() {
124125
}
125126

126127
private void closeRevokingStore() {
128+
logger.info("******** begin to closeRevokingStore ********");
127129
dbManager.getRevokingStore().shutdown();
128130
}
129131

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
package org.tron.common.storage;
2+
3+
import java.util.Map;
4+
import org.rocksdb.WriteOptions;
5+
6+
7+
public interface BatchSourceInterRocks<K, V> extends SourceInterRocks<K, V> {
8+
9+
10+
void updateByBatch(Map<K, V> rows);
11+
12+
void updateByBatch(Map<K, V> rows, WriteOptions writeOptions);
13+
14+
void putData(K key, V val);
15+
16+
V getData(K key);
17+
18+
19+
void deleteData(K key);
20+
21+
boolean flush();
22+
23+
}
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
package org.tron.common.storage;
2+
3+
4+
public class DBSettings {
5+
6+
public static final DBSettings DEFAULT = new DBSettings()
7+
.withMaxThreads(1)
8+
.withMaxOpenFiles(-1);
9+
10+
int maxOpenFiles;
11+
int maxThreads;
12+
13+
private DBSettings() {
14+
}
15+
16+
public static DBSettings newInstance() {
17+
DBSettings settings = new DBSettings();
18+
settings.maxOpenFiles = DEFAULT.maxOpenFiles;
19+
settings.maxThreads = DEFAULT.maxThreads;
20+
return settings;
21+
}
22+
23+
public int getMaxOpenFiles() {
24+
return maxOpenFiles;
25+
}
26+
27+
public DBSettings withMaxOpenFiles(int maxOpenFiles) {
28+
this.maxOpenFiles = maxOpenFiles;
29+
return this;
30+
}
31+
32+
public int getMaxThreads() {
33+
return maxThreads;
34+
}
35+
36+
public DBSettings withMaxThreads(int maxThreads) {
37+
this.maxThreads = maxThreads;
38+
return this;
39+
}
40+
}
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
package org.tron.common.storage;
2+
3+
import java.util.Set;
4+
5+
public interface DbSourceInterRocks<V> extends BatchSourceInterRocks<byte[], V> {
6+
7+
String getDBName();
8+
9+
void setDBName(String name);
10+
11+
void initDB();
12+
13+
boolean isAlive();
14+
15+
void closeDB();
16+
17+
void resetDb();
18+
19+
Set<byte[]> allKeys() throws RuntimeException;
20+
21+
Set<byte[]> allValues() throws RuntimeException;
22+
23+
long getTotal() throws RuntimeException;
24+
25+
}
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
package org.tron.common.storage;
2+
3+
4+
import org.rocksdb.WriteOptions;
5+
6+
public interface SourceInterRocks<K, V> {
7+
8+
void putData(K key, V val);
9+
10+
void putData(K k, V v, WriteOptions options);
11+
12+
V getData(K key);
13+
14+
void deleteData(K key);
15+
16+
void deleteData(K k, WriteOptions options);
17+
18+
boolean flush();
19+
}

0 commit comments

Comments
 (0)