本文整理了Java中org.rocksdb.Options.<init>()
方法的一些代码示例,展示了Options.<init>()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Options.<init>()
方法的具体详情如下:
包路径:org.rocksdb.Options
类名称:Options
方法名:<init>
[英]Construct options for opening a RocksDB. This constructor will create (by allocating a block of memory) an rocksdb::Options in the c++ side.
[中]构造用于打开RocksDB的选项。这个构造函数将创建(通过分配内存块)C++中的ROCKSDB::选项。
代码示例来源:origin: apache/kylin
public RocksDBLookupTable(TableDesc tableDesc, String[] keyColumns, String dbPath) {
this.options = new Options();
this.rowEncoder = new RocksDBLookupRowEncoder(tableDesc, keyColumns);
try {
this.rocksDB = RocksDB.openReadOnly(options, dbPath);
} catch (RocksDBException e) {
throw new IllegalStateException("cannot open rocks db in path:" + dbPath, e);
}
}
代码示例来源:origin: alibaba/jstorm
public void initDb(List<Integer> list) throws Exception {
Options dbOptions = new Options().setCreateMissingColumnFamilies(true).setCreateIfMissing(true);
initDb(list, dbOptions);
}
代码示例来源:origin: apache/storm
boolean createIfMissing = ObjectReader.getBoolean(config.get(DaemonConfig.STORM_ROCKSDB_CREATE_IF_MISSING), false);
try (Options options = new Options().setCreateIfMissing(createIfMissing)) {
代码示例来源:origin: alibaba/jstorm
public RocksDbCacheOperator(TopologyContext context, String cacheDir) {
this.stormConf = context.getStormConf();
this.maxFlushSize = ConfigExtension.getTransactionCacheBatchFlushSize(stormConf);
Options rocksDbOpt = new Options();
rocksDbOpt.setCreateMissingColumnFamilies(true).setCreateIfMissing(true);
long bufferSize =
ConfigExtension.getTransactionCacheBlockSize(stormConf) != null ? ConfigExtension.getTransactionCacheBlockSize(stormConf) : (1 * SizeUnit.GB);
rocksDbOpt.setWriteBufferSize(bufferSize);
int maxBufferNum = ConfigExtension.getTransactionMaxCacheBlockNum(stormConf) != null ? ConfigExtension.getTransactionMaxCacheBlockNum(stormConf) : 3;
rocksDbOpt.setMaxWriteBufferNumber(maxBufferNum);
// Config for log of RocksDb
rocksDbOpt.setMaxLogFileSize(1073741824); // 1G
rocksDbOpt.setKeepLogFileNum(1);
rocksDbOpt.setInfoLogLevel(InfoLogLevel.WARN_LEVEL);
try {
Map<Object, Object> conf = new HashMap<Object, Object>();
conf.put(ROCKSDB_ROOT_DIR, cacheDir);
conf.put(ROCKSDB_RESET, true);
initDir(conf);
initDb(null, rocksDbOpt);
} catch (Exception e) {
throw new RuntimeException(e);
}
kryo = new Kryo();
output = new Output(200, 2000000000);
input = new Input(1);
LOG.info("Finished rocksDb cache init: maxFlushSize={}, bufferSize={}, maxBufferNum={}", maxFlushSize, bufferSize, maxBufferNum);
}
代码示例来源:origin: brianfrankcooper/YCSB
final Options options = new Options()
.optimizeLevelStyleCompaction()
.setCreateIfMissing(true)
代码示例来源:origin: alibaba/jstorm
Options options = new Options();
options.setCreateMissingColumnFamilies(true);
options.setCreateIfMissing(true);
代码示例来源:origin: apache/kylin
public RocksDBLookupBuilder(TableDesc tableDesc, String[] keyColumns, String dbPath) {
this.tableDesc = tableDesc;
this.encoder = new RocksDBLookupRowEncoder(tableDesc, keyColumns);
this.dbPath = dbPath;
this.writeBatchSize = 500;
this.options = new Options();
options.setCreateIfMissing(true).setWriteBufferSize(8 * SizeUnit.KB).setMaxWriteBufferNumber(3)
.setMaxBackgroundCompactions(5).setCompressionType(CompressionType.SNAPPY_COMPRESSION)
.setCompactionStyle(CompactionStyle.UNIVERSAL);
}
代码示例来源:origin: ethereum/ethereumj
try (Options options = new Options()) {
代码示例来源:origin: hugegraph/hugegraph
public static Set<String> listCFs(String path) throws RocksDBException {
Set<String> cfs = new HashSet<>();
List<byte[]> oldCFs = RocksDB.listColumnFamilies(new Options(), path);
if (oldCFs.isEmpty()) {
cfs.add("default");
} else {
for (byte[] oldCF : oldCFs) {
cfs.add(decode(oldCF));
}
}
return cfs;
}
代码示例来源:origin: ltsopensource/light-task-scheduler
@Override
protected void init() throws FailStoreException {
try {
options = new Options();
options.setCreateIfMissing(true)
.setWriteBufferSize(8 * SizeUnit.KB)
.setMaxWriteBufferNumber(3)
.setMaxBackgroundCompactions(10)
.setCompressionType(CompressionType.SNAPPY_COMPRESSION)
.setCompactionStyle(CompactionStyle.UNIVERSAL);
Filter bloomFilter = new BloomFilter(10);
BlockBasedTableConfig tableConfig = new BlockBasedTableConfig();
tableConfig.setBlockCacheSize(64 * SizeUnit.KB)
.setFilter(bloomFilter)
.setCacheNumShardBits(6)
.setBlockSizeDeviation(5)
.setBlockRestartInterval(10)
.setCacheIndexAndFilterBlocks(true)
.setHashIndexAllowCollision(false)
.setBlockCacheCompressedSize(64 * SizeUnit.KB)
.setBlockCacheCompressedNumShardBits(10);
options.setTableFormatConfig(tableConfig);
} catch (Exception e) {
throw new FailStoreException(e);
}
}
代码示例来源:origin: ltsopensource/light-task-scheduler
@Override
protected void init() throws FailStoreException {
try {
options = new Options();
options.setCreateIfMissing(true)
.setWriteBufferSize(8 * SizeUnit.KB)
.setMaxWriteBufferNumber(3)
.setMaxBackgroundCompactions(10)
.setCompressionType(CompressionType.SNAPPY_COMPRESSION)
.setCompactionStyle(CompactionStyle.UNIVERSAL);
Filter bloomFilter = new BloomFilter(10);
BlockBasedTableConfig tableConfig = new BlockBasedTableConfig();
tableConfig.setBlockCacheSize(64 * SizeUnit.KB)
.setFilter(bloomFilter)
.setCacheNumShardBits(6)
.setBlockSizeDeviation(5)
.setBlockRestartInterval(10)
.setCacheIndexAndFilterBlocks(true)
.setHashIndexAllowCollision(false)
.setBlockCacheCompressedSize(64 * SizeUnit.KB)
.setBlockCacheCompressedNumShardBits(10);
options.setTableFormatConfig(tableConfig);
} catch (Exception e) {
throw new FailStoreException(e);
}
}
代码示例来源:origin: alibaba/jstorm
@Override
public Options createOptions(Options currentOptions) {
if (currentOptions == null)
currentOptions = new Options();
currentOptions.setCreateIfMissing(true);
currentOptions.setCreateMissingColumnFamilies(true);
代码示例来源:origin: hugegraph/hugegraph
@Override
public void createTable(String table) throws RocksDBException {
EnvOptions env = new EnvOptions();
Options options = new Options();
RocksDBStdSessions.initOptions(this.conf, options, options, options);
// NOTE: unset merge op due to SIGSEGV when cf.setMergeOperatorName()
options.setMergeOperatorName("not-exist-merge-op");
SstFileWriter sst = new SstFileWriter(env, options);
Path path = Paths.get(this.dataPath, table);
sst.open(path.toString() + ".sst");
this.tables.put(table, sst);
}
代码示例来源:origin: hugegraph/hugegraph
public RocksDBStdSessions(HugeConfig config, String dataPath,
String walPath, String database, String store)
throws RocksDBException {
super(database, store);
this.conf = config;
// Init options
Options options = new Options();
RocksDBStdSessions.initOptions(this.conf, options, options, options);
options.setWalDir(walPath);
/*
* Open RocksDB at the first time
* Don't merge old CFs, we expect a clear DB when using this one
*/
this.rocksdb = RocksDB.open(options, dataPath);
}
代码示例来源:origin: com.baidu.hugegraph/hugegraph-rocksdb
public static Set<String> listCFs(String path) throws RocksDBException {
Set<String> cfs = new HashSet<>();
List<byte[]> oldCFs = RocksDB.listColumnFamilies(new Options(), path);
if (oldCFs.isEmpty()) {
cfs.add("default");
} else {
for (byte[] oldCF : oldCFs) {
cfs.add(decode(oldCF));
}
}
return cfs;
}
代码示例来源:origin: nlpie/biomedicus
RocksDBNormalizerModel(Path dbPath) {
RocksDB.loadLibrary();
try (Options options = new Options().setInfoLogLevel(InfoLogLevel.ERROR_LEVEL)) {
db = RocksDB.openReadOnly(options, dbPath.toString());
} catch (RocksDBException e) {
throw new RuntimeException(e);
}
}
代码示例来源:origin: nlpie/biomedicus
@Override
public SuffixDataStore createSuffixDataStore(int id) {
RocksDB.loadLibrary();
try (Options options = new Options().setCreateIfMissing(true).prepareForBulkLoad()) {
Files.createDirectories(dbPath);
RocksDB rocksDB = RocksDB.open(options, dbPath.resolve(getSuffixesName(id)).toString());
rocksDBS.add(rocksDB);
return new RocksDbSuffixDataStore(rocksDB);
} catch (RocksDBException | IOException e) {
throw new RuntimeException(e);
}
}
代码示例来源:origin: apache/samza
@BeforeClass
static public void createRocksDb() throws IOException, RocksDBException {
if (Files.exists(dirPath)) {
removeRecursiveDirectory(dirPath);
}
Files.createDirectories(dirPath);
Options options = new Options().setCreateIfMissing(true);
db = RocksDB.open(options, dirPath.toString());
db.put("testString".getBytes(), "this is string".getBytes());
db.put(ByteBuffer.allocate(4).putInt(123).array(), ByteBuffer.allocate(4).putInt(456).array());
}
代码示例来源:origin: weiboad/fiery
public DBSharder(String dbpath, Long timestamp) throws RocksDBException {
log = LoggerFactory.getLogger(DBSharder.class);
RocksDB.loadLibrary();
options = new Options();
env = options.getEnv();
env.setBackgroundThreads(2);
options.setEnv(env);
options.setCreateIfMissing(true);
options.setDbLogDir(dbpath + "/logs/");
options.setMergeOperator(new StringAppendOperator());
db = RocksDB.open(options, dbpath + "/" + timestamp);
}
代码示例来源:origin: locationtech/geowave
public synchronized RocksDBMetadataTable getMetadataTable(final MetadataType type) {
if (metadataOptions == null) {
RocksDB.loadLibrary();
metadataOptions = new Options().setCreateIfMissing(true).optimizeForSmallDb();
}
final String directory = subDirectory + "/" + type.name();
return metadataTableCache.get(
keyCache.get(directory, d -> new CacheKey(d, type.equals(MetadataType.STATS))));
}
内容来源于网络,如有侵权,请联系作者删除!