File tree Expand file tree Collapse file tree 4 files changed +55
-4
lines changed Expand file tree Collapse file tree 4 files changed +55
-4
lines changed Original file line number Diff line number Diff line change @@ -6,6 +6,30 @@ version '1.0.0'
6
6
7
7
sourceCompatibility = 1.8
8
8
9
+ // Dependency versions
10
+ // ---------------------------------------
11
+
12
+ def leveldbVersion = " 1.8"
13
+ // --------------------------------------
14
+
15
+ static def isWindows () {
16
+ return org.gradle.internal.os.OperatingSystem . current(). isWindows()
17
+ }
18
+
19
+ if (isWindows()) {
20
+ ext {
21
+ leveldbGroup = " org.ethereum"
22
+ leveldbName = " leveldbjni-all"
23
+ leveldbVersion = " 1.18.3"
24
+ }
25
+ } else {
26
+ ext {
27
+ leveldbGroup = " org.fusesource.leveldbjni"
28
+ leveldbName = " leveldbjni-all"
29
+ leveldbVersion = " 1.8"
30
+ }
31
+ }
32
+
9
33
repositories {
10
34
mavenCentral()
11
35
}
@@ -20,5 +44,6 @@ dependencies {
20
44
compile group : ' commons-codec' , name : ' commons-codec' , version : ' 1.11'
21
45
compile group : ' com.beust' , name : ' jcommander' , version : ' 1.72'
22
46
compile group : ' com.typesafe' , name : ' config' , version : ' 1.3.2'
47
+ compile group : leveldbGroup, name : leveldbName, version : leveldbVersion
23
48
compile project(" :protocol" )
24
49
}
Original file line number Diff line number Diff line change
1
+ package org .tron .common .utils ;
2
+ import org .iq80 .leveldb .CompressionType ;
3
+ import org .iq80 .leveldb .Options ;
4
+
5
+
6
+ public class DbOptionalsUtils {
7
+ public static final CompressionType DEFAULT_COMPRESSION_TYPE = CompressionType .SNAPPY ;
8
+ public static final int DEFAULT_BLOCK_SIZE = 4 * 1024 ;
9
+ public static final int DEFAULT_WRITE_BUFFER_SIZE = 10 * 1024 * 1024 ;
10
+ public static final long DEFAULT_CACHE_SIZE = 10 * 1024 * 1024L ;
11
+ public static final int DEFAULT_MAX_OPEN_FILES = 100 ;
12
+
13
+ public static Options createDefaultDbOptions () {
14
+ Options dbOptions = new Options ();
15
+
16
+ dbOptions .createIfMissing (true );
17
+ dbOptions .paranoidChecks (true );
18
+ dbOptions .verifyChecksums (true );
19
+
20
+ dbOptions .compressionType (DEFAULT_COMPRESSION_TYPE );
21
+ dbOptions .blockSize (DEFAULT_BLOCK_SIZE );
22
+ dbOptions .writeBufferSize (DEFAULT_WRITE_BUFFER_SIZE );
23
+ dbOptions .cacheSize (DEFAULT_CACHE_SIZE );
24
+ dbOptions .maxOpenFiles (DEFAULT_MAX_OPEN_FILES );
25
+
26
+ return dbOptions ;
27
+ }
28
+ }
File renamed without changes.
Original file line number Diff line number Diff line change 15
15
16
16
package org .tron .core .config .args ;
17
17
18
- import static org .tron .common .utils .StorageUtils .DEFAULT_COMPRESSION_TYPE ;
19
-
20
18
import com .typesafe .config .Config ;
21
19
import com .typesafe .config .ConfigObject ;
22
20
import java .io .File ;
29
27
import org .iq80 .leveldb .Options ;
30
28
import org .tron .common .utils .FileUtil ;
31
29
import org .tron .common .utils .Property ;
32
- import org .tron .common .utils .StorageUtils ;
30
+ import org .tron .common .utils .DbOptionalsUtils ;
33
31
34
32
/**
35
33
* Custom storage configurations
@@ -192,7 +190,7 @@ private static Property createProperty(final ConfigObject conf) {
192
190
}
193
191
194
192
// Check, get and set fields of Options
195
- Options dbOptions = StorageUtils .createDefaultDbOptions ();
193
+ Options dbOptions = DbOptionalsUtils .createDefaultDbOptions ();
196
194
197
195
if (conf .containsKey (CREATE_IF_MISSING_CONFIG_KEY )) {
198
196
dbOptions .createIfMissing (
You can’t perform that action at this time.
0 commit comments