当前位置: 首页>>代码示例>>Java>>正文


Java ReadOptions类代码示例

本文整理汇总了Java中org.rocksdb.ReadOptions的典型用法代码示例。如果您正苦于以下问题:Java ReadOptions类的具体用法?Java ReadOptions怎么用?Java ReadOptions使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


ReadOptions类属于org.rocksdb包,在下文中一共展示了ReadOptions类的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: writeKVStateMetaData

import org.rocksdb.ReadOptions; //导入依赖的package包/类
private void writeKVStateMetaData() throws IOException {

			List<RegisteredKeyedBackendStateMetaInfo.Snapshot<?, ?>> metaInfoSnapshots =
				new ArrayList<>(stateBackend.kvStateInformation.size());

			int kvStateId = 0;
			for (Map.Entry<String, Tuple2<ColumnFamilyHandle, RegisteredKeyedBackendStateMetaInfo<?, ?>>> column :
				stateBackend.kvStateInformation.entrySet()) {

				metaInfoSnapshots.add(column.getValue().f1.snapshot());

				//retrieve iterator for this k/v states
				readOptions = new ReadOptions();
				readOptions.setSnapshot(snapshot);

				kvStateIterators.add(
					new Tuple2<>(stateBackend.db.newIterator(column.getValue().f0, readOptions), kvStateId));

				++kvStateId;
			}

			KeyedBackendSerializationProxy<K> serializationProxy =
				new KeyedBackendSerializationProxy<>(
					stateBackend.getKeySerializer(),
					metaInfoSnapshots,
					!Objects.equals(UncompressedStreamCompressionDecorator.INSTANCE, stateBackend.keyGroupCompressionDecorator));

			serializationProxy.write(outputView);
		}
 
开发者ID:axbaretto,项目名称:flink,代码行数:30,代码来源:RocksDBKeyedStateBackend.java

示例2: setReadOptions

import org.rocksdb.ReadOptions; //导入依赖的package包/类
public RocksDbWrapper setReadOptions(ReadOptions readOptions) {
    if (this.readOptions != null) {
        RocksDbUtils.closeRocksObjects(this.readOptions);
    }
    this.readOptions = readOptions;
    myOwnReadOptions = false;
    return this;
}
 
开发者ID:DDTH,项目名称:ddth-queue,代码行数:9,代码来源:RocksDbWrapper.java

示例3: get

import org.rocksdb.ReadOptions; //导入依赖的package包/类
/**
 * Gets a value from a column family, specifying read options.
 * 
 * @param cfName
 * @param readOptions
 * @param key
 * @return
 * @throws RocksDbException
 */
public byte[] get(String cfName, ReadOptions readOptions, String key) throws RocksDbException {
    if (cfName == null) {
        cfName = DEFAULT_COLUMN_FAMILY;
    }
    ColumnFamilyHandle cfh = columnFamilyHandles.get(cfName);
    if (cfh == null) {
        throw new RocksDbException.ColumnFamilyNotExists(cfName);
    }
    return get(cfh, readOptions != null ? readOptions : this.readOptions,
            key.getBytes(RocksDbUtils.UTF8));
}
 
开发者ID:DDTH,项目名称:ddth-queue,代码行数:21,代码来源:RocksDbWrapper.java

示例4: setReadOptions

import org.rocksdb.ReadOptions; //导入依赖的package包/类
public RocksDbWrapper setReadOptions(ReadOptions readOptions) {
    if (this.readOptions != null && myOwnReadOptions) {
        RocksDbUtils.closeRocksObjects(this.readOptions);
    }
    this.readOptions = readOptions;
    myOwnReadOptions = false;
    return this;
}
 
开发者ID:DDTH,项目名称:ddth-commons,代码行数:9,代码来源:RocksDbWrapper.java

示例5: get

import org.rocksdb.ReadOptions; //导入依赖的package包/类
/**
 * Gets a value from a column family, specifying read options.
 * 
 * @param cfName
 * @param readOptions
 * @param key
 * @return
 * @throws RocksDbException
 */
