mirror of
https://github.com/XRPLF/rippled.git
synced 2025-12-06 17:27:55 +00:00
[Java] Add SizeUnit in org.rocksdb.util to store const like KB, GB.
Summary: * Add a class SizeUnit to store frequently used consts. Currently it has KB, MB, GB, TB, and PB. * Change the parameter type of Options.writeBufferSize and Options.blockSize from int to long. Test Plan: make rocksdbjava make jtest Reviewers: haobo, ankgup87, sdong, dhruba Reviewed By: haobo CC: leveldb Differential Revision: https://reviews.facebook.net/D17703
This commit is contained in:
@@ -6,6 +6,7 @@
|
||||
import java.util.*;
|
||||
import java.lang.*;
|
||||
import org.rocksdb.*;
|
||||
import org.rocksdb.util.SizeUnit;
|
||||
import java.io.IOException;
|
||||
|
||||
public class RocksDBSample {
|
||||
@@ -33,17 +34,17 @@ public class RocksDBSample {
|
||||
}
|
||||
|
||||
options.setCreateIfMissing(true)
|
||||
.setWriteBufferSize(8 * 1024)
|
||||
.setWriteBufferSize(8 * SizeUnit.KB)
|
||||
.setMaxWriteBufferNumber(3)
|
||||
.setDisableSeekCompaction(true)
|
||||
.setBlockSize(64 * 1024)
|
||||
.setBlockSize(64 * SizeUnit.KB)
|
||||
.setMaxBackgroundCompactions(10);
|
||||
|
||||
assert(options.createIfMissing() == true);
|
||||
assert(options.writeBufferSize() == 8192);
|
||||
assert(options.writeBufferSize() == 8 * SizeUnit.KB);
|
||||
assert(options.maxWriteBufferNumber() == 3);
|
||||
assert(options.disableSeekCompaction() == true);
|
||||
assert(options.blockSize() == 65536);
|
||||
assert(options.blockSize() == 64 * SizeUnit.KB);
|
||||
assert(options.maxBackgroundCompactions() == 10);
|
||||
|
||||
try {
|
||||
|
||||
Reference in New Issue
Block a user