org.rocksdb.RocksDB.loadLibrary()方法的使用及代码示例

x33g5p2x  于2022-01-28 转载在 其他  
字(7.4k)|赞(0)|评价(0)|浏览(398)

本文整理了Java中org.rocksdb.RocksDB.loadLibrary方法的一些代码示例,展示了RocksDB.loadLibrary的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。RocksDB.loadLibrary方法的具体详情如下:
包路径:org.rocksdb.RocksDB
类名称:RocksDB
方法名:loadLibrary

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

  1. /**
  2. * Creates and initializes a rocks block store.
  3. *
  4. * @param args block store args
  5. */
  6. public RocksBlockStore(BlockStoreArgs args) {
  7. mBaseDir = args.getConfiguration().get(PropertyKey.MASTER_METASTORE_DIR);
  8. RocksDB.loadLibrary();
  9. try {
  10. initDb();
  11. } catch (RocksDBException e) {
  12. throw new RuntimeException(e);
  13. }
  14. }

代码示例来源:origin: apache/flink

  1. RocksDB.loadLibrary();

代码示例来源:origin: apache/storm

  1. RocksDB.loadLibrary();
  2. boolean createIfMissing = ObjectReader.getBoolean(config.get(DaemonConfig.STORM_ROCKSDB_CREATE_IF_MISSING), false);

代码示例来源:origin: apache/storm

  1. @Before
  2. public void setUp() {
  3. // remove any previously created cache instance
  4. StringMetadataCache.cleanUp();
  5. RocksDB.loadLibrary();
  6. }

代码示例来源:origin: Alluxio/alluxio

  1. /**
  2. * Creates and initializes a rocks block store.
  3. *
  4. * @param args inode store arguments
  5. */
  6. public RocksInodeStore(InodeStoreArgs args) {
  7. mConf = args.getConf();
  8. mBaseDir = mConf.get(PropertyKey.MASTER_METASTORE_DIR);
  9. RocksDB.loadLibrary();
  10. mDisableWAL = new WriteOptions().setDisableWAL(true);
  11. mReadPrefixSameAsStart = new ReadOptions().setPrefixSameAsStart(true);
  12. try {
  13. initDb();
  14. } catch (RocksDBException e) {
  15. throw new RuntimeException(e);
  16. }
  17. }

代码示例来源:origin: jwplayer/southpaw

  1. public RocksDBState() {
  2. RocksDB.loadLibrary();
  3. }

代码示例来源:origin: org.rocksdb/rocksdbjni

  1. private enum LibraryState {
  2. NOT_LOADED,
  3. LOADING,
  4. LOADED
  5. }

代码示例来源:origin: pravega/pravega

  1. /**
  2. * Creates a new instance of the RocksDBCacheFactory class.
  3. *
  4. * @param config The configuration to use.
  5. */
  6. public RocksDBCacheFactory(RocksDBConfig config) {
  7. Preconditions.checkNotNull(config, "config");
  8. this.config = config;
  9. this.caches = new HashMap<>();
  10. this.closed = new AtomicBoolean();
  11. RocksDB.loadLibrary();
  12. log.info("{}: Initialized.", LOG_ID);
  13. }

代码示例来源:origin: nlpie/biomedicus

  1. public RocksDbStrings(Path termsPath) {
  2. RocksDB.loadLibrary();
  3. try {
  4. terms = RocksDB.openReadOnly(termsPath.toString());
  5. } catch (RocksDBException e) {
  6. // says "if error happens in underlying native library", can't possible hope to handle that.
  7. throw new RuntimeException(e);
  8. }
  9. }

代码示例来源:origin: nlpie/biomedicus

  1. RocksDBNormalizerModel(Path dbPath) {
  2. RocksDB.loadLibrary();
  3. try (Options options = new Options().setInfoLogLevel(InfoLogLevel.ERROR_LEVEL)) {
  4. db = RocksDB.openReadOnly(options, dbPath.toString());
  5. } catch (RocksDBException e) {
  6. throw new RuntimeException(e);
  7. }
  8. }

代码示例来源:origin: nlpie/biomedicus

  1. public RocksDbIdentifiers(Path identifiersPath) {
  2. RocksDB.loadLibrary();
  3. try (Options options = new Options().setInfoLogLevel(InfoLogLevel.ERROR_LEVEL)) {
  4. indices = RocksDB.openReadOnly(options, identifiersPath.toString());
  5. } catch (RocksDBException e) {
  6. throw new RuntimeException(e);
  7. }
  8. }

代码示例来源:origin: apsaltis/StreamingData-Book-Examples

  1. static void initialize() throws Exception {
  2. RocksDB.loadLibrary();
  3. options = new Options().setCreateIfMissing(true);
  4. try {
  5. ensureDirectories();
  6. transientStateDB = RocksDB.open(options, transientPath.toString());
  7. failedStateDB = RocksDB.open(options, failedPath.toString());
  8. } catch (RocksDBException | IOException e) {
  9. e.printStackTrace();
  10. throw new Exception(e);
  11. }
  12. }

代码示例来源:origin: nlpie/biomedicus

  1. @Override
  2. public SuffixDataStore createSuffixDataStore(int id) {
  3. RocksDB.loadLibrary();
  4. try (Options options = new Options().setCreateIfMissing(true).prepareForBulkLoad()) {
  5. Files.createDirectories(dbPath);
  6. RocksDB rocksDB = RocksDB.open(options, dbPath.resolve(getSuffixesName(id)).toString());
  7. rocksDBS.add(rocksDB);
  8. return new RocksDbSuffixDataStore(rocksDB);
  9. } catch (RocksDBException | IOException e) {
  10. throw new RuntimeException(e);
  11. }
  12. }