public byte[] get(String cfName, ReadOptions readOptions, String key) throws RocksDbException {
    if (cfName == null) {
        cfName = DEFAULT_COLUMN_FAMILY;
    }
    ColumnFamilyHandle cfh = columnFamilyHandles.get(cfName);
    if (cfh == null) {
        throw new RocksDbException.ColumnFamilyNotExists(cfName);
    }
    return get(cfh, readOptions, key.getBytes(RocksDbUtils.UTF8));
}
 
开发者ID:DDTH,项目名称:ddth-commons,代码行数:20,代码来源:RocksDbWrapper.java

示例6: FeatureStoreRocksDb

import org.rocksdb.ReadOptions; //导入依赖的package包/类
FeatureStoreRocksDb(MetricsContext metricsContext, File dbPath) {

    MetricRegistry metrics = metricsContext.metrics();
    String context = metricsContext.context();

    putTimer = metrics.timer(MetricRegistry.name(
        context + "." + METRICS_PATH, "putTimer"));
    putMeter = metrics.meter(MetricRegistry.name(
        context + "." + METRICS_PATH, "putMeter"));
    this.loadAllTimer = metrics.timer(MetricRegistry.name(
        context + "." + METRICS_PATH, "loadAllTimer"));
    this.loadAllMeter = metrics.meter(MetricRegistry.name(
        context + "." + METRICS_PATH, "loadAllMeter"));

    this.findAllTimer = metrics.timer(MetricRegistry.name(
        context + "." + METRICS_PATH, "findAllTimer"));
    this.findAllMeter = metrics.meter(MetricRegistry.name(
        context + "." + METRICS_PATH, "findAllMeter"));

    BlockBasedTableConfig tableConfig = new BlockBasedTableConfig();
    tableConfig.setBlockCacheSize(BLOCK_CACHE_SIZE);
    tableConfig.setBlockSize(BLOCK_SIZE);

    options = new Options();
    options.setTableFormatConfig(tableConfig);
    options.setWriteBufferSize(WRITE_BUFFER_SIZE);
    options.setCompressionType(COMPRESSION_TYPE);
    options.setCompactionStyle(COMPACTION_STYLE);
    options.setMaxWriteBufferNumber(MAX_WRITE_BUFFER_NUMBER);
    options.setCreateIfMissing(CREATE_IF_MISSING);
    options.setErrorIfExists(ERROR_IF_EXISTS);
    writeOptions = new WriteOptions();
    writeOptions.setDisableWAL(DISABLE_WAL);
    writeOptions.setSync(true);
    readOptions = new ReadOptions();
    readOptions.setVerifyChecksums(true);
    readOptions.setFillCache(true);
    flushOptions = new FlushOptions();
    flushOptions.setWaitForFlush(WAIT_FOR_FLUSH);

    final File parent = new File("/tmp", "outland");
    rocksDir = new File(dbPath, "feature-store");
    //noinspection ResultOfMethodCallIgnored
    rocksDir.getParentFile().mkdirs();
    rocks = initializeRocksDb(); // todo: move this out?
  }
 
开发者ID:dehora,项目名称:outland,代码行数:47,代码来源:FeatureStoreRocksDb.java

示例7: getReadOptions

import org.rocksdb.ReadOptions; //导入依赖的package包/类
public ReadOptions getReadOptions() {
    return this.readOptions;
}
 
开发者ID:DDTH,项目名称:ddth-queue,代码行数:4,代码来源:RocksDbWrapper.java

示例8: openReadOnly

import org.rocksdb.ReadOptions; //导入依赖的package包/类
/**
 * Opens a RocksDB with specified options in read-only mode.
 * 
 * @param directory
 *            existing RocksDB data directory
 * @param dbOptions
 * @param readOptions
 * @return
 * @throws RocksDBException
 */
public static RocksDbWrapper openReadOnly(File directory, DBOptions dbOptions,
        ReadOptions readOptions) throws RocksDBException {
    RocksDbWrapper rocksDbWrapper = new RocksDbWrapper(directory, true);
    rocksDbWrapper.setDbOptions(dbOptions).setReadOptions(readOptions);
    rocksDbWrapper.init();
    return rocksDbWrapper;
}
 
