Fix formatting identified by arc lint
This commit is contained in:
parent
0f2d2fcff6
commit
188bb2e7ad
@ -1083,9 +1083,10 @@ jbyte Java_org_rocksdb_Options_compressionType(
|
||||
std::vector<rocksdb::CompressionType> rocksdb_compression_vector_helper(
|
||||
JNIEnv* env, jbyteArray jcompressionLevels) {
|
||||
std::vector<rocksdb::CompressionType> compressionLevels;
|
||||
|
||||
|
||||
jsize len = env->GetArrayLength(jcompressionLevels);
|
||||
jbyte* jcompressionLevel = env->GetByteArrayElements(jcompressionLevels, NULL);
|
||||
jbyte* jcompressionLevel = env->GetByteArrayElements(jcompressionLevels,
|
||||
NULL);
|
||||
for(int i = 0; i < len; i++) {
|
||||
jbyte jcl;
|
||||
jcl = jcompressionLevel[i];
|
||||
|
@ -52,7 +52,8 @@ template<class PTR, class DERIVED> class RocksDBNativeClass {
|
||||
};
|
||||
|
||||
// Native class template for sub-classes of RocksMutableObject
|
||||
template<class PTR, class DERIVED> class NativeRocksMutableObject : public RocksDBNativeClass<PTR, DERIVED> {
|
||||
template<class PTR, class DERIVED> class NativeRocksMutableObject
|
||||
: public RocksDBNativeClass<PTR, DERIVED> {
|
||||
public:
|
||||
|
||||
static jmethodID getSetNativeHandleMethod(JNIEnv* env) {
|
||||
@ -63,8 +64,10 @@ template<class PTR, class DERIVED> class NativeRocksMutableObject : public Rocks
|
||||
}
|
||||
|
||||
// Pass the pointer to the java side.
|
||||
static void setHandle(JNIEnv* env, jobject jobj, PTR ptr, jboolean java_owns_handle) {
|
||||
env->CallVoidMethod(jobj, getSetNativeHandleMethod(env), reinterpret_cast<jlong>(ptr), java_owns_handle);
|
||||
static void setHandle(JNIEnv* env, jobject jobj, PTR ptr,
|
||||
jboolean java_owns_handle) {
|
||||
env->CallVoidMethod(jobj, getSetNativeHandleMethod(env),
|
||||
reinterpret_cast<jlong>(ptr), java_owns_handle);
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -156,8 +156,8 @@ jlongArray Java_org_rocksdb_RocksDB_openROnly__JLjava_lang_String_2_3_3B_3J(
|
||||
jlongArray Java_org_rocksdb_RocksDB_open__JLjava_lang_String_2_3_3B_3J(
|
||||
JNIEnv* env, jclass jcls, jlong jopt_handle, jstring jdb_path,
|
||||
jobjectArray jcolumn_names, jlongArray jcolumn_options) {
|
||||
return rocksdb_open_helper(env, jopt_handle, jdb_path, jcolumn_names, jcolumn_options,
|
||||
(rocksdb::Status(*)
|
||||
return rocksdb_open_helper(env, jopt_handle, jdb_path, jcolumn_names,
|
||||
jcolumn_options, (rocksdb::Status(*)
|
||||
(const rocksdb::DBOptions&, const std::string&,
|
||||
const std::vector<rocksdb::ColumnFamilyDescriptor>&,
|
||||
std::vector<rocksdb::ColumnFamilyHandle*>*, rocksdb::DB**)
|
||||
@ -458,7 +458,7 @@ jboolean Java_org_rocksdb_RocksDB_keyMayExist__JJ_3BIJLjava_lang_StringBuffer_2(
|
||||
rocksdb::RocksDBExceptionJni::ThrowNew(env,
|
||||
rocksdb::Status::InvalidArgument("Invalid ColumnFamilyHandle."));
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -5,7 +5,8 @@
|
||||
|
||||
package org.rocksdb;
|
||||
|
||||
public abstract class AbstractWriteBatch extends RocksObject implements WriteBatchInterface {
|
||||
public abstract class AbstractWriteBatch extends RocksObject
|
||||
implements WriteBatchInterface {
|
||||
|
||||
protected AbstractWriteBatch(final long nativeHandle) {
|
||||
super(nativeHandle);
|
||||
@ -24,9 +25,11 @@ public abstract class AbstractWriteBatch extends RocksObject implements WriteBat
|
||||
}
|
||||
|
||||
@Override
|
||||
public void put(ColumnFamilyHandle columnFamilyHandle, byte[] key, byte[] value) {
|
||||
public void put(ColumnFamilyHandle columnFamilyHandle, byte[] key,
|
||||
byte[] value) {
|
||||
assert (isOwningHandle());
|
||||
put(nativeHandle_, key, key.length, value, value.length, columnFamilyHandle.nativeHandle_);
|
||||
put(nativeHandle_, key, key.length, value, value.length,
|
||||
columnFamilyHandle.nativeHandle_);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -36,9 +39,11 @@ public abstract class AbstractWriteBatch extends RocksObject implements WriteBat
|
||||
}
|
||||
|
||||
@Override
|
||||
public void merge(ColumnFamilyHandle columnFamilyHandle, byte[] key, byte[] value) {
|
||||
public void merge(ColumnFamilyHandle columnFamilyHandle, byte[] key,
|
||||
byte[] value) {
|
||||
assert (isOwningHandle());
|
||||
merge(nativeHandle_, key, key.length, value, value.length, columnFamilyHandle.nativeHandle_);
|
||||
merge(nativeHandle_, key, key.length, value, value.length,
|
||||
columnFamilyHandle.nativeHandle_);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -21,8 +21,8 @@ public class BackupableDB extends RocksDB {
|
||||
*
|
||||
* @param opt {@link org.rocksdb.Options} to set for the database.
|
||||
* @param bopt {@link org.rocksdb.BackupableDBOptions} to use.
|
||||
* @param db_path Path to store data to. The path for storing the backup should be
|
||||
* specified in the {@link org.rocksdb.BackupableDBOptions}.
|
||||
* @param db_path Path to store data to. The path for storing the backup
|
||||
* should be specified in the {@link org.rocksdb.BackupableDBOptions}.
|
||||
*
|
||||
* @return {@link BackupableDB} reference to the opened database.
|
||||
*
|
||||
@ -34,7 +34,8 @@ public class BackupableDB extends RocksDB {
|
||||
throws RocksDBException {
|
||||
|
||||
final RocksDB db = RocksDB.open(opt, db_path);
|
||||
final BackupableDB bdb = new BackupableDB(open(db.nativeHandle_, bopt.nativeHandle_));
|
||||
final BackupableDB bdb = new BackupableDB(open(db.nativeHandle_,
|
||||
bopt.nativeHandle_));
|
||||
|
||||
// Prevent the RocksDB object from attempting to delete
|
||||
// the underly C++ DB object.
|
||||
@ -151,7 +152,8 @@ public class BackupableDB extends RocksDB {
|
||||
super.finalize();
|
||||
}
|
||||
|
||||
protected native static long open(final long rocksDBHandle, final long backupDBOptionsHandle);
|
||||
protected native static long open(final long rocksDBHandle,
|
||||
final long backupDBOptionsHandle);
|
||||
protected native void createNewBackup(long handle, boolean flag)
|
||||
throws RocksDBException;
|
||||
protected native void purgeOldBackups(long handle, int numBackupsToKeep)
|
||||
|
@ -21,8 +21,8 @@ public class BackupableDBOptions extends RocksObject {
|
||||
/**
|
||||
* <p>BackupableDBOptions constructor.</p>
|
||||
*
|
||||
* @param path Where to keep the backup files. Has to be different than db name.
|
||||
* Best to set this to {@code db name_ + "/backups"}
|
||||
* @param path Where to keep the backup files. Has to be different than db
|
||||
* name. Best to set this to {@code db name_ + "/backups"}
|
||||
* @throws java.lang.IllegalArgumentException if illegal path is used.
|
||||
*/
|
||||
public BackupableDBOptions(final String path) {
|
||||
@ -31,7 +31,8 @@ public class BackupableDBOptions extends RocksObject {
|
||||
|
||||
private static String ensureWritableFile(final String path) {
|
||||
final File backupPath = path == null ? null : new File(path);
|
||||
if (backupPath == null || !backupPath.isDirectory() || !backupPath.canWrite()) {
|
||||
if (backupPath == null || !backupPath.isDirectory() ||
|
||||
!backupPath.canWrite()) {
|
||||
throw new IllegalArgumentException("Illegal path provided.");
|
||||
} else {
|
||||
return path;
|
||||
@ -51,10 +52,11 @@ public class BackupableDBOptions extends RocksObject {
|
||||
/**
|
||||
* <p>Share table files between backups.</p>
|
||||
*
|
||||
* @param shareTableFiles If {@code share_table_files == true}, backup will assume
|
||||
* that table files with same name have the same contents. This enables incremental
|
||||
* backups and avoids unnecessary data copies. If {@code share_table_files == false},
|
||||
* each backup will be on its own and will not share any data with other backups.
|
||||
* @param shareTableFiles If {@code share_table_files == true}, backup will
|
||||
* assume that table files with same name have the same contents. This
|
||||
* enables incremental backups and avoids unnecessary data copies. If
|
||||
* {@code share_table_files == false}, each backup will be on its own and
|
||||
* will not share any data with other backups.
|
||||
*
|
||||
* <p>Default: true</p>
|
||||
*
|
||||
@ -80,10 +82,10 @@ public class BackupableDBOptions extends RocksObject {
|
||||
/**
|
||||
* <p>Set synchronous backups.</p>
|
||||
*
|
||||
* @param sync If {@code sync == true}, we can guarantee you'll get consistent backup
|
||||
* even on a machine crash/reboot. Backup process is slower with sync enabled.
|
||||
* If {@code sync == false}, we don't guarantee anything on machine reboot.
|
||||
* However,chances are some of the backups are consistent.
|
||||
* @param sync If {@code sync == true}, we can guarantee you'll get consistent
|
||||
* backup even on a machine crash/reboot. Backup process is slower with sync
|
||||
* enabled. If {@code sync == false}, we don't guarantee anything on machine
|
||||
* reboot. However, chances are some of the backups are consistent.
|
||||
*
|
||||
* <p>Default: true</p>
|
||||
*
|
||||
@ -108,7 +110,8 @@ public class BackupableDBOptions extends RocksObject {
|
||||
/**
|
||||
* <p>Set if old data will be destroyed.</p>
|
||||
*
|
||||
* @param destroyOldData If true, it will delete whatever backups there are already.
|
||||
* @param destroyOldData If true, it will delete whatever backups there are
|
||||
* already.
|
||||
*
|
||||
* <p>Default: false</p>
|
||||
*
|
||||
@ -133,9 +136,9 @@ public class BackupableDBOptions extends RocksObject {
|
||||
/**
|
||||
* <p>Set if log files shall be persisted.</p>
|
||||
*
|
||||
* @param backupLogFiles If false, we won't backup log files. This option can be
|
||||
* useful for backing up in-memory databases where log file are persisted,but table
|
||||
* files are in memory.
|
||||
* @param backupLogFiles If false, we won't backup log files. This option can
|
||||
* be useful for backing up in-memory databases where log file are
|
||||
* persisted, but table files are in memory.
|
||||
*
|
||||
* <p>Default: true</p>
|
||||
*
|
||||
@ -160,8 +163,8 @@ public class BackupableDBOptions extends RocksObject {
|
||||
/**
|
||||
* <p>Set backup rate limit.</p>
|
||||
*
|
||||
* @param backupRateLimit Max bytes that can be transferred in a second during backup.
|
||||
* If 0 or negative, then go as fast as you can.
|
||||
* @param backupRateLimit Max bytes that can be transferred in a second during
|
||||
* backup. If 0 or negative, then go as fast as you can.
|
||||
*
|
||||
* <p>Default: 0</p>
|
||||
*
|
||||
@ -175,10 +178,11 @@ public class BackupableDBOptions extends RocksObject {
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>Return backup rate limit which described the max bytes that can be transferred in a
|
||||
* second during backup.</p>
|
||||
* <p>Return backup rate limit which described the max bytes that can be
|
||||
* transferred in a second during backup.</p>
|
||||
*
|
||||
* @return numerical value describing the backup transfer limit in bytes per second.
|
||||
* @return numerical value describing the backup transfer limit in bytes per
|
||||
* second.
|
||||
*/
|
||||
public long backupRateLimit() {
|
||||
assert(isOwningHandle());
|
||||
@ -188,8 +192,8 @@ public class BackupableDBOptions extends RocksObject {
|
||||
/**
|
||||
* <p>Set restore rate limit.</p>
|
||||
*
|
||||
* @param restoreRateLimit Max bytes that can be transferred in a second during restore.
|
||||
* If 0 or negative, then go as fast as you can.
|
||||
* @param restoreRateLimit Max bytes that can be transferred in a second
|
||||
* during restore. If 0 or negative, then go as fast as you can.
|
||||
*
|
||||
* <p>Default: 0</p>
|
||||
*
|
||||
@ -203,10 +207,11 @@ public class BackupableDBOptions extends RocksObject {
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>Return restore rate limit which described the max bytes that can be transferred in a
|
||||
* second during restore.</p>
|
||||
* <p>Return restore rate limit which described the max bytes that can be
|
||||
* transferred in a second during restore.</p>
|
||||
*
|
||||
* @return numerical value describing the restore transfer limit in bytes per second.
|
||||
* @return numerical value describing the restore transfer limit in bytes per
|
||||
* second.
|
||||
*/
|
||||
public long restoreRateLimit() {
|
||||
assert(isOwningHandle());
|
||||
@ -214,12 +219,13 @@ public class BackupableDBOptions extends RocksObject {
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>Only used if share_table_files is set to true. If true, will consider that
|
||||
* backups can come from different databases, hence a sst is not uniquely
|
||||
* identified by its name, but by the triple (file name, crc32, file length)</p>
|
||||
* <p>Only used if share_table_files is set to true. If true, will consider
|
||||
* that backups can come from different databases, hence a sst is not uniquely
|
||||
* identified by its name, but by the triple (file name, crc32, file length)
|
||||
* </p>
|
||||
*
|
||||
* @param shareFilesWithChecksum boolean value indicating if SST files are stored
|
||||
* using the triple (file name, crc32, file length) and not its name.
|
||||
* @param shareFilesWithChecksum boolean value indicating if SST files are
|
||||
* stored using the triple (file name, crc32, file length) and not its name.
|
||||
*
|
||||
* <p>Note: this is an experimental option, and you'll need to set it manually
|
||||
* turn it on only if you know what you're doing*</p>
|
||||
|
@ -25,9 +25,9 @@ public class ColumnFamilyHandle extends RocksObject {
|
||||
* <p>Deletes underlying C++ iterator pointer.</p>
|
||||
*
|
||||
* <p>Note: the underlying handle can only be safely deleted if the RocksDB
|
||||
* instance related to a certain ColumnFamilyHandle is still valid and initialized.
|
||||
* Therefore {@code disposeInternal()} checks if the RocksDB is initialized
|
||||
* before freeing the native handle.</p>
|
||||
* instance related to a certain ColumnFamilyHandle is still valid and
|
||||
* initialized. Therefore {@code disposeInternal()} checks if the RocksDB is
|
||||
* initialized before freeing the native handle.</p>
|
||||
*/
|
||||
@Override
|
||||
protected void disposeInternal() {
|
||||
|
@ -13,8 +13,8 @@ import java.util.Properties;
|
||||
* ColumnFamilyOptions to control the behavior of a database. It will be used
|
||||
* during the creation of a {@link org.rocksdb.RocksDB} (i.e., RocksDB.open()).
|
||||
*
|
||||
* If {@link #dispose()} function is not called, then it will be GC'd automatically
|
||||
* and native resources will be released as part of the process.
|
||||
* If {@link #dispose()} function is not called, then it will be GC'd
|
||||
* automatically and native resources will be released as part of the process.
|
||||
*/
|
||||
public class ColumnFamilyOptions extends RocksObject
|
||||
implements ColumnFamilyOptionsInterface {
|
||||
@ -112,7 +112,8 @@ public class ColumnFamilyOptions extends RocksObject
|
||||
}
|
||||
|
||||
@Override
|
||||
public ColumnFamilyOptions setComparator(final BuiltinComparator builtinComparator) {
|
||||
public ColumnFamilyOptions setComparator(
|
||||
final BuiltinComparator builtinComparator) {
|
||||
assert(isOwningHandle());
|
||||
setComparatorHandle(nativeHandle_, builtinComparator.ordinal());
|
||||
return this;
|
||||
@ -139,13 +140,15 @@ public class ColumnFamilyOptions extends RocksObject
|
||||
}
|
||||
|
||||
@Override
|
||||
public ColumnFamilyOptions setMergeOperator(final MergeOperator mergeOperator) {
|
||||
public ColumnFamilyOptions setMergeOperator(
|
||||
final MergeOperator mergeOperator) {
|
||||
setMergeOperator(nativeHandle_, mergeOperator.newMergeOperatorHandle());
|
||||
return this;
|
||||
}
|
||||
|
||||
public ColumnFamilyOptions setCompactionFilter(
|
||||
final AbstractCompactionFilter<? extends AbstractSlice<?>> compactionFilter) {
|
||||
final AbstractCompactionFilter<? extends AbstractSlice<?>>
|
||||
compactionFilter) {
|
||||
setCompactionFilterHandle(nativeHandle_, compactionFilter.nativeHandle_);
|
||||
compactionFilter_ = compactionFilter;
|
||||
return this;
|
||||
@ -205,7 +208,8 @@ public class ColumnFamilyOptions extends RocksObject
|
||||
}
|
||||
|
||||
@Override
|
||||
public ColumnFamilyOptions setCompressionType(final CompressionType compressionType) {
|
||||
public ColumnFamilyOptions setCompressionType(
|
||||
final CompressionType compressionType) {
|
||||
setCompressionType(nativeHandle_, compressionType.getValue());
|
||||
return this;
|
||||
}
|
||||
@ -522,7 +526,8 @@ public class ColumnFamilyOptions extends RocksObject
|
||||
@Override
|
||||
public ColumnFamilyOptions setMaxSequentialSkipInIterations(
|
||||
final long maxSequentialSkipInIterations) {
|
||||
setMaxSequentialSkipInIterations(nativeHandle_, maxSequentialSkipInIterations);
|
||||
setMaxSequentialSkipInIterations(nativeHandle_,
|
||||
maxSequentialSkipInIterations);
|
||||
return this;
|
||||
}
|
||||
|
||||
@ -677,12 +682,12 @@ public class ColumnFamilyOptions extends RocksObject
|
||||
private native void optimizeUniversalStyleCompaction(long handle,
|
||||
long memtableMemoryBudget);
|
||||
private native void setComparatorHandle(long handle, int builtinComparator);
|
||||
private native void setComparatorHandle(long optHandle, long comparatorHandle);
|
||||
private native void setMergeOperatorName(
|
||||
long handle, String name);
|
||||
private native void setMergeOperator(
|
||||
long handle, long mergeOperatorHandle);
|
||||
private native void setCompactionFilterHandle(long handle, long compactionFilterHandle);
|
||||
private native void setComparatorHandle(long optHandle,
|
||||
long comparatorHandle);
|
||||
private native void setMergeOperatorName(long handle, String name);
|
||||
private native void setMergeOperator(long handle, long mergeOperatorHandle);
|
||||
private native void setCompactionFilterHandle(long handle,
|
||||
long compactionFilterHandle);
|
||||
private native void setWriteBufferSize(long handle, long writeBufferSize)
|
||||
throws IllegalArgumentException;
|
||||
private native long writeBufferSize(long handle);
|
||||
|
@ -11,8 +11,8 @@ import java.util.Properties;
|
||||
* DBOptions to control the behavior of a database. It will be used
|
||||
* during the creation of a {@link org.rocksdb.RocksDB} (i.e., RocksDB.open()).
|
||||
*
|
||||
* If {@link #dispose()} function is not called, then it will be GC'd automatically
|
||||
* and native resources will be released as part of the process.
|
||||
* If {@link #dispose()} function is not called, then it will be GC'd
|
||||
* automatically and native resources will be released as part of the process.
|
||||
*/
|
||||
public class DBOptions extends RocksObject implements DBOptionsInterface {
|
||||
static {
|
||||
|
@ -28,5 +28,6 @@ public abstract class DirectComparator extends AbstractComparator<DirectSlice> {
|
||||
return nativeHandle_;
|
||||
}
|
||||
|
||||
private native long createNewDirectComparator0(final long comparatorOptionsHandle);
|
||||
private native long createNewDirectComparator0(
|
||||
final long comparatorOptionsHandle);
|
||||
}
|
||||
|
@ -12,8 +12,8 @@ import java.util.List;
|
||||
* Options to control the behavior of a database. It will be used
|
||||
* during the creation of a {@link org.rocksdb.RocksDB} (i.e., RocksDB.open()).
|
||||
*
|
||||
* If {@link #dispose()} function is not called, then it will be GC'd automatically
|
||||
* and native resources will be released as part of the process.
|
||||
* If {@link #dispose()} function is not called, then it will be GC'd
|
||||
* automaticallyand native resources will be released as part of the process.
|
||||
*/
|
||||
public class Options extends RocksObject
|
||||
implements DBOptionsInterface, ColumnFamilyOptionsInterface {
|
||||
@ -41,7 +41,8 @@ public class Options extends RocksObject
|
||||
*/
|
||||
public Options(final DBOptions dbOptions,
|
||||
final ColumnFamilyOptions columnFamilyOptions) {
|
||||
super(newOptions(dbOptions.nativeHandle_, columnFamilyOptions.nativeHandle_));
|
||||
super(newOptions(dbOptions.nativeHandle_,
|
||||
columnFamilyOptions.nativeHandle_));
|
||||
env_ = Env.getDefault();
|
||||
}
|
||||
|
||||
@ -678,7 +679,8 @@ public class Options extends RocksObject
|
||||
}
|
||||
|
||||
@Override
|
||||
public Options setCompressionPerLevel(final List<CompressionType> compressionLevels) {
|
||||
public Options setCompressionPerLevel(
|
||||
final List<CompressionType> compressionLevels) {
|
||||
final byte[] byteCompressionTypes = new byte[
|
||||
compressionLevels.size()];
|
||||
for (int i = 0; i < compressionLevels.size(); i++) {
|
||||
@ -973,7 +975,8 @@ public class Options extends RocksObject
|
||||
@Override
|
||||
public Options setMaxSequentialSkipInIterations(
|
||||
final long maxSequentialSkipInIterations) {
|
||||
setMaxSequentialSkipInIterations(nativeHandle_, maxSequentialSkipInIterations);
|
||||
setMaxSequentialSkipInIterations(nativeHandle_,
|
||||
maxSequentialSkipInIterations);
|
||||
return this;
|
||||
}
|
||||
|
||||
@ -1189,7 +1192,8 @@ public class Options extends RocksObject
|
||||
private native void optimizeUniversalStyleCompaction(long handle,
|
||||
long memtableMemoryBudget);
|
||||
private native void setComparatorHandle(long handle, int builtinComparator);
|
||||
private native void setComparatorHandle(long optHandle, long comparatorHandle);
|
||||
private native void setComparatorHandle(long optHandle,
|
||||
long comparatorHandle);
|
||||
private native void setMergeOperatorName(
|
||||
long handle, String name);
|
||||
private native void setMergeOperator(
|
||||
|
@ -8,7 +8,8 @@ package org.rocksdb;
|
||||
/**
|
||||
* Just a Java wrapper around EmptyValueCompactionFilter implemented in C++
|
||||
*/
|
||||
public class RemoveEmptyValueCompactionFilter extends AbstractCompactionFilter<Slice> {
|
||||
public class RemoveEmptyValueCompactionFilter
|
||||
extends AbstractCompactionFilter<Slice> {
|
||||
public RemoveEmptyValueCompactionFilter() {
|
||||
super(createNewRemoveEmptyValueCompactionFilter0());
|
||||
}
|
||||
|
@ -153,5 +153,6 @@ public class RestoreBackupableDB extends RocksObject {
|
||||
private native int[] getCorruptedBackups(long handle);
|
||||
private native void garbageCollect(long handle)
|
||||
throws RocksDBException;
|
||||
@Override protected final native void disposeInternal(final long nativeHandle);
|
||||
@Override protected final native void disposeInternal(
|
||||
final long nativeHandle);
|
||||
}
|
||||
|
@ -16,11 +16,12 @@ public class RestoreOptions extends RocksObject {
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param keepLogFiles If true, restore won't overwrite the existing log files in wal_dir. It
|
||||
* will also move all log files from archive directory to wal_dir. Use this
|
||||
* option in combination with BackupableDBOptions::backup_log_files = false
|
||||
* for persisting in-memory databases.
|
||||
* Default: false
|
||||
* @param keepLogFiles If true, restore won't overwrite the existing log files
|
||||
* in wal_dir. It will also move all log files from archive directory to
|
||||
* wal_dir. Use this option in combination with
|
||||
* BackupableDBOptions::backup_log_files = false for persisting in-memory
|
||||
* databases.
|
||||
* Default: false
|
||||
*/
|
||||
public RestoreOptions(final boolean keepLogFiles) {
|
||||
super(newRestoreOptions(keepLogFiles));
|
||||
|
@ -112,14 +112,15 @@ public class TtlDB extends RocksDB {
|
||||
final List<Integer> ttlValues, final boolean readOnly)
|
||||
throws RocksDBException {
|
||||
if (columnFamilyDescriptors.size() != ttlValues.size()) {
|
||||
throw new IllegalArgumentException("There must be a ttl value per column" +
|
||||
"family handle.");
|
||||
throw new IllegalArgumentException("There must be a ttl value per column"
|
||||
+ "family handle.");
|
||||
}
|
||||
|
||||
final byte[][] cfNames = new byte[columnFamilyDescriptors.size()][];
|
||||
final long[] cfOptionHandles = new long[columnFamilyDescriptors.size()];
|
||||
for (int i = 0; i < columnFamilyDescriptors.size(); i++) {
|
||||
final ColumnFamilyDescriptor cfDescriptor = columnFamilyDescriptors.get(i);
|
||||
final ColumnFamilyDescriptor cfDescriptor =
|
||||
columnFamilyDescriptors.get(i);
|
||||
cfNames[i] = cfDescriptor.columnFamilyName();
|
||||
cfOptionHandles[i] = cfDescriptor.columnFamilyOptions().nativeHandle_;
|
||||
}
|
||||
|
@ -84,13 +84,15 @@ public class WriteBatch extends AbstractWriteBatch {
|
||||
@Override final native void clear0(final long handle);
|
||||
|
||||
private native static long newWriteBatch(final int reserved_bytes);
|
||||
private native void iterate(final long handle, final long handlerHandle) throws RocksDBException;
|
||||
private native void iterate(final long handle, final long handlerHandle)
|
||||
throws RocksDBException;
|
||||
|
||||
|
||||
/**
|
||||
* Handler callback for iterating over the contents of a batch.
|
||||
*/
|
||||
public static abstract class Handler extends AbstractImmutableNativeReference {
|
||||
public static abstract class Handler
|
||||
extends AbstractImmutableNativeReference {
|
||||
private final long nativeHandle_;
|
||||
public Handler() {
|
||||
super(true);
|
||||
|
@ -12,10 +12,10 @@ package org.rocksdb;
|
||||
* Calling put, merge, remove or putLogData calls the same function
|
||||
* as with {@link org.rocksdb.WriteBatch} whilst also building an index.
|
||||
*
|
||||
* A user can call {@link org.rocksdb.WriteBatchWithIndex#newIterator() }to create an iterator
|
||||
* over the write batch or
|
||||
* {@link org.rocksdb.WriteBatchWithIndex#newIteratorWithBase(org.rocksdb.RocksIterator)} to
|
||||
* get an iterator for the database with Read-Your-Own-Writes like capability
|
||||
* A user can call {@link org.rocksdb.WriteBatchWithIndex#newIterator()} to
|
||||
* create an iterator over the write batch or
|
||||
* {@link org.rocksdb.WriteBatchWithIndex#newIteratorWithBase(org.rocksdb.RocksIterator)}
|
||||
* to get an iterator for the database with Read-Your-Own-Writes like capability
|
||||
*/
|
||||
public class WriteBatchWithIndex extends AbstractWriteBatch {
|
||||
/**
|
||||
@ -56,9 +56,12 @@ public class WriteBatchWithIndex extends AbstractWriteBatch {
|
||||
* inserting a duplicate key, in this way an iterator will never
|
||||
* show two entries with the same key.
|
||||
*/
|
||||
public WriteBatchWithIndex(final AbstractComparator<? extends AbstractSlice<?>>
|
||||
fallbackIndexComparator, final int reservedBytes, final boolean overwriteKey) {
|
||||
super(newWriteBatchWithIndex(fallbackIndexComparator.getNativeHandle(), reservedBytes, overwriteKey));
|
||||
public WriteBatchWithIndex(
|
||||
final AbstractComparator<? extends AbstractSlice<?>>
|
||||
fallbackIndexComparator, final int reservedBytes,
|
||||
final boolean overwriteKey) {
|
||||
super(newWriteBatchWithIndex(fallbackIndexComparator.getNativeHandle(),
|
||||
reservedBytes, overwriteKey));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -70,9 +73,11 @@ public class WriteBatchWithIndex extends AbstractWriteBatch {
|
||||
* time.
|
||||
*
|
||||
* @param columnFamilyHandle The column family to iterate over
|
||||
* @return An iterator for the Write Batch contents, restricted to the column family
|
||||
* @return An iterator for the Write Batch contents, restricted to the column
|
||||
* family
|
||||
*/
|
||||
public WBWIRocksIterator newIterator(final ColumnFamilyHandle columnFamilyHandle) {
|
||||
public WBWIRocksIterator newIterator(
|
||||
final ColumnFamilyHandle columnFamilyHandle) {
|
||||
return new WBWIRocksIterator(this, iterator1(nativeHandle_,
|
||||
columnFamilyHandle.nativeHandle_));
|
||||
}
|
||||
@ -97,11 +102,13 @@ public class WriteBatchWithIndex extends AbstractWriteBatch {
|
||||
* as a delta and baseIterator as a base
|
||||
*
|
||||
* @param columnFamilyHandle The column family to iterate over
|
||||
* @param baseIterator The base iterator, e.g. {@link org.rocksdb.RocksDB#newIterator()}
|
||||
* @return An iterator which shows a view comprised of both the database point-in-time
|
||||
* from baseIterator and modifications made in this write batch.
|
||||
* @param baseIterator The base iterator,
|
||||
* e.g. {@link org.rocksdb.RocksDB#newIterator()}
|
||||
* @return An iterator which shows a view comprised of both the database
|
||||
* point-in-time from baseIterator and modifications made in this write batch.
|
||||
*/
|
||||
public RocksIterator newIteratorWithBase(final ColumnFamilyHandle columnFamilyHandle,
|
||||
public RocksIterator newIteratorWithBase(
|
||||
final ColumnFamilyHandle columnFamilyHandle,
|
||||
final RocksIterator baseIterator) {
|
||||
RocksIterator iterator = new RocksIterator(
|
||||
baseIterator.parent_,
|
||||
@ -116,14 +123,17 @@ public class WriteBatchWithIndex extends AbstractWriteBatch {
|
||||
/**
|
||||
* Provides Read-Your-Own-Writes like functionality by
|
||||
* creating a new Iterator that will use {@link org.rocksdb.WBWIRocksIterator}
|
||||
* as a delta and baseIterator as a base. Operates on the default column family.
|
||||
* as a delta and baseIterator as a base. Operates on the default column
|
||||
* family.
|
||||
*
|
||||
* @param baseIterator The base iterator, e.g. {@link org.rocksdb.RocksDB#newIterator()}
|
||||
* @return An iterator which shows a view comprised of both the database point-in-time
|
||||
* from baseIterator and modifications made in this write batch.
|
||||
* @param baseIterator The base iterator,
|
||||
* e.g. {@link org.rocksdb.RocksDB#newIterator()}
|
||||
* @return An iterator which shows a view comprised of both the database
|
||||
* point-in-timefrom baseIterator and modifications made in this write batch.
|
||||
*/
|
||||
public RocksIterator newIteratorWithBase(final RocksIterator baseIterator) {
|
||||
return newIteratorWithBase(baseIterator.parent_.getDefaultColumnFamily(), baseIterator);
|
||||
return newIteratorWithBase(baseIterator.parent_.getDefaultColumnFamily(),
|
||||
baseIterator);
|
||||
}
|
||||
|
||||
@Override protected final native void disposeInternal(final long handle);
|
||||
@ -153,5 +163,6 @@ public class WriteBatchWithIndex extends AbstractWriteBatch {
|
||||
final boolean overwriteKey);
|
||||
private native long iterator0(final long handle);
|
||||
private native long iterator1(final long handle, final long cfHandle);
|
||||
private native long iteratorWithBase(final long handle, final long baseIteratorHandle, final long cfHandle);
|
||||
private native long iteratorWithBase(final long handle,
|
||||
final long baseIteratorHandle, final long cfHandle);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user