代码示例来源:origin: nlpie/biomedicus

  1. @Override
  2. public KnownWordsDataStore createKnownWordsDataStore(int id) {
  3. RocksDB.loadLibrary();
  4. try (Options options = new Options().setCreateIfMissing(true).prepareForBulkLoad()) {
  5. Files.createDirectories(dbPath);
  6. RocksDB rocksDB = RocksDB.open(options, dbPath.resolve(getWordsName(id)).toString());
  7. rocksDBS.add(rocksDB);
  8. RocksDB candidatesDB = RocksDB.open(options, dbPath.resolve(getCandidatesName(id)).toString());
  9. rocksDBS.add(candidatesDB);
  10. return new RocksDbKnownWordsDataStore(rocksDB, candidatesDB);
  11. } catch (RocksDBException | IOException e) {
  12. throw new RuntimeException(e);
  13. }
  14. }

代码示例来源:origin: nlpie/biomedicus

  1. public RocksDBSenseVectors(Path path, boolean forWriting) {
  2. RocksDB.loadLibrary();
  3. if (forWriting) {
  4. try (Options options = new Options().setCreateIfMissing(true).prepareForBulkLoad()) {
  5. rocksDB = RocksDB.open(options, path.toString());
  6. } catch (RocksDBException e) {
  7. throw new RuntimeException(e);
  8. }
  9. } else {
  10. try {
  11. rocksDB = RocksDB.openReadOnly(path.toString());
  12. } catch (RocksDBException e) {
  13. throw new RuntimeException(e);
  14. }
  15. }
  16. }

代码示例来源:origin: lmdbjava/benchmarks

  1. @Override
  2. public void setup(final BenchmarkParams b) throws IOException {
  3. super.setup(b);
  4. wkb = new UnsafeBuffer(new byte[keySize]);
  5. wvb = new UnsafeBuffer(new byte[valSize]);
  6. loadLibrary();
  7. final Options options = new Options();
  8. options.setCreateIfMissing(true);
  9. options.setCompressionType(NO_COMPRESSION);
  10. try {
  11. db = open(options, tmp.getAbsolutePath());
  12. } catch (final RocksDBException ex) {
  13. throw new IOException(ex);
  14. }
  15. }

代码示例来源:origin: locationtech/geowave

  1. public synchronized RocksDBDataIndexTable getDataIndexTable(
  2. final String tableName,
  3. final short adapterId) {
  4. if (indexWriteOptions == null) {
  5. RocksDB.loadLibrary();
  6. final int cores = Runtime.getRuntime().availableProcessors();
  7. indexWriteOptions =
  8. new Options().setCreateIfMissing(true).prepareForBulkLoad().setIncreaseParallelism(cores);
  9. indexReadOptions = new Options().setIncreaseParallelism(cores);
  10. }
  11. final String directory = subDirectory + "/" + tableName;
  12. return dataIndexTableCache.get(
  13. (DataIndexCacheKey) keyCache.get(directory, d -> new DataIndexCacheKey(d, adapterId)));
  14. }

代码示例来源:origin: locationtech/geowave

  1. public synchronized RocksDBIndexTable getIndexTable(
  2. final String tableName,
  3. final short adapterId,
  4. final byte[] partition,
  5. final boolean requiresTimestamp) {
  6. if (indexWriteOptions == null) {
  7. RocksDB.loadLibrary();
  8. final int cores = Runtime.getRuntime().availableProcessors();
  9. indexWriteOptions =
  10. new Options().setCreateIfMissing(true).prepareForBulkLoad().setIncreaseParallelism(cores);
  11. indexReadOptions = new Options().setIncreaseParallelism(cores);
  12. }
  13. final String directory = subDirectory + "/" + tableName;
  14. return indexTableCache.get(
  15. (IndexCacheKey) keyCache.get(
  16. directory,
  17. d -> new IndexCacheKey(d, adapterId, partition, requiresTimestamp)));
  18. }

代码示例来源:origin: weiboad/fiery

  1. public DBSharder(String dbpath, Long timestamp) throws RocksDBException {
  2. log = LoggerFactory.getLogger(DBSharder.class);
  3. RocksDB.loadLibrary();
  4. options = new Options();
  5. env = options.getEnv();
  6. env.setBackgroundThreads(2);
  7. options.setEnv(env);
  8. options.setCreateIfMissing(true);
  9. options.setDbLogDir(dbpath + "/logs/");
  10. options.setMergeOperator(new StringAppendOperator());
  11. db = RocksDB.open(options, dbpath + "/" + timestamp);
  12. }

代码示例来源:origin: locationtech/geowave

  1. public synchronized RocksDBMetadataTable getMetadataTable(final MetadataType type) {
  2. if (metadataOptions == null) {
  3. RocksDB.loadLibrary();
  4. metadataOptions = new Options().setCreateIfMissing(true).optimizeForSmallDb();
  5. }
  6. final String directory = subDirectory + "/" + type.name();
  7. return metadataTableCache.get(
  8. keyCache.get(directory, d -> new CacheKey(d, type.equals(MetadataType.STATS))));
  9. }

相关文章