本文整理了Java中org.rocksdb.RocksDB.loadLibrary
方法的一些代码示例,展示了RocksDB.loadLibrary
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。RocksDB.loadLibrary
方法的具体详情如下:
包路径:org.rocksdb.RocksDB
类名称:RocksDB
方法名:loadLibrary
[英]Loads the necessary library files. Calling this method twice will have no effect. By default the method extracts the shared library for loading at java.io.tmpdir, however, you can override this temporary location by setting the environment variable ROCKSDB_SHAREDLIB_DIR.
[中]加载必要的库文件。调用此方法两次将无效。默认情况下,该方法提取共享库以在java上加载。伊奥。然而,tmpdir可以通过设置环境变量ROCKSDB_SHAREDLIB_DIR来覆盖这个临时位置。
代码示例来源:origin: Alluxio/alluxio
/**
* Creates and initializes a rocks block store.
*
* @param args block store args
*/
public RocksBlockStore(BlockStoreArgs args) {
mBaseDir = args.getConfiguration().get(PropertyKey.MASTER_METASTORE_DIR);
RocksDB.loadLibrary();
try {
initDb();
} catch (RocksDBException e) {
throw new RuntimeException(e);
}
}
代码示例来源:origin: apache/flink
RocksDB.loadLibrary();
代码示例来源:origin: apache/storm
RocksDB.loadLibrary();
boolean createIfMissing = ObjectReader.getBoolean(config.get(DaemonConfig.STORM_ROCKSDB_CREATE_IF_MISSING), false);
代码示例来源:origin: apache/storm
@Before
public void setUp() {
// remove any previously created cache instance
StringMetadataCache.cleanUp();
RocksDB.loadLibrary();
}
代码示例来源:origin: Alluxio/alluxio
/**
* Creates and initializes a rocks block store.
*
* @param args inode store arguments
*/
public RocksInodeStore(InodeStoreArgs args) {
mConf = args.getConf();
mBaseDir = mConf.get(PropertyKey.MASTER_METASTORE_DIR);
RocksDB.loadLibrary();
mDisableWAL = new WriteOptions().setDisableWAL(true);
mReadPrefixSameAsStart = new ReadOptions().setPrefixSameAsStart(true);
try {
initDb();
} catch (RocksDBException e) {
throw new RuntimeException(e);
}
}
代码示例来源:origin: jwplayer/southpaw
public RocksDBState() {
RocksDB.loadLibrary();
}
代码示例来源:origin: org.rocksdb/rocksdbjni
private enum LibraryState {
NOT_LOADED,
LOADING,
LOADED
}
代码示例来源:origin: pravega/pravega
/**
* Creates a new instance of the RocksDBCacheFactory class.
*
* @param config The configuration to use.
*/
public RocksDBCacheFactory(RocksDBConfig config) {
Preconditions.checkNotNull(config, "config");
this.config = config;
this.caches = new HashMap<>();
this.closed = new AtomicBoolean();
RocksDB.loadLibrary();
log.info("{}: Initialized.", LOG_ID);
}
代码示例来源:origin: nlpie/biomedicus
public RocksDbStrings(Path termsPath) {
RocksDB.loadLibrary();
try {
terms = RocksDB.openReadOnly(termsPath.toString());
} catch (RocksDBException e) {
// says "if error happens in underlying native library", can't possible hope to handle that.
throw new RuntimeException(e);
}
}
代码示例来源: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
public RocksDbIdentifiers(Path identifiersPath) {
RocksDB.loadLibrary();
try (Options options = new Options().setInfoLogLevel(InfoLogLevel.ERROR_LEVEL)) {
indices = RocksDB.openReadOnly(options, identifiersPath.toString());
} catch (RocksDBException e) {
throw new RuntimeException(e);
}
}
代码示例来源:origin: apsaltis/StreamingData-Book-Examples
static void initialize() throws Exception {
RocksDB.loadLibrary();
options = new Options().setCreateIfMissing(true);
try {
ensureDirectories();
transientStateDB = RocksDB.open(options, transientPath.toString());
failedStateDB = RocksDB.open(options, failedPath.toString());
} catch (RocksDBException | IOException e) {
e.printStackTrace();
throw new Exception(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: nlpie/biomedicus
@Override
public KnownWordsDataStore createKnownWordsDataStore(int id) {
RocksDB.loadLibrary();
try (Options options = new Options().setCreateIfMissing(true).prepareForBulkLoad()) {
Files.createDirectories(dbPath);
RocksDB rocksDB = RocksDB.open(options, dbPath.resolve(getWordsName(id)).toString());
rocksDBS.add(rocksDB);
RocksDB candidatesDB = RocksDB.open(options, dbPath.resolve(getCandidatesName(id)).toString());
rocksDBS.add(candidatesDB);
return new RocksDbKnownWordsDataStore(rocksDB, candidatesDB);
} catch (RocksDBException | IOException e) {
throw new RuntimeException(e);
}
}
代码示例来源:origin: nlpie/biomedicus
public RocksDBSenseVectors(Path path, boolean forWriting) {
RocksDB.loadLibrary();
if (forWriting) {
try (Options options = new Options().setCreateIfMissing(true).prepareForBulkLoad()) {
rocksDB = RocksDB.open(options, path.toString());
} catch (RocksDBException e) {
throw new RuntimeException(e);
}
} else {
try {
rocksDB = RocksDB.openReadOnly(path.toString());
} catch (RocksDBException e) {
throw new RuntimeException(e);
}
}
}
代码示例来源:origin: lmdbjava/benchmarks
@Override
public void setup(final BenchmarkParams b) throws IOException {
super.setup(b);
wkb = new UnsafeBuffer(new byte[keySize]);
wvb = new UnsafeBuffer(new byte[valSize]);
loadLibrary();
final Options options = new Options();
options.setCreateIfMissing(true);
options.setCompressionType(NO_COMPRESSION);
try {
db = open(options, tmp.getAbsolutePath());
} catch (final RocksDBException ex) {
throw new IOException(ex);
}
}
代码示例来源:origin: locationtech/geowave
public synchronized RocksDBDataIndexTable getDataIndexTable(
final String tableName,
final short adapterId) {
if (indexWriteOptions == null) {
RocksDB.loadLibrary();
final int cores = Runtime.getRuntime().availableProcessors();
indexWriteOptions =
new Options().setCreateIfMissing(true).prepareForBulkLoad().setIncreaseParallelism(cores);
indexReadOptions = new Options().setIncreaseParallelism(cores);
}
final String directory = subDirectory + "/" + tableName;
return dataIndexTableCache.get(
(DataIndexCacheKey) keyCache.get(directory, d -> new DataIndexCacheKey(d, adapterId)));
}
代码示例来源:origin: locationtech/geowave
public synchronized RocksDBIndexTable getIndexTable(
final String tableName,
final short adapterId,
final byte[] partition,
final boolean requiresTimestamp) {
if (indexWriteOptions == null) {
RocksDB.loadLibrary();
final int cores = Runtime.getRuntime().availableProcessors();
indexWriteOptions =
new Options().setCreateIfMissing(true).prepareForBulkLoad().setIncreaseParallelism(cores);
indexReadOptions = new Options().setIncreaseParallelism(cores);
}
final String directory = subDirectory + "/" + tableName;
return indexTableCache.get(
(IndexCacheKey) keyCache.get(
directory,
d -> new IndexCacheKey(d, adapterId, partition, requiresTimestamp)));
}
代码示例来源: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))));
}
内容来源于网络,如有侵权,请联系作者删除!