开发者ID:DDTH,项目名称:ddth-queue,代码行数:18,代码来源:RocksDbWrapper.java

示例9: openReadWrite

import org.rocksdb.ReadOptions; //导入依赖的package包/类
/**
 * Opens a RocksDB with specified options in read/write mode.
 * 
 * @param directory
 *            directory to store RocksDB data
 * @param dbOptions
 * @param readOptions
 * @param writeOptions
 * @param columnFamilies
 *            list of column families to store key/value (the column family
 *            "default" will be automatically added)
 * @return
 * @throws RocksDBException
 */
public static RocksDbWrapper openReadWrite(File directory, DBOptions dbOptions,
        ReadOptions readOptions, WriteOptions writeOptions, String[] columnFamilies)
        throws RocksDBException {
    RocksDbWrapper rocksDbWrapper = new RocksDbWrapper(directory, false);
    rocksDbWrapper.setDbOptions(dbOptions).setReadOptions(readOptions)
            .setWriteOptions(writeOptions);
    rocksDbWrapper.setColumnFamilies(RocksDbUtils.buildColumnFamilyDescriptors(columnFamilies));
    rocksDbWrapper.init();
    return rocksDbWrapper;
}
 
开发者ID:DDTH,项目名称:ddth-queue,代码行数:25,代码来源:RocksDbWrapper.java

示例10: openReadOnly

import org.rocksdb.ReadOptions; //导入依赖的package包/类
/**
 * Open a {@link RocksDB} with specified options in read-only mode.
 * 
 * @param directory
 *            existing {@link RocksDB} data directory
 * @param dbOptions
 * @param readOptions
 * @return
 * @throws RocksDBException
 * @throws IOException
 */
public static RocksDbWrapper openReadOnly(File directory, DBOptions dbOptions,
        ReadOptions readOptions) throws RocksDbException, IOException {
    RocksDbWrapper rocksDbWrapper = new RocksDbWrapper(directory, true);
    rocksDbWrapper.setDbOptions(dbOptions).setReadOptions(readOptions);
    rocksDbWrapper.init();
    return rocksDbWrapper;
}
 
开发者ID:DDTH,项目名称:ddth-commons,代码行数:19,代码来源:RocksDbWrapper.java

示例11: openReadWrite

import org.rocksdb.ReadOptions; //导入依赖的package包/类
/**
 * Open a {@link RocksDB} with specified options in read/write mode.
 * 
 * @param directory
 *            directory to store {@link RocksDB} data
 * @param dbOptions
 * @param readOptions
 * @param writeOptions
 * @param columnFamilies
 *            list of column families to store key/value (the column family
 *            "default" will be automatically added)
 * @return
 * @throws RocksDbException
 * @throws IOException
 */
public static RocksDbWrapper openReadWrite(File directory, DBOptions dbOptions,
        ReadOptions readOptions, WriteOptions writeOptions, String... columnFamilies)
        throws RocksDbException, IOException {
    RocksDbWrapper rocksDbWrapper = new RocksDbWrapper(directory, false);
    rocksDbWrapper.setDbOptions(dbOptions).setReadOptions(readOptions)
            .setWriteOptions(writeOptions);
    rocksDbWrapper.setColumnFamilies(RocksDbUtils.buildColumnFamilyDescriptors(columnFamilies));
    rocksDbWrapper.init();
    return rocksDbWrapper;
}
 
开发者ID:DDTH,项目名称:ddth-commons,代码行数:26,代码来源:RocksDbWrapper.java

示例12: buildReadOptions

import org.rocksdb.ReadOptions; //导入依赖的package包/类
/**
 * Builds default RocskDb ReadOptions.
 * 
 * @return
 */
public static ReadOptions buildReadOptions() {
    return buildReadOptions(true);
}
 
开发者ID:DDTH,项目名称:ddth-queue,代码行数:9,代码来源:RocksDbUtils.java


注:本文中的org.rocksdb.ReadOptions类